rvm icon indicating copy to clipboard operation
rvm copied to clipboard

RVM 1.29.8 throwing "_system_name: unbound variable" error on AWS under Packer

Open rnhurt opened this issue 6 years ago • 5 comments

Description

RVM suddenly started throwing an "unbound variable" error while trying to install and use Ruby 2.3.4 on Amazon Linux. We first noticed the problem on May 8, 2019 and I believe it might be related to the latest RVM release. Ruby installs properly but when we try to "use" it (rvm --default use 2.3.4) we get this error.

Steps to reproduce

We are using Packer to build AWS images with RVM and Ruby 2.3.4 installed. Our process runs from a Jenkins job and has been working fine every Sunday for the past couple of years. During the course of building a new Jenkins environment last week we discovered that the Packer process was failing with a _system_name: unbound variable error and we thought it was something that we had done wrong. Investigating a bit more, we discovered that our latest Sunday job had failed in the same way.

  1. Configure Packer on AWS
  2. Install the latest RVM (on Packer on AWS)
  3. Install Ruby 2.3.4 with openSSL (yes | rvm install ruby-2.3.4 -- --with-openssl-dir=/etc/pki/tls
  4. Use the newly installed Ruby 2.3.4
  5. Get an unbound variable error

Expected behavior

We expected to see Ruby install and our Packer process continue as normal.

Actual behavior

The actual behavior was an error that we are able to replicate using 2 different AWS accounts and Jenkins instances.

https://gist.github.com/rnhurt/0363630689f2d2d3a94fb8903c2c6bc8 Here's a Gist that shows the bash script that we are running inside Packer and the output from Jenkins. The Jenkins DEBUG flag is turned on and shows the complete stack dump from RVM.

rnhurt avatar May 14 '19 20:05 rnhurt

Rolling back to a previous RVM version (v1.29.7) seems to solve the problem.

rnhurt avatar Jun 06 '19 19:06 rnhurt

rollback to v1.29.7 still have problem

danie1Lin avatar Dec 24 '20 13:12 danie1Lin

I found that my script has set -u , so it will fail on executing rvm script. if you really want to use set -u, you can wrap your script like this:

YOUR OTHER SCRIPT ...

set +u
YOUR SCRIPT RUN rvm
set -u

YOUR OTHER SCRIPT ...

danie1Lin avatar Dec 26 '20 04:12 danie1Lin

I encountered this too, using 1.29.12-next. It'd be nice if RVM's scripts could be updated such that they don't depend on undefined variables!

jakerobb avatar Jan 10 '23 17:01 jakerobb

This is a pretty bad experience, +1 to fixing the undefined var

luispadron avatar Apr 22 '25 17:04 luispadron