Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Vagrant Up SSH Problems

I am trying to create a Laravel App with the help of homestead vagrant. I am using a Windows 7 development environment. I'm using the Per Project Installation and I'm at the point in the Laravel Documentation that I can vagrant up my project. When I do vagrant up in my project I get hung up on

SSH auth method: password

and I get the following message:

Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

I am using Laravel 5.3 and Vagrant 1.9.0. I was using Vagrant 1.8.4, but once I started having trouble I installed Vagrant 1.9.0, but received the exact same error. I tried te following fix from here, and from the vb.gui I could see the following error from the launched server:

[   0.100000] Failed to access perfctr msr (MSR c0010007 is 0)
  lvmetad is not active yet, using direct activation during sysinit
  lvmetad is not active yet, using direct activation during sysinit
Scanning for Btrfs filesystems
/dev/mapper/vagrant--vg-root:clean, 127066/2559088 files, 1241443/10228736 blocks
[  10.420196] piix4_smbus 0000:00:07.0: SMBus base address uninitialized - updrade BIOS or use force_addr=0xadr
[    ] A start jon is running for Raise network interfaces (4 min 44s / 5min 5 s)

and then the server start and I can log in, but my folders and IP from my Homestead.yaml file are not set on the server.

This is my Homestead.yaml file:

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
hostname: mysite
name: mysite
provider: virtualbox

authorize: C:/Users/xxx/.ssh/id_rsa.pub

keys:
    - C:/Users/xxx/.ssh/id_rsa

folders:
    - map: "C:/Users/xxx/www/mysite"
      to: "/home/vagrant/mysite"

sites:
    - map: homestead.app
      to: "/home/vagrant/mysite/public"

databases:
    - homestead

While the instance is running and I run:

vagrant ssh-config

I get

Host mysite
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes

when I run:

vagrant global-status

I get:

id       name   provider   state   directory
-----------------------------------------------------------------------
66eb5bf  mysite virtualbox running C:/Users/xxx/www/mysite

When I try and get the degub info from vagrant by using this:

vagrant up --debug > vdebug.txt

generates a lot of messages in the command prompt but only this in the vdebug.txt file:

Bringing machine 'mysite' up with 'virtualbox' provider...
==> mysite: Importing base box 'laravel/homestead'...

[KProgress: 20%
[KProgress: 30%
[KProgress: 60%
[KProgress: 70%
[KProgress: 90%
[K==> mysite: Matching MAC address for NAT networking...
==> mysite: Checking if box 'laravel/homestead' is up to date...
==> mysite: Setting the name of the VM: mysite
==> mysite: Clearing any previously set network interfaces...
==> mysite: Preparing network interfaces based on configuration...
    mysite: Adapter 1: nat
    mysite: Adapter 2: hostonly
==> mysite: Forwarding ports...
    mysite: 80 (guest) => 8000 (host) (adapter 1)
    mysite: 443 (guest) => 44300 (host) (adapter 1)
    mysite: 3306 (guest) => 33060 (host) (adapter 1)
    mysite: 5432 (guest) => 54320 (host) (adapter 1)
    mysite: 22 (guest) => 2222 (host) (adapter 1)
==> mysite: Running 'pre-boot' VM customizations...
==> mysite: Booting VM...
==> mysite: Waiting for machine to boot. This may take a few minutes...
    mysite: SSH address: 127.0.0.1:2222
    mysite: SSH username: vagrant
    mysite: SSH auth method: password

If you made it to the end of this post thank you! My questions is how do I get my IP and Folders from my Homestead.yaml file to the server. Any help would be greatly appreciated. Also Let me know if I can add any more info. I will keep you updated on my status.

EDIT 1

I forgot to add that I enabled virtualization already.

EDIT 2

I changed the Homestead.yaml file in my projects folder to have the IP set to 192.168.10.20 instead of 192.168.10.10 and still no changes. I will keep updating till I have an answer.

EDIT 3

Tried to change the Vagrantfile located in my project folder to add the following in the Vagrant.configure function:

config.vm.network "public_network", ip: "192.168.10.20", :bridge => "en1: Realtek PCIe GBE Family Controller #2"

I received the same error, but I also received this:

Specific bridge 'en1: Realtek PCIe GBE Family Controller #2' not found. You may be asked to specify
which network to bridge to.
like image 763
user908759 Avatar asked Dec 04 '16 16:12

user908759


2 Answers

This error occurs because the Ubuntu tries to raise all your network interfaces, but your cable isn't connected, then it waits until this timeout.

It seems that this problem occurs when you export a VM, more info on https://www.virtualbox.org/ticket/15705

You can edit your Vagrantfile and add these lines in the end of Vagrant.configure loop:

 config.vm.provider "virtualbox" do |vb|
        vb.customize ["modifyvm", :id, "--cableconnected1", "on"]
    end

Basically add this right before the very last "end".

like image 108
kratos Avatar answered Oct 18 '22 10:10

kratos


I did have the same error in the past it was because the virtualization in my machine wasn't enabled.

Try to enable it in your machine. To do it you need to get into the BIOS.

There are useful information at Vagrant stuck connection timeout retrying as well.

like image 1
Marabesi Avatar answered Oct 18 '22 10:10

Marabesi