laravel / homestead

MIT License
3.85k stars 1.45k forks source link

Vagrant up hangs #1940

Closed rbruhn closed 5 months ago

rbruhn commented 5 months ago

Trying to provision a box on Windows and vagrant up simply hangs. I have two earlier versions of Homestead for other projects and they are working fine. When it didn't work at first, I made the bare bones YAML file below for testing. Still didn't work.

Any ideas?

Host operating system

Windows 11

Homestead.yaml

---
ip: "192.168.56.60"
memory: 6144
cpus: 4
provider: virtualbox
name: homestead-15x

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    -   map: C:\Users\bruhn\code
        to: /home/vagrant/code
        type: "nfs"
        mount_opts: [ "nolock", "vers=3", "tcp", "noatime", "rsize=65536", "wsize=65536" ]

sites:
    - map: homestead.test
      to: /home/vagrant/code/public

databases:
    - homestead

features:
    - mariadb: false
    - postgresql: false
    - ohmyzsh: false
    - webdriver: false
    - influxdb: false

services:
    - enabled:
          - "mysql"

Vagrant destroy & up output

GitHub Gist

Expected behavior

Importing the box and provisioning.

Actual behavior

It stops at the message in the gist. Let it sit for an hour and nothing is happening.

svpernova09 commented 5 months ago

From the Gist it seems like the VB tools install didn't finish. Nothing Homestead can do there. I'm suspicious about your NFS usage because we already had 1 NFS bug, this might be another

rbruhn commented 5 months ago

@svpernova09 You were right. I tried with the fix you referenced and the same hang occurred. I then uninstalled the vbguest plugin and the machine provisioned correctly. I will close the issue since it's not related to Homestead.

svpernova09 commented 5 months ago

Glad you got it sorted out!

rbruhn commented 5 months ago

@svpernova09 I'm not reopening this but noting another issue I'm having. I was wrong previously that the machine provisioned correctly. I started over with a fresh install and it failed. This time, it hung up on the part below while creating a site. To remove any possible errors I introduced, I removed all sites and folders except one.

==> homestead-15x: Running provisioner: Creating Site: biospex.test (shell)...
    homestead-15x: Running: script: Creating Site: biospex.test
==> homestead-15x: Running provisioner: shell...
    homestead-15x: Running: inline script

Hanging... Full gist here: https://gist.github.com/rbruhn/cffb655d2bef96cda2031f270d93e0ba

I stopped the machine, mounted the Guest Additions in storage on the Virtualbox menu, restarted the machine using Virtual box program, and upgraded the VB Guest Additions via the box menu.

After doing this, I then stopped the machine again, ran 'vagrant up --provision' It completed successfully. Then I added another site in the yaml and ran 'vagrant up --provision' again. It worked.

Then, I added a subdomain to the first site. When trying to provision again, it hung up in the same spot. Not on the new subdomain, but the fist domain in the list.

At this point, I have no idea what's causing the issue. Will keep digging around when I have time.

svpernova09 commented 5 months ago

@svpernova09 I'm not reopening this but noting another issue I'm having. I was wrong previously that the machine provisioned correctly. I started over with a fresh install and it failed. This time, it hung up on the part below while creating a site. To remove any possible errors I introduced, I removed all sites and folders except one.

==> homestead-15x: Running provisioner: Creating Site: biospex.test (shell)...
    homestead-15x: Running: script: Creating Site: biospex.test
==> homestead-15x: Running provisioner: shell...
    homestead-15x: Running: inline script

Hanging... Full gist here: https://gist.github.com/rbruhn/cffb655d2bef96cda2031f270d93e0ba

I stopped the machine, mounted the Guest Additions in storage on the Virtualbox menu, restarted the machine using Virtual box program, and upgraded the VB Guest Additions via the box menu.

After doing this, I then stopped the machine again, ran 'vagrant up --provision' It completed successfully. Then I added another site in the yaml and ran 'vagrant up --provision' again. It worked.

Confirming this sounds like the right way to do this 👍.

Then, I added a subdomain to the first site. When trying to provision again, it hung up in the same spot. Not on the new subdomain, but the fist domain in the list.

At this point, I have no idea what's causing the issue. Will keep digging around when I have time.

There might be some strangeness in subdomain creation. I believe the safe thing to do is put the primary or TLD higher in the site list order than any subdomains.

rbruhn commented 5 months ago

There might be some strangeness in subdomain creation. I believe the safe thing to do is put the primary or TLD higher in the site list order than any subdomains.

I did. It was second in line.

    -   map: biospex.test
        to: /home/vagrant/code/biospex/public
        type: laravel
        php: "8.3"
    -   map: api.biospex.test
        to: /home/vagrant/code/biospex/public
        type: laravel
        php: "8.3"
    -   map: dev.biospex.test
        to: /home/vagrant/code/dev.biospex/public
        type: laravel
        php: "8.3"
    -   map: digitizationacademy.test
        to: /home/vagrant/code/digitization_academy/public
        type: laravel
        php: "8.3"

Adding regular domains works. Then I slipped in that subdomain and it hung on creating biospex.test like before. I will keep playing with it.

Edit: dev.biospex.test goes to it's own folder. i keep a separate code base for it.

svpernova09 commented 5 months ago

Cleaning up your example + changing the paths:

folders:
    - map: /Users/halo/Code/fresh
      to: /home/vagrant/fresh

sites:
    - map: fresh.test
      to: /home/vagrant/code/fresh/public
    - map: api.fresh.test
      to: /home/vagrant/code/fresh/public
    - map: dev.fresh.test
      to: /home/vagrant/code/dev.fresh/public
    - map: digitizationacademy.test
      to: /home/vagrant/code/fresh/public

Output:

==> homestead: Running provisioner: Creating Site: fresh.test (shell)...
    homestead: Running: script: Creating Site: fresh.test
==> homestead: Running provisioner: shell...
    homestead: Running: inline script
==> homestead: Running provisioner: shell...
    homestead: Running: /var/folders/73/hkr4pszx5jj1_j6hffydbgsm0000gn/T/vagrant-shell20240124-80207-km810t.sh
==> homestead: Running provisioner: Checking for old Schedule (shell)...
    homestead: Running: script: Checking for old Schedule
==> homestead: Running provisioner: Creating Certificate: fresh.test (shell)...
    homestead: Running: script: Creating Certificate: fresh.test
==> homestead: Running provisioner: Creating Site: fresh.test (shell)...
    homestead: Running: script: Creating Site: fresh.test
==> homestead: Running provisioner: shell...
    homestead: Running: inline script
==> homestead: Running provisioner: shell...
    homestead: Running: /var/folders/73/hkr4pszx5jj1_j6hffydbgsm0000gn/T/vagrant-shell20240124-80207-d5hf7x.sh
    homestead: fresh.test already exists:
    homestead: 127.0.0.1 fresh.test
==> homestead: Running provisioner: Checking for old Schedule (shell)...
    homestead: Running: script: Checking for old Schedule
==> homestead: Running provisioner: Creating Certificate: api.fresh.test (shell)...
    homestead: Running: script: Creating Certificate: api.fresh.test
==> homestead: Running provisioner: Creating Site: api.fresh.test (shell)...
    homestead: Running: script: Creating Site: api.fresh.test
==> homestead: Running provisioner: shell...
    homestead: Running: inline script
==> homestead: Running provisioner: shell...
    homestead: Running: /var/folders/73/hkr4pszx5jj1_j6hffydbgsm0000gn/T/vagrant-shell20240124-80207-a05sb7.sh
==> homestead: Running provisioner: Checking for old Schedule (shell)...
    homestead: Running: script: Checking for old Schedule
==> homestead: Running provisioner: Creating Certificate: dev.fresh.test (shell)...
    homestead: Running: script: Creating Certificate: dev.fresh.test
==> homestead: Running provisioner: Creating Site: dev.fresh.test (shell)...
    homestead: Running: script: Creating Site: dev.fresh.test
==> homestead: Running provisioner: shell...
    homestead: Running: inline script
==> homestead: Running provisioner: shell...
    homestead: Running: /var/folders/73/hkr4pszx5jj1_j6hffydbgsm0000gn/T/vagrant-shell20240124-80207-h8ac6d.sh
==> homestead: Running provisioner: Checking for old Schedule (shell)...
    homestead: Running: script: Checking for old Schedule
==> homestead: Running provisioner: Creating Certificate: digitizationacademy.test (shell)...
    homestead: Running: script: Creating Certificate: digitizationacademy.test
==> homestead: Running provisioner: Creating Site: digitizationacademy.test (shell)...
    homestead: Running: script: Creating Site: digitizationacademy.test
==> homestead: Running provisioner: shell...
    homestead: Running: inline script
==> homestead: Running provisioner: shell...
    homestead: Running: /var/folders/73/hkr4pszx5jj1_j6hffydbgsm0000gn/T/vagrant-shell20240124-80207-tvl0y3.sh
==> homestead: Running provisioner: Checking for old Schedule (shell)...
    homestead: Running: script: Checking for old Schedule
==> homestead: Running provisioner: Clear Variables (shell)...
    homestead: Running: script: Clear Variables
==> homestead: Running provisioner: Restarting Cron (shell)...
    homestead: Running: script: Restarting Cron
==> homestead: Running provisioner: Restart Webserver (shell)...
    homestead: Running: script: Restart Webserver

This seems to be working on my end. I'm unsure what's causing the site create script to hang.

rbruhn commented 5 months ago

Are you on Windows 11? I updated Virtualbox (7.0.14) this morning too but was still having the same issue on the previous version (7.0.12). I see you don't have the NFS part either. Maybe still something wrong there?

svpernova09 commented 5 months ago

Are you on Windows 11? I updated Virtualbox (7.0.14) this morning too but was still having the same issue on the previous version (7.0.12). I see you don't have the NFS part either. Maybe still something wrong there?

Sounds more and more like a Virtualbox issue. This test was done on the macOS M1 system. I also have an x86 system to test, but I assume it's NFS-related. The site creation script is stalling when trying to access the NFS-mounted paths. I've never had a good experience with Virtualbox on Windows and I've never seen instances where NFS was more performant than standard file sharing, but again doing this primarily outside of the Windows world.

rbruhn commented 5 months ago

Sounds more and more like a Virtualbox issue. This test was done on the macOS M1 system. I also have an x86 system to test, but I assume it's NFS-related. The site creation script is stalling when trying to access the NFS-mounted paths. I've never had a good experience with Virtualbox on Windows and I've never seen instances where NFS was more performant than standard file sharing, but again doing this primarily outside of the Windows world.

The cross I bear.. lol. I might have to break down and just by an Mac for work.

svpernova09 commented 5 months ago

Sounds more and more like a Virtualbox issue. This test was done on the macOS M1 system. I also have an x86 system to test, but I assume it's NFS-related. The site creation script is stalling when trying to access the NFS-mounted paths. I've never had a good experience with Virtualbox on Windows and I've never seen instances where NFS was more performant than standard file sharing, but again doing this primarily outside of the Windows world.

The cross I bear.. lol. I might have to break down and just by an Mac for work.

I'll poke around on my Windows 11 system and see. I'm running the lastest Virtualbox there 7.0.4 r154605.

svpernova09 commented 5 months ago

Naturally, without NFS it works just fine on Windows 11.

svpernova09 commented 5 months ago

And here's the kicker: Vagrant flat out doesn't support NFS on Windows.

https://developer.hashicorp.com/vagrant/docs/synced-folders/nfs image

rbruhn commented 5 months ago

Huh. I've always been using Homestead this way with https://github.com/winnfsd/vagrant-winnfsd installed. So you tried it without NFS on windows and the folders are shared correctly?

rbruhn commented 5 months ago

Naturally, without NFS it works just fine on Windows 11.

Well.... just ran it and it worked. Created a file and it shows in my directory. I assume it will run the same?

Thanks for showing me this. I had no idea after all these years it wasn't needed.

svpernova09 commented 5 months ago

Huh. I've always been using Homestead this way with https://github.com/winnfsd/vagrant-winnfsd installed. So you tried it without NFS on windows and the folders are shared correctly?

I didn't do any indepth testing, but the vagrant up process completed which means the site folders were accessible. Comment out your NFS settings and see if you get farther. possibly remove Winfssd?

rbruhn commented 5 months ago

I didn't do any indepth testing, but the vagrant up process completed which means the site folders were accessible. Comment out your NFS settings and see if you get farther. possibly remove Winfssd?

Remembered why winnfsd is necessary: permissions on folders and files.