Ad

Can't Get Laravel Homestead To Work Under MacOS Catalina, Random Kernel Panics In VM

I am a seasoned full stack web dev, a happy user of Laravel's Homestead for a couple of years, but I have been running into problems with Laravel Homestead under MacOS Catalina on my new 16" MacBook Pro for weeks now, and I just can't find out what the problem is. After issuing vagrant up, the process halts 90% of the time waiting for a successful SSH connection to the VM.

When I open up the VM's display through VirtualBox, I see different errors every time, such as:

/sbin/init: /lib/x86_64-linux-gnu/libselinux.so.1: no version information available (required by /sbin/init)
/sbin/init: /lib/x86_64-linux-gnu/libmount.so.1: version 'BLKID_2.15' not found (required by /lib/x86_64-linux-gnu/libmount.so.1)
/dev/mapper/homestead--vg-root: clean, 197904/3604480 files, 1607396/14397440 blocks
Couldn't find an alternative telinit implementation to spawn.
[    3.535222] Kernel panic - not syncing: Attempted to kill i
/sbin/init: /lib/x86_64-linux-gnu/libidn.so.11: version 'XZ_5.0' not found (required by /lib/systemd/libsystemd-shared-237.so)
[    3.388154] Kernel panic - not syncing: Attmpted to kill init! exitcode=0x00000100
[    4.532862] systemd[395]: /lib/systemd/system-generators/lvm2-activation-generator failed with exit status 1

I am running Vagrant 2.2.7, VirtualBox 6.1.4 r136177 under MacOS 10.15.4. The disk image used by the VM is called ubuntu-18.04-amd64-disk001.vmdk.

My Homestead configuration came from a working set up under Mojave and has worked under Catalina, but I have no idea what changed to stop it from working. I migrated two Homestead environments: one generic one that runs all of my simple PHP websites and one project-specific one that runs a single website under Apache (this is a heavy Enterprise app that needs some specific config to work properly, so I separated it from my generic Homestead environment). This used to work fine, but now both Homestead environments give these exact same issues.

I have:

  • updated to 10.15.4 (but had the problem under older versions as well)
  • run Apple's hardware test by booting with D pressed, no issues found
  • reinstalled VirtualBox
  • removed all my virtual machines and disks
  • did a lot of testing under a new user account
  • left all the VM's settings on default
  • played around with the Storage's 'Host I/O Cache' settings

.. but under no conditions can I get a freshly installed Laravel Homestead machine with a fresh disk and a freshly downloaded box to come up reliably without problems. It's as if one out of ten times it does work, and the other nine out of ten I see strange errors and kernel panics (within the VM) as it is trying to come up after issuing a vagrant up. The errors above are just typical examples, I haven't even been able to reliably get the same error.

This makes me suspect something is wrong with the VM's I/O configuration, but even if I don't touch any of its default settings I run into these issues, yet I don't find other users on-line who have problems with Laravel's Homestead on MacOS Catalina or on the new 16" MacBook Pro. I am slowly going mad and have no idea where else to look.

Ad

Answer

The solution for me, at least: the problem was the Intel Power Gadget kernel extension. Uninstall it and the VirtualBox Linux client VM kernel panics should stop.

I ran into something very similar recently (Vagrant 2.2.7, VirtualBox 6.1.4 r136177 under MacOS 10.15.4 on a late 2018 i5 MacBook Air, Homestead for Laravel and Chassis for WordPress sites). Tried every older version of VirtualBox and Vagrant I could find, reinstalled macOS (though various attempts at downgrading Mojave proved unsuccessful). Lost loads of time and it was stopping me getting any development done.

Nothing at all worked, it was infuriating: every time I ran vagrant up the VMs would always kernel panic at boot, and even if I did manage to somehow connect to them post-panic with vagrant ssh they were always broken – running sudo -s; apt-get update && apt-get upgrade would fail to download packages, or fail to install, in weird ways, they wouldn't respond to network requests, etc.

So I ended up thinking: what could possibly mess things up this strangely on macOS? Kernel extensions was all I could think of. I didn't have many installed: the NTFS driver from Paragon (which I since uninstalled), Little Snitch, and – thanks to some nudging from iStat Menus saying it'd be better for power monitoring if I installed it – Intel Power Gadget (v3.7.0 for MacOS).

So, time to quickly test if my Homestead VM kernel panics on vagrant up? Yes, yes it does sighs. Right, let's unload some kernel modules and check again. Open up a terminal and run sudo -s to become root.

Now to list what we have, excluding the Apple kexts:

bash-3.2# kextstat  | grep -v com.apple.
Index Refs Address            Size       Wired      Name (Version) UUID <Linked Against>
  163    0 0xffffff7f8446d000 0x4000     0x4000     com.intel.driver.EnergyDriver (3.7.0) 35E739F9-BF6C-3024-A67C-750711B3FB64 <8 6 5 3>
  187    0 0xffffff7f8468b000 0x185000   0x185000   at.obdev.nke.LittleSnitch (5470) A938A4D4-0642-39B0-A99E-4FA69C7F9660 <8 6 5 3 1>
  188    3 0xffffff7f84810000 0xf1000    0xf1000    org.virtualbox.kext.VBoxDrv (6.1.6) 13AC652B-A2C1-3E8E-809A-7604B284295D <8 6 5 3 1>
  191    0 0xffffff7f84919000 0x8000     0x8000     org.virtualbox.kext.VBoxUSB (6.1.6) 60779F27-059F-3030-9302-A74F05246760 <190 188 64 8 6 5 3 1>
  196    0 0xffffff7f8493b000 0x5000     0x5000     org.virtualbox.kext.VBoxNetFlt (6.1.6) 018767CF-8706-37EE-B97E-DEC1E0552BED <188 8 6 5 3 1>
  197    0 0xffffff7f84940000 0x6000     0x6000     org.virtualbox.kext.VBoxNetAdp (6.1.6) BB0DE95D-8041-32A2-B1D1-9144E531FB07 <188 6 5 1>

So let's unload the Intel Energy Driver:

bash-3.2# kextunload -b com.intel.driver.EnergyDriver

And check that it's not listed any more:

bash-3.2# kextstat  | grep -v com.apple.
Index Refs Address            Size       Wired      Name (Version) UUID <Linked Against>
  187    0 0xffffff7f8468b000 0x185000   0x185000   at.obdev.nke.LittleSnitch (5470) A938A4D4-0642-39B0-A99E-4FA69C7F9660 <8 6 5 3 1>
  188    3 0xffffff7f84810000 0xf1000    0xf1000    org.virtualbox.kext.VBoxDrv (6.1.6) 13AC652B-A2C1-3E8E-809A-7604B284295D <8 6 5 3 1>
  191    0 0xffffff7f84919000 0x8000     0x8000     org.virtualbox.kext.VBoxUSB (6.1.6) 60779F27-059F-3030-9302-A74F05246760 <190 188 64 8 6 5 3 1>
  196    0 0xffffff7f8493b000 0x5000     0x5000     org.virtualbox.kext.VBoxNetFlt (6.1.6) 018767CF-8706-37EE-B97E-DEC1E0552BED <188 8 6 5 3 1>
  197    0 0xffffff7f84940000 0x6000     0x6000     org.virtualbox.kext.VBoxNetAdp (6.1.6) BB0DE95D-8041-32A2-B1D1-9144E531FB07 <188 6 5 1>

Right, it's no longer running. Now let's try vagrant up and… wow, the VM doesn't crash any more! vagrant reload and it's still fine. Omg. All that time wasted and it was a damn kext.

I retested with all my Chassis WordPress boxes and they all started fine, too, rebooted and did the above again, and my VMs would consistently kernel panic until I unloaded the Intel Energy Driver. So I'm pretty sure it's the Intel Power Gadget that's conflicting with VirtualBox somehow and causing the VMs to kernel panic.

Can't say for sure if this is the same problem you ran into, but hopefully the above info will help anyone unfortunate enough to run into this problem and will stop you running into this issue again.

Ad
source: stackoverflow.com
Ad