Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fork/exec error #8055

Closed
HarrisonOg opened this issue Nov 29, 2016 · 28 comments
Closed

fork/exec error #8055

HarrisonOg opened this issue Nov 29, 2016 · 28 comments

Comments

@HarrisonOg
Copy link

HarrisonOg commented Nov 29, 2016

Please note that the Vagrant issue tracker is reserved for bug reports and
enhancements. For general usage questions, please use the Vagrant mailing list:
https://groups.google.com/forum/#!forum/vagrant-up. Thank you!

Vagrant version

Run vagrant -v to show the version. If you are not running the latest version
of Vagrant, please upgrade before submitting an issue.
1.9.0

Host operating system

This is the operating system that you run locally.
MacOS 10.12.1

Guest operating system

This is the operating system you run in the virtual machine.
ubuntu 16.04 bentobox

Could not even get to the plugin list

Expected behavior

What should have happened?

Actual behavior

What actually happened?

Exec error: fork/exec /opt/vagrant/embedded/bin/ruby: argument list too long Exec error: fork/exec /opt/vagrant/embedded/bin/ruby: argument list too long Exec error: fork/exec /opt/vagrant/embedded/bin/ruby: argument list too long

Steps to reproduce

References

Are there any other GitHub issues (open or closed) that should be linked here?
For example:

@chrisroberts
Copy link
Member

Hi there,

Thank you for opening an issue. However, there is not enough information here to reproduce or provide a recommendation. When you first open an issue, a template is pre-filled in the box. That template provides instructions for getting your host and guest information, the version of Vagrant, and the debug output. Without that information, it is very challenging for us to assist you.

Please supply that information either by updating this ticket or by closing this ticket and opening a new one. Thank you! 😄

@chrisroberts chrisroberts changed the title could not even fork/exec error Nov 29, 2016
@jenhsun
Copy link

jenhsun commented Nov 29, 2016

@HarrisonOg 1.9.0 runs smoothly on my Mac. My guess is you might have ruby setting problem on your machine.

@bassrock
Copy link

bassrock commented Dec 1, 2016

I had the same issue. I had the following in my Vagrantfile at the top to auto install plugins if they weren't on the machines:

required_plugins = %w(vagrant-omnibus vagrant-aws vagrant-berkshelf vagrant-vbguest vagrant-triggers vagrant-remove-old-box-versions vagrant-hostmanager)
required_plugins.each do |plugin|
  exec "vagrant plugin install #{plugin};vagrant #{ARGV.join(" ")}" unless Vagrant.has_plugin? plugin || ARGV[0] == 'plugin'
end

After commenting it out I then encountered an error relating to the next item in my file:

class MyInstaller < VagrantVbguest::Installers::Linux
  def install(opts=nil, &block)
    communicate.sudo('rm -rf /etc/resolv.conf', opts, &block)
    communicate.sudo('echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf', opts, &block)
    communicate.sudo('apt-get update', opts, &block)
    communicate.sudo('apt-get install dkms build-essential linux-headers-generic linux-headers-$(uname -r) -y', opts, &block)
    # calling `super` will run the installation
    # also it takes care of uploading the right iso file into the box
    # and cleaning up afterward
    super
  end
end

With that block I had to add:

require 'vagrant-vbguest' unless defined? VagrantVbguest::Config

So it looks like there may be 2 things that are happening:

  1. Vagrant 1.9.0 changed how its autoloading works and does not load the plugins before the vagrant file now causing the require line to be needed.

  2. I think there is an issue with Vagrant.has_plugin? returns false for installed plugins #8063 because when I removed the lines to check if it has plugins it works.

@bassrock
Copy link

bassrock commented Dec 1, 2016

And actually looking at it I think that it all has to do with #8063 where the pull request #8066 stops it from loading the local vagrant file as I was just doing basic commands like vagrant status in my directory.

@chrisroberts
Copy link
Member

@bassrock Hi! When you say:

I had the same issue.

Are you referring to the original fork/exec error described in this issue (argument list too long) ?

@BillyGriffiths
Copy link

BillyGriffiths commented Dec 1, 2016

I also get the error, both on running 'vagrant status' and 'vagrant up'.

Brand new MBP (literally just out of the box) running new installation of Sierra. I initially installed Vagrant 1.9.0 from the '.dmg' which resulted in the error messages. I then uninstalled and reinstalled using 'brew cask install vagrant'. Same result.

Will check my vagrantfile etc, but thought I'd just mention it also.

image

@chrisroberts
Copy link
Member

@BillyGriffiths are you in a directory with a Vagrantfile when running these commands? If so, can you paste in that file? Thanks!

@chrisroberts
Copy link
Member

@BillyGriffiths Also, if you could post the output with the launcher debug on that would be great:

$ VAGRANT_DEBUG_LAUNCHER=1 vagrant status

Thanks!

@BillyGriffiths
Copy link

are you in a directory with a Vagrantfile when running these commands? If so, can you paste in that file? Thanks!

I am indeed.

Vagrantfile.txt

@BillyGriffiths
Copy link

Also, if you could post the output with the launcher debug on that would be great:

Output seems to loop. I did a force quit and copied the output available in my terminal. Does it help?

vagrant_debug_1.txt

@jenhsun
Copy link

jenhsun commented Dec 1, 2016

I remember when I first done the 1.9.0 installation and do vagrant up, it automatically shows vagrant repair to repair my plugins. It "might" be the answer to this question. So, do a vagrant repair manually and see what will happen, or vagrant plugin expunge and reinstall all plugins manually.
I can't reproduce fork/exec issue, sorry.

@BillyGriffiths
Copy link

I remember when I first done the 1.9.0 installation and do vagrant up, it automatically shows vagrant repair to repair my plugins. It "might" be the answer to this question. So, do a vagrant repair manually and see what will happen, or vagrant plugin expunge and reinstall all plugins manually.
I can't reproduce fork/exec issue, sorry.

Both 'vagrant repair' and 'vagrant plugin expunge' results in the same output for me.

@BillyGriffiths
Copy link

BillyGriffiths commented Dec 1, 2016

When I comment out the plugin installation lines, everything seems to run fine.

image

@chrisroberts
Copy link
Member

@BillyGriffiths Right, that's just what I was typing out. Your Vagrantfile attempting to do plugin installation is what is causing the problem. If you go to a directory without a Vagrantfile (like your home directory) and install the plugins required, you should be all set.

@BillyGriffiths
Copy link

Thanks @chrisroberts! 👍 Immediate problem solved.

How would I, in future, get those to install as part of my vagrantfile?

@tmountjr
Copy link

tmountjr commented Dec 1, 2016

Just did @chrisroberts suggestion, worked for me. I was doing the same thing:

required_plugins = %w(vagrant-digitalocean)
plugins_to_install = required_plugins.select { |plugin| !Vagrant.has_plugin? plugin }
unless plugins_to_install.empty?
    puts "Installing plugins: #{plugins_to_install.join(' ')}"
    if system "vagrant plugin install #{plugins_to_install.join(' ')}"
        exec "vagrant #{ARGV.join(' ')}"
    else
        abort 'Installation of one or more plugins has failed. Aborting.'
    end
end

@chrisroberts
Copy link
Member

I'm going to be working on a supported way to request plugin installation from the Vagrantfile.

@BillyGriffiths
Copy link

I'm going to be working on a supported way to request plugin installation from the Vagrantfile.

That would be great.

@benesch
Copy link
Contributor

benesch commented Dec 1, 2016

@BillyGriffiths here's a workaround for the time being from WhoopInc/vagrant-s3auth#32:

unless Vagrant.has_plugin?('vagrant-s3auth') || ARGV.include?("plugin")
  system('vagrant plugin install vagrant-s3auth') || exit!

  # Relaunch Vagrant so the plugin is detected. Exit with the same status code.
  exit system('vagrant', *ARGV)
end

Basically just wrap the entire plugin installation block in an unless ARGV.include?("plugin") block.

@bassrock
Copy link

bassrock commented Dec 1, 2016

@chrisroberts Yes I am referring to the argument to long error.

@cYbercOsmOnauT
Copy link

Thanks for your workaround benesch! Works like a charm!

@Deepakkothandan
Copy link

Had the same issue and running vagrant plugin repair fixed it

vdloo added a commit to ByteInternet/hypernode-vagrant that referenced this issue Dec 6, 2016
Auto-installing using system after detecting has_plugin causes an
infinite loop with Vagrant 1.9.0 because the Vagrantfile is now loaded
during plugin install (which will cause it to install the plugin while
the plugin is being installed).

See: hashicorp/vagrant#8055
And: https://github.com/ByteInternet/hypernode-vagrant/issues/118

Fixes:
```
hypernode-vagrant$ vagrant plugin uninstall vagrant-hypconfigmgmt
Exec error: fork/exec /opt/vagrant/embedded/bin/ruby: argument list too long
Installed the vagrant-hypconfigmgmt plugin.
For the next configuration step, please again run: "vagrant up"
Installed the vagrant-hypconfigmgmt plugin.
For the next configuration step, please again run: "vagrant up"
```

Todo: in the future replace this with Vagrant's officially-supported automated
plugin installation when they release that

> Sounds like we're getting an officially-supported method of requesting
> plugin installation from the Vagrantfile soon, though!
- WhoopInc/vagrant-s3auth#32
@chrisroberts
Copy link
Member

Hi there,

It looks like this has been resolved within a previously shipped version of Vagrant so I am now closing this issue. If the original issue was not fully resolved, please reopen this issue or create a new one.

Cheers!

benesch added a commit to WhoopInc/vagrant-s3auth that referenced this issue Dec 31, 2016
This reverts commit 79f371e.
hashicorp/vagrant#8055 was resolved in Vagrant 1.9.1.
@nuxy
Copy link

nuxy commented Jul 6, 2018

Hello all:

I know I'm beating a dead horse over this topic. In the latest version of OSX (10.13.5) none of the solutions above worked. I ended up resolving this using the following code.

The solution:

required_plugins = %w[vagrant-plugin-1 vagrant-plugin-2 vagrant-plugin-3]

return if !Vagrant.plugins_enabled?

plugins_to_install = required_plugins.select { |plugin| !Vagrant.has_plugin? plugin }

if plugins_to_install.any?
  system "vagrant plugin install #{plugins_to_install.join(' ')}"
  exit system 'vagrant up'
end

What does this solve?

  • Allows execution of vagrant plugin install and vagrant plugin uninstall in the same directory as the Vagrantfile itself.
  • Forces vagrant up in cases where you require a dependency that has been recently installed in either the Vagrantfile or related library include.
  • Supports multiple gems or Vagrant plugins.

Hope this helps.

@silvae86
Copy link

silvae86 commented Jul 10, 2018

@nuxy thanks, this fixed an issue i was having while running vagrant in the latest Mojave public beta!

T2L added a commit to lemberg/draft-environment that referenced this issue Jul 19, 2018
Auto-installation of Vagrant plugins started to produce the following error:

  Exec error: fork/exec /opt/vagrant/embedded/bin/ruby: argument list too long

Code borrowed here: hashicorp/vagrant#8055 (comment)
T2L added a commit to lemberg/draft-environment that referenced this issue Jul 19, 2018
Auto-installation of Vagrant plugins started to produce the following error:

  Exec error: fork/exec /opt/vagrant/embedded/bin/ruby: argument list too long

Code borrowed here: hashicorp/vagrant#8055 (comment)
@apple4ever
Copy link

apple4ever commented Aug 3, 2018

@nuxy

I get the following error with Vagrant 2.1.2 when I try that:

Vagrantfile:20:in block in <top (required)>': unexpected return (LocalJumpError) from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/config/v2/loader.rb:37:in 'load'

@techies23
Copy link

@nuxy Perfect. This fixed the issue for me as well. Thanks !

@ghost
Copy link

ghost commented Apr 1, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests