Vagrant: Exec error: fork/exec /usr/bin/ruby: argument list too long

Created on 1 Jul 2018  ·  10Comments  ·  Source: hashicorp/vagrant

Vagrant version

Vagrant 2.1.2

Host operating system

Manjaro Linux 17.1.11

Guest operating system

any

Vagrantfile

https://github.com/coreos/coreos-vagrant/blob/master/Vagrantfile

Debug output

Installing plugins: vagrant-ignition
...
Installing plugins: vagrant-ignition
Exec error: fork/exec /usr/bin/ruby: argument list too long
Installation of one or more plugins has failed. Aborting.
...
Installation of one or more plugins has failed. Aborting.

Expected behavior

vagrant up installs plugin and completes.

Actual behavior

Above error happens when setting up any Vagrant project that requires some plugins.

Steps to reproduce

Follow steps from here:
https://github.com/coreos/coreos-vagrant

Workaround

https://github.com/hashicorp/vagrant/issues/8055#issuecomment-264201024

core enhancement

Most helpful comment

I have the same issue, it seems when I use system("vagrant plugin install #someplugin) in my Vagrantfile, vagrant figures out it needs to install someplugin before installing someplugin, which ends up as an endless loop. Workaround it by specifying chdir in systemcall.

plugins.each do |plugin|
  unless Vagrant.has_plugin?(plugin)
    system("vagrant plugin install ${plugin}", :chdir=>"/tmp") || exit!
  end
end

All 10 comments

I have the same issue, it seems when I use system("vagrant plugin install #someplugin) in my Vagrantfile, vagrant figures out it needs to install someplugin before installing someplugin, which ends up as an endless loop. Workaround it by specifying chdir in systemcall.

plugins.each do |plugin|
  unless Vagrant.has_plugin?(plugin)
    system("vagrant plugin install ${plugin}", :chdir=>"/tmp") || exit!
  end
end

I confirm the above issue as well running Vagrant 2.1.2 on mac osx 10.13.2. the workaround from @zymzxq solved the problem for me

Thank you @zymzxq 👍

FYI, I'm using macos 10.12.6

Seeing this with 2.1.2 as well. Had the same block of code for over 2 years, just started acting up recently:

plugins.each do |plugin|
    unless Vagrant.has_plugin?(plugin)
        puts "Installing vagrant plugin dependency: #{plugin}"
        %x(vagrant plugin install #{plugin})
    end
end

Only way I've been able to work-around this successfully is by adding the following logic before the plugins loop:

if not (["plugin"].include? ARGV[0])
  plugins.each do |plugin|
    system("vagrant plugin install #{plugin}", :chdir=>"/tmp") || exit! unless Vagrant.has_plugin?(plugin)
  end
end

Vagrant version

Vagrant 2.1.2

Host operating system

macOS 10.13.6

Guest operating system

coreos-vagrant

So , the cause of this "argument list too long" is vagrant installs plugin vagrant-ignition . I find if the path of Vagrantfile contains like "()" or Non-ASCII characters will get this error .

I change the workspace to Home or other all ascii directory , this error disappear.

I can confirm that the error does not happen on 2.1.1 I downgraded vagrant and the error message: fork/exec /opt/vagrant/embedded/bin/ruby: argument list too long no longer occure.
Thanks

I can confirm that the error does not happen with the exact same Vagrantfile after downgrading to 2.1.1.

Note this trick does not seem to work after vagrant 2.1.3, I have figured out a new one :)

 unless Vagrant.has_plugin?(plugin)
    # User vagrant plugin manager to install plugin, which will automatically refresh plugin list afterwards
    puts "Installing vagrant plugin #{plugin}"
    Vagrant::Plugin::Manager.instance.install_plugin plugin
    puts "Installed vagrant plugin #{plugin}"
  end

Closing this up as these issues were fixed in 2.1.5

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