Search code examples
laravelnetwork-programmingvirtual-machinevirtualboxhomestead

Homestead ERR_SOCKET_NOT_CONNECTED After Mac OS Update


I recently updated to Big Sur on my Mac and haven't been able to access any of my VMs as web pages since. I've destroyed and rebuilt this VM using Homestead's expected installation process.

  • VirtualBox 6.1.28
  • Latest Homestead version from release branch
  • Vagrant 2.2.18

This is the error I'm seeing

After long hours spent researching this loads of people seem to resolve it by adding the site to their hosts file. To confirm I have added this to hosts:

Error when viewing the URL without site in hosts

Update: I'm able to view the VM if I go to http://localhost:8000/. Going to http://192.168.10.10 doesn't work. From the vagrant box using curl 192.168.10.10 produces the expected HTML output of that page. So does curl localhost:8000 from my machine. If I try curl 192.168.10.10 from my machine I get curl: (55) getpeername() failed with errno 22: Invalid argument.

I've tried every other network configuration within Virtualbox and using NAT is the only one that allows the SSH connection. It seems requests aren't making it to the VirtualBox.. probably because there's an error stating the socket isn't connected.

Socket stats seems to show it's listening on port 80

As of now I have destroyed and rebuilt the box again, so it is as close to an expected installation that anyone should have.

p.s. "site.test" is a placeholder for the actual name.

Here is my Homestead.yaml: https://pastebin.com/qhPdWCNv

---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Sites
      to: /home/vagrant/code/

sites:
    - map: site.test
      to: /home/vagrant/code/site/public
      php: "7.4"

databases:
    - homestead

features:
    - mysql: true
    - mariadb: false
    - postgresql: false
    - ohmyzsh: false
    - webdriver: false

services:
    - enabled:
          - "mysql"
#    - disabled:
#        - "postgresql@11-main"

#ports:
#    - send: 33060 # MySQL/MariaDB
#      to: 3306
#    - send: 4040
#      to: 4040
#    - send: 54320 # PostgreSQL
#      to: 5432
#    - send: 8025 # Mailhog
#      to: 8025
#    - send: 9600
#      to: 9600
#    - send: 27017
#      to: 27017

Here is my hosts file: https://pastebin.com/Y6Re15iy

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
192.168.10.10   site.test
::1             localhost

Solution

  • For anyone that encounters this issue I fixed this by updating the VM to a new IP, changing the domain, and clearing the dns cache (dscacheutil –flushcache).