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

Created on 14 May 2019  ·  3Comments  ·  Source: rvm/rvm

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.

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:

YOUR OTHER SCRIPT ...

set +u
YOUR SCRIPT RUN rvm
set -u

YOUR OTHER SCRIPT ...

All 3 comments

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 ...
Was this page helpful?
0 / 5 - 0 ratings

Related issues

JoeNyland picture JoeNyland  ·  3Comments

markbao picture markbao  ·  4Comments

ain picture ain  ·  3Comments

COAB1 picture COAB1  ·  3Comments

alexsoares picture alexsoares  ·  3Comments