machyve / xhyve

xhyve, a lightweight OS X virtualization solution
Other
6.43k stars 353 forks source link

Unable to start Alpine Linux following the guide on the website, also a question about the use of physical hard disks #193

Open ghost opened 3 years ago

ghost commented 3 years ago

I have replicated the instructions used for the Ubuntu installer, but for Alpine Linux.

Here is the file that I have used as my script to start the installer:

#!/bin/sh
KERNEL="boot/vmlinuz-lts" 
INITRD="boot/initramfs-lts" # these kernel and initrd files come from an extracted Alpine Linux iso.

CMDLINE="earlyprintk=serial console=ttyS0 acpi=off" 
MEM="-m 1G"

#SMP="-c 2"

#NET="-s 2:0,virtio-net" 
IMG_CD="-s 3,ahci-cd,iso.iso" # iso.iso is a stock Alpine Linux x86_64 iso.
IMG_HDD="-s 4,virtio-blk,/dev/disk2" # /dev/disk2 is a real USB external hard drive.
PCI_DEV="-s 0:0,hostbridge -s 31,lpc" 
LPC_DEV="-l com1,stdio" 

xhyve $MEM $SMP $PCI_DEV $LPC_DEV $IMG_CD $IMG_HDD -f kexec,$KERNEL,$INITRD,"$CMDLINE"

I didn't know how to make the physical drive accessible running it as a regular user, so I ran it as root (this is probably a bad idea)

The result is this:

% sudo ./vm.sh
Password:
vm exit[0]
            reason      VMX
                                    rip     0x000000000009e019
                                                                            inst_length 3
                    status      0
                                            exit_reason 33
                                                                    qualification   0x0000000000000000
                            inst_type       0
                                                            inst_error  0
                                                                               ./vm.sh: line 14: 14209 Abort trap: 6 

I checked the intel manual and exit reason 33 is "VM-entry failure due to invalid guest state." I looked at the list of entry checks that are performed, and while many of them are above my level of understanding, a lot of them have to do with execution privilege, which makes me think that I should run as a non-privileged user. So I remove $IMG_HDD from my shell script, and I run without sudo and get the exact same error.

This leaves me with some questions:

wiredfool commented 3 years ago

This happens with a stock Ubuntu 20.04 5.4.0-generic kernel as well.