Vagrant: Exec error: fork/exec /opt/vagrant/embedded/bin/ruby: no such file or directory

Created on 15 Nov 2017  ยท  8Comments  ยท  Source: hashicorp/vagrant

Vagrant version

Vagrant 2.0.1
but pacman -Qe vagrant shows vagrant 2.0.1-1

Host operating system

Manjaro 4.9.61-3-MANJARO

Debug output

I did a VAGRANT_DEBUG_LAUNCHER=1 vagrant status and what I saw was 2017/11/15 12:10:27 launcher: rubyPath = /opt/vagrant/embedded/bin/ruby.

The path /opt/vagrant/embedded exists, the one /opt/vagrant/embedded/+ does not, so does the ruby binary.

Expected behavior

To work?

Actual behavior

After last vagrant update with pacman -Syyu which upgraded vagrant to 2.0.1, something seems to be missing..

For every vagrant command I execute:

Exec error: fork/exec /opt/vagrant/embedded/bin/ruby: no such file or directory

Temporary Workaround

What I did to overcome this was:

$: which ruby
/home/<username>/.rvm/rubies/ruby-2.4.2/bin/ruby

$: sudo mkdir -p /opt/vagrant/embedded/bin
$: sudo ln -s /home/<username>/.rvm/rubies/ruby-2.4.2/bin/ruby /opt/vagrant/embedded/bin/ruby

so it seems that I borrowed vagrant my rvm ruby binary. Everything seems to work fine until now.

installer

Most helpful comment

This is down to Manjaro using Arch's Vagrant package. The packaged vagrant checks for the presence of /etc/arch-release and doesn't find it as it doesn't (currently) exist in Manjaro. Because it's not there, vagrant assumes it's _not_ running on an Arch-like and instead tries to use the embedded ruby, which of course doesn't exist as it's not in the Vagrant package.

The "easy" workaround is to sudo touch /etc/arch-release (it's blank in Arch anyway), but we're discussing adding a compatibility symlink in case other software checks for Arch-like distros in the same way: https://forum.manjaro.org/t/vagrant-doesnt-run-on-manjaro-because-of-missing-etc-arch-release-file/35053

All 8 comments

doesnt work for me either. I linked my other ruby to vagrant as well and it works.

Thanks @chrisvel

Thank you @chrisvel, your workaround worked for me too.

I ran into a CAfile error after applying the workaround for Ruby.

URL: ["https://vagrantcloud.com/laravel/homestead"]
Error: error setting certificate verify locations:
  CAfile: /opt/vagrant/embedded/cacert.pem
  CApath: none

I could get around this using the same linking method above.

sudo ln -s /etc/ssl/cert.pem /opt/vagrant/embedded/cacert.pem

Full output below.

Linux horace 4.12.0-1-amd-staging x86_64
 11:06:33 up 4 min,  1 user,  load average: 1.18, 1.90, 1.02

 comara@horace  ~  
> vagrant box add laravel/homestead
Exec error: fork/exec /opt/vagrant/embedded/bin/ruby: no such file or directory
 1  comara@horace  ~  
> which ruby
/usr/bin/ruby
 comara@horace  ~  
> ls /opt/vagrant/embedded/
etc/  gems/  rgloader/
 comara@horace  ~  
> sudo mkdir -p /opt/vagrant/embedded/bin
[sudo] password for comara: 
 comara@horace  ~  
> sudo ln -s /usr/bin/ruby /opt/vagrant/embedded/bin/ruby                                                                                                                                                    3559ms
 comara@horace  ~  
> vagrant box add laravel/homestead
The box 'laravel/homestead' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Vagrant Cloud, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:

URL: ["https://vagrantcloud.com/laravel/homestead"]
Error: error setting certificate verify locations:
  CAfile: /opt/vagrant/embedded/cacert.pem
  CApath: none
 1  comara@horace  /etc/ssl  
> sudo ln -s /etc/ssl/cert.pem /opt/vagrant/embedded/cacert.pem                                                                                                                                               716ms
[sudo] password for comara: 
 comara@horace  /etc/ssl  
> vagrant box add laravel/homestead                                                                                                                                                                          3817ms
==> box: Loading metadata for box 'laravel/homestead'
    box: URL: https://vagrantcloud.com/laravel/homestead
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.

1) parallels
2) virtualbox
3) vmware_desktop

Enter your choice: 2
==> box: Adding box 'laravel/homestead' (v4.0.0) for provider: virtualbox
    box: Downloading: https://vagrantcloud.com/laravel/boxes/homestead/versions/4.0.0/providers/virtualbox.box
==> box: Successfully added box 'laravel/homestead' (v4.0.0) for 'virtualbox'!

This is down to Manjaro using Arch's Vagrant package. The packaged vagrant checks for the presence of /etc/arch-release and doesn't find it as it doesn't (currently) exist in Manjaro. Because it's not there, vagrant assumes it's _not_ running on an Arch-like and instead tries to use the embedded ruby, which of course doesn't exist as it's not in the Vagrant package.

The "easy" workaround is to sudo touch /etc/arch-release (it's blank in Arch anyway), but we're discussing adding a compatibility symlink in case other software checks for Arch-like distros in the same way: https://forum.manjaro.org/t/vagrant-doesnt-run-on-manjaro-because-of-missing-etc-arch-release-file/35053

@jonathonf OMHO I think this way you're patching the OS to fix Vagrant issue detecting on which distro is running the host..

Anyways it's good to know there is an easy workaround till the issue is fixed..

That's correct - it's similar to how Ubuntu and Mint can be detected as a "Debian-like" distro; Manjaro should probably be detected as an "Arch-like" distro.

It looks like we're introducing a compatibility symlink /etc/arch-release -> /etc/manjaro-release. Nothing should be looking at the content of /etc/arch-release so it will only affect software that is checking for file presence.

Couldn't be possible to have a kind of all-in-one package as it happens for packer or terraform?

This seems to be a manjaro issue which we do not create installer packages for, so I'm going to close this up.

Cheers!

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings