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.
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.
yes | rvm install ruby-2.3.4 -- --with-openssl-dir=/etc/pki/tls
We expected to see Ruby install and our Packer process continue as normal.
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.
Rolling back to a previous RVM version (v1.29.7) seems to solve the problem.
rollback to v1.29.7 still have problem
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 ...
Most helpful comment
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: