Open saturnflyer opened 9 years ago
That's a bug I've hit too :-(
It seems the Vagrant cookbook sometimes installs plugins wrong somehow, so that it's convinced they're installed and Vagrant isn't (you can try "vagrant plugin list" and you won't see them.)
The easiest way to handle this is probably to uninstall Vagrant (including that pkgutil command) and reinstall. The second-easiest is to install the plugin that's missing -- probably "vagrant plugin install vagrant-host-shell --plugin-version 0.0.4".
The list of plugins that need to be installed, taken from the cookbook:
node.default['vagrant']['plugins'] = [ { 'name' => 'vagrant-omnibus', 'version' => '1.4.1' }, { 'name' => 'vagrant-librarian-chef', 'version' => '0.2.1' }, { 'name' => 'vagrant-aws', 'version' => '0.6.0' }, { 'name' => 'vagrant-digitalocean', 'version' => '0.7.3' }, { 'name' => 'vagrant-linode', 'version' => '0.1.1' }, { 'name' => 'vagrant-host-shell', 'version' => '0.0.4' }, ]
(I've figured out how to detect the bug, but it's going to take me longer to fix it. And my company just went out of business, so I've been derelict on pushing my changes. It'll happen pretty soon.)
No problem! I'll continue reporting what I find. Thanks so much Noah!
I have a feeling this is a problem with my system.
After installing the missing vagrant plugins, I did cd madscience
. It wasn't clear to me that I'd need to do that; still not sure if that's correct.
Then:
$ vagrant up
Bringing machine 'app-server' up with 'virtualbox' provider...
==> app-server: Importing base box 'ubuntu/trusty64'...
==> app-server: Matching MAC address for NAT networking...
==> app-server: Checking if box 'ubuntu/trusty64' is up to date...
==> app-server: Setting the name of the VM: madscience_app-server_1428589831406_26866
==> app-server: Clearing any previously set forwarded ports...
==> app-server: Installing Chef cookbooks with Librarian-Chef...
==> app-server: Clearing any previously set network interfaces...
==> app-server: Preparing network interfaces based on configuration...
app-server: Adapter 1: nat
==> app-server: Forwarding ports...
app-server: 80 => 4321 (adapter 1)
app-server: 8800 => 4322 (adapter 1)
app-server: 8900 => 4323 (adapter 1)
app-server: 9000 => 4324 (adapter 1)
app-server: 9100 => 4325 (adapter 1)
app-server: 22 => 2222 (adapter 1)
==> app-server: Running 'pre-boot' VM customizations...
==> app-server: Booting VM...
==> app-server: Waiting for machine to boot. This may take a few minutes...
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' state. Please verify everything is configured
properly and try again.
If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.
So I opened my VirtualBox GUI to see what's going on. Found my VM there and hit the start button and it raised this error:
Failed to open a session for the virtual machine madscience_app-server_1428589831406_26866.
The virtual machine 'madscience_app-server_1428589831406_26866' has terminated unexpectedly during startup with exit code 1.
Result Code:
NS_ERROR_FAILURE (0x80004005)
Component:
Machine
Interface:
IMachine {480cf695-2d8d-4256-9c7c-cce4184fa048}
It might be worth configuring with GUI enabled:
config.vm.provider "virtualbox" do |v|
v.gui = true
end
Yes, "cd madscience" is correct. I should probably make that clearer.
Have you tried "vagrant plugin list" to make sure everything shows up? Though it sounds like you're not having that same problem again.
Yeah, haven't seen that new error before :-/ Not sure what's up with that.
Hey, Jim. After some investigation, looks like Vagrant plugins aren't installed under Vagrant. Oy. So "reinstall Vagrant" isn't useful advice here. Instead, do me a favor and do this:
rm ~/.vagrant.d/plugins.json rm -rf ~/.vagrant.d/gems
This will remove all install Vagrant plugins -- running "madscience setup" or "madscience construct" should reinstall them.
I'm still figuring out why this happens, but madscience version 0.0.28+ should at least come to a screeching halt if it does happen, including listing a plugin that isn't installed and how to install it.
Oh God. Since Vagrant installs plugins in the user's home directory, I'm getting a completely unrelated set with sudo/rvmsudo than I get when I'm not doing that.
So I need to install the plugins in both root and non-root directories, or install again after dropping root privileges, or...
Don't know. I definitely need to think through this now. The easiest answer would be to install this in the user's home dir (not root's, generally) and then forbid running "vagrant up" (etc) via sudo. I have a suspicion that that won't end well.
Will figure it out.
Also: how did this ever work?
Is there any way to specify your own plugin path for part of it? I know in puppet you can do --modulepath and point to a specific directory... Not sure if there is some way you can create some common directory to tell it to use?
Huh. And the periodic failures are more mysterious when I take into account that my detection code is in Chef, and it successfully detects the problem. That means we're definitely seeing the occasional failures even within the sudo environment, completely ignoring the post-sudo environment. This looks like some kind of error where plugins.json doesn't agree with the installed gem, or something along those lines.
@Cinderhaze, there's a way to install into other user's Vagrant dir in the latest version of the Vagrant cookbook. I need to port my changes on top of it (current plugin version detection is broken) and then use it.
So yeah, there's absolutely a way to do that. It's just running the plugin command as that user.
Okay. It works (ish) because it's more complicated than that, and when running with sudo you're often still using your own home directory, not root's. Sometimes. Ish.
But installing the plugins with Vagrant can absolutely be made to do it in a user dir, which I'm doing locally.
And I believe that will fix the root/not-root problem, though not necessarily all the others.
Pushed as madscience-0.0.29.gem.
I kept getting the error The guest machine entered an invalid state while waiting for it...
and updated to the latest VirtualBox (4.3.26) and things seem to be installing correctly for me (with madscience 0.0.29).
I'll probably try to blow it all away and see if the plugins install properly without manual intervention but I'm focused on getting it working for me at the moment.
Weird. Well, I can certainly upgrade madscience_gem to the latest VirtualBox without a problem.
Have you tried turning the gui option on to see it's obvious what the problem is? This is one I haven't seen myself :-(
Still working on getting this working and got to this point: