Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Mattiman's avatar

Homestead is running but cannot access through terminal

So working n my project, coding and viewing my browser, everything works fine. However, today I try to ssh into homestead:

$ homestead ssh
VM must be running to open SSH connection. Run `vagrant up`
to start the virtual machine.

But the VM must be running, since the web app is active and accessible in the browser, and the database is accessible through Sequal Pro.

What is going on?

0 likes
32 replies
sitesense's avatar

I don't know if it makes a difference but did you start the VM with homestead up or vagrant up? Try halting the VM and start it again with homestead up.

sitesense's avatar

With homestead up and homestead ssh it doesn't matter where it's called from. Using vagrant instead, then you need to be in the correct directory.

RomainLanz's avatar

I've got this issue 2 days ago, I've deleted my VM and fire homestead up again.

Mattiman's avatar

@sitesense I started homestead using homestead up

I also can not halt the VM. homestead halt is doing nothing.

sitesense's avatar

There was a dodgy release of Homestead 2 days ago that was quickly patched. Perhaps you installed it during that period?

willvincent's avatar

Did you launch it as root? sudo homestead up instead of simply homestead up? Or had you previously switched to root and then run it?

Do you see it in the list produced by this command?

VBoxManage list runningvms

If not, does it show if you run that as root?

sudo VBoxManage list runningvms

Worst case scenario, if you reboot your host machine, or fire off this command it should stop running so you might be able to relaunch it:

sudo VBoxManage controlvm homestead poweroff

Mattiman's avatar

@sitestense installed homestead a couple of months ago I think, can't remember exactly when

@willvincent I did simply homestead up. If I run VBoxManage list runningvms I see "homestead" {many chars}

What is the risk of running sudo VBoxManage controlvm homestead power off? Can I loose data?

sitesense's avatar

It shouldn't really matter if you lose data from the VM. Only the database will suffer so it's good to have migrations and seeding set up. That's providing of course that you have a local copy of your project, which is the usual case.

The only other problems will be if you have installed extra stuff on the VM or made configuration changes. You'll need to repeat those.

willvincent's avatar

Unlikely. I suppose if you were in the middle of a write, it could hose something, but presumably this isn't a production machine running on homestead. So, it's the same as forcing a powerdown on a real computer. It might squawk when it boots again and for a filesystem check, but shouldn't be a big deal.

Are you able to get in if you try to ssh to it like this:

ssh vagrant@127.0.0.1 -p 2222

I wonder if the ssh port didn't get forwarded for some reason. You could try Adding a new forwarded port...

VBoxManage modifyvm homestead --natpf "ssh,tcp,,3022,22"

Then try to ssh to localhost on port 3022: ssh vagrant@127.0.0.1 -p 3022

Mattiman's avatar

@sitesense not sure if I made any changes. I just followed the Laravel docs on setting up homestead, have been using it since then with the only commands homestead up, homestead halt and homestead ssh, nothing else.

@willvincent running ssh vagrant@127.0.0.1 -p 2222 is working! I get access to the vm now. So what does that mean? I don't know anything about port forwarding I'm afraid.

sitesense's avatar

If all you've done is follow the Laravel/Homestead docs, you'll have no problems at all by destroying the instance. It will be re-provisioned at the next startup. Good luck.

Mattiman's avatar

Do I have to create the Homestead.yaml or aliases files again if I destroy the instance? Or is it only destroying the box inside .vagrant.d/boxes/laraval-VAGRANTSLASH-homestead?

Thanks for all the help by the way, appreciated a lot!

sitesense's avatar

The Homestead.yaml file will be retained. It only affects the "box inside".

Mattiman's avatar

Ok I still have a problem. Running the command sudo VBoxManage controlvm homestead poweroff gives me an error, see below.

I also rebooted my Mac. No difference. After rebooting my Mac:

matthijss-mbp:~ matthijs$ homestead up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
A VirtualBox machine with the name 'homestead' already exists.
Please use another name or delete the machine with the existing
name, and try again.
matthijss-mbp:~ matthijs$ sudo VBoxManage controlvm homestead poweroff
Password:
VBoxManage: error: Could not find a registered machine named 'homestead'
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBox, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "FindMachine(Bstr(a->argv[0]).raw(), machine.asOutParam())" at line 95 of file VBoxManageControlVM.cpp
matthijss-mbp:~ matthijs$ homestead ssh
VM must be running to open SSH connection. Run `vagrant up`
to start the virtual machine.

And now the VM is not working at all. Can't connect through my browser or Sequel pro anymore. So how do I destroy the VM and rebuild it? There's nothing about that in the docs unfortunately.

Mattiman's avatar

So I tried destroying the homestead vm, but that doesn't solve anything:

matthijss-mbp:~ matthijs$ homestead destroy
==> default: Destroying VM and associated drives...
==> default: Running cleanup tasks for 'file' provisioner...
==> default: Running cleanup tasks for 'shell' provisioner...
==> default: Running cleanup tasks for 'shell' provisioner...
==> default: Running cleanup tasks for 'shell' provisioner...
==> default: Running cleanup tasks for 'shell' provisioner...
==> default: Running cleanup tasks for 'shell' provisioner...
==> default: Running cleanup tasks for 'shell' provisioner...
==> default: Running cleanup tasks for 'shell' provisioner...
==> default: Running cleanup tasks for 'shell' provisioner...
==> default: Running cleanup tasks for 'shell' provisioner...
==> default: Running cleanup tasks for 'shell' provisioner...
==> default: Running cleanup tasks for 'shell' provisioner...
==> default: Running cleanup tasks for 'shell' provisioner...
matthijss-mbp:~ matthijs$ homestead up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
A VirtualBox machine with the name 'homestead' already exists.
Please use another name or delete the machine with the existing
name, and try again.

How can I really destroy and create new the homestead VM?

RomainLanz's avatar

@Mattiman Just erase all file related to your VM (not your work!!), and delete it on Virtualbox directly.

Mattiman's avatar

@RomainLanz thanks for your reply. Which files exactly? There are many. There are:

.homestead/
    .vagrant/
        machines/
// etc

.ssh/
//etc

.vagrant_d/
    /boxes/
        /laravel-VAGRANTSLASH-homestead/
            /0.1.8/
            /0.2.0/
            /0.2.2/
// etc

Must admit that I'm a bit disappointed by Homestead. There's just so much to set up, manage, so many dependencies, so many things going wrong, etc :(

RomainLanz's avatar

Just go to your ~/VirtualBox VMs/ and delete all VM related to homestead, then delete them on Virtualbox.

Mattiman's avatar

@RomainLanz how do I know what is related to homestead in that folder? I have:

~/Virtualbox VMs/
    /Homestead/
    /settler-default-edebjbhcd873gdhbcuy/

and what do you mean "then delete them on Virtualbox"? Where can I find that and what should I do?

Sorry for the -probably- stupid questions, but there's just no documentation and I'm on page 6 of google results trying to find something but so far no luck.

RomainLanz's avatar

@Mattiman

You can delete both of them.

Then, you need to launch VirtualBox and to delete from the interface your VMs.

willvincent's avatar

I wonder if this is causing issues...

.vagrant_d/
    /boxes/
        /laravel-VAGRANTSLASH-homestead/
            /0.1.8/
            /0.2.0/
            /0.2.2/

All I have is 0.2.2 on my machine.

Mattiman's avatar

@willvincent yes apparently when updating the homestead it keeps the old versions around. Don't know if I can delete those.

I did manage to solve my problem: opened the application Virtualbox (had forgotten it had a GUI app) and deleted the Homestead box from there (telling it to delete the files). After that, running homestead up created the homestead box anew and everything works again.

1 like
willvincent's avatar

It must have hiccuped (for lack of a better term) when creating the box initially.

CitizenZed's avatar

I'm on yosemite 10.10.2, using latest build virtualbox 4.2.34 and vagrant 1.7.2.. and have wasted 2 days.. I have not been able to get vagrant to configure the machine after the ports are forwarded, during the 'vagrant/homestead up'. Neither methods of composer/homestead nor the homestead git repo seem to work.

Timeout messages are all I see.

The machine does start up, I can configure it via the virtualbox console, just that the vagrant script has not changed or set any settings when it tries to SSH. It doesn't seem to be an RSA key problem.. I can not even SSH to the machine using 'ssh vagrant@127.0.0.1 -p 2222' Though after some mucking about with virtualbox, I did manage to SSH into its static IP [which was still set to 192.168.33.10], but nothing else had been set up, like the nginx site and so on.

There are plenty of attempts on google search results to resolve this, but none have worked for me.. The only one I didn't try was a fresh install of OSX..!! [which I did after it was Yosemite was released]

Any help would be greatly appreciated.. Jeff makes it look so EASY !! lol

rick

bashy's avatar

@CitizenZed It is easy but sometimes setups can be different across the board. Have you made sure you can run virtualisation on your machine? Have you tried booting the VM up manually and seeing the "GUI" via Virtualbox? Have you tried Vaprobash?

CitizenZed's avatar

Thanks Bashy, I checked my CPU, sysctl -a | grep machdep.cpu.features. VMX is enabled. The VM runs, it works for all other intents, but the port forwarding just doesn't, and the Vagrant set up doesn't complete. I have given up on it for now. Likely I'll just use the 'box' and set it up the old fashioned way..

Next

Please or to participate in this conversation.