Page 1 of 1
Gentoo as guest on VirtualBox and Apple M4
Posted: Mon Apr 21, 2025 7:28 am
by Banana
It is a first for me since I did not really needed it so far. But since I'm out of options I do want/need to get Gentoo running in virtualbox on an Apple M4 Pro.
EDIT/Update
I've decided to use UTM instead of virtualBox. See the replies for more details.
VirtualBox 7.1.8
EFI Option activated for this VM
Booted successfully the install-arm64-minimal, installed and configured everything until the first reboot. After that it gives me the error:
Code: Select all
...
/dev/root: can't open blockdev
VFS cannot open root device "PARTUUID=697f0ce2-fa91-4cf4-b3d2-b65017080775" or unknown-block(0,0): error -6
Please append a correcnt root .... available options
ext3
ext2
ext4
squashfs
vfat
msdos
exfat
xfs
Kernal panic - not syncing: ....
This looks to me something in the kernel is still missing.
Kernel config:
https://paste.gentoo.zip/ACEcbqSS
Emerge info:
https://bpa.st/MJ4A
fdisk -l
Code: Select all
Disk /dev/sda: 21.45 GiB, 23028826112 bytes, 44978176 sectors
Disk model: HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 05BC9496-4918-4CF0-A08D-0F9F55332168
Device Start End Sectors Size Type
/dev/sda1 2048 2099199 2097152 1G EFI System
/dev/sda2 2099200 10487807 8388608 4G Linux swap
/dev/sda3 10487808 44976127 34488320 16.4G Linux root (ARM-64)
Disk /dev/loop0: 531.21 MiB, 557019136 bytes, 1087928 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Grub config:
https://paste.gentoo.zip/tpmiDhQY
lspci info while in chroot
Code: Select all
00:00.0 VGA compatible controller: VMware SVGA II Adapter (Fusion)
Subsystem: VMware SVGA II Adapter (Fusion)
Kernel driver in use: vmwgfx
00:01.0 System peripheral: InnoTek Systemberatung GmbH VirtualBox Guest Service
00:03.0 SCSI storage controller: Red Hat, Inc. Virtio 1.0 SCSI (rev 01)
Subsystem: Red Hat, Inc. Virtio 1.0 SCSI
Kernel driver in use: virtio-pci
00:06.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller
Kernel driver in use: xhci_hcd
00:08.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
Subsystem: Intel Corporation PRO/1000 MT Desktop Adapter
Kernel driver in use: e1000
blkid
Code: Select all
/dev/sr0: BLOCK_SIZE="2048" UUID="2025-04-14-02-06-36-00" LABEL="Gentoo-arm64-20250413T230515Z" TYPE="iso9660" PTTYPE="PMBR"
/dev/loop0: BLOCK_SIZE="131072" TYPE="squashfs"
/dev/sda2: UUID="11b148a3-0f2f-4b7c-ba85-cf6fd13f6b40" TYPE="swap" PARTUUID="d92f625c-6a62-425c-b346-ce953bbfab0c"
/dev/sda3: UUID="64e89f9b-9ecc-4410-8551-7dee050a53e6" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="697f0ce2-fa91-4cf4-b3d2-b65017080775"
/dev/sda1: UUID="C30C-7274" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="6875b87d-d048-42dd-b0f0-32f5b3e74d41"
Any hints are welcome.
Posted: Mon Apr 21, 2025 10:25 am
by Koyan
Not a direct answer to your question, but I can strongly recommend UTM instead of VirtualBox. It's basically a macos fork of QEMU, so everything runs at native speed. I have a few Gentoo VMs (as well as a Windows 11 and 7 vm) running great on my Mac mini M4 on UTM.
https://mac.getutm.app/
Re: Gentoo as guest on VirtualBox and Apple M4
Posted: Mon Apr 21, 2025 10:44 am
by pingtoo
Banana wrote:It is a first for me since I did not really needed it so far. But since I'm out of options I do want/need to get Gentoo running in virtualbox on an Apple M4 Pro.
VirtualBox 7.1.8
EFI Option activated for this VM
Booted successfully the install-arm64-minimal, installed and configured everything until the first reboot. After that it gives me the error:
Code: Select all
...
/dev/root: can't open blockdev
VFS cannot open root device "PARTUUID=64e89f9b-9ecc-4410-8551-7dee050a53e6" or unknown-block(0,0): error -6
Please append a correcnt root .... available options
ext3
ext2
ext4
squashfs
vfat
msdos
exfat
xfs
Kernal panic - not syncing: ....
This looks to me something in the kernel is still missing.
How did you boot into this entry in GRUB? the "64e89f9b-9ecc-4410-8551-7dee050a53e6" is your rootfs UUID, not partition UUID. And from your grub.conf I did not see any menuentry use that fs-UUID, they all use correct PARTUUID for root device.
Posted: Mon Apr 21, 2025 11:09 am
by NeddySeagoon
Banana,
tells that the kernel cannot see any block devices at all.
You need the bits for
Code: Select all
00:03.0 SCSI storage controller: Red Hat, Inc. Virtio 1.0 SCSI (rev 01)
Subsystem: Red Hat, Inc. Virtio 1.0 SCSI
Kernel driver in use: virtio-pci
If virtio is in use, your guest drive drive should be vda, not sda.
You get sda when you use emulated hardware.
Your kernel looks OK in that department.
VirtualBox on arm64 is new to me. I've always used QEMU with virt-manager.
How is the guest HDD connected in the guest setup in Virtualbox?
Posted: Mon Apr 21, 2025 12:13 pm
by Banana
Koyan wrote:Not a direct answer to your question, but I can strongly recommend UTM instead of VirtualBox. It's basically a macos fork of QEMU, so everything runs at native speed. I have a few Gentoo VMs (as well as a Windows 11 and 7 vm) running great on my Mac mini M4 on UTM.
https://mac.getutm.app/
Oh, thx. I might give this a try.
pingtoo wrote:How did you boot into this entry in GRUB? the "64e89f9b-9ecc-4410-8551-7dee050a53e6" is your rootfs UUID, not partition UUID. And from your grub.conf I did not see any menuentry use that fs-UUID, they all use correct PARTUUID for root device.
Oh, this is a typo. Since I only have a screenshot of that error message, I written it off the screenshot and lazy copy pasted the wrong UUID of the blkid output.
So the PARTUUID from grub does match the error message. Gonna correct it in the first post.
NeddySeagoon wrote:tells that the kernel cannot see any block devices at all.
Yeah, but why. Usuall it comes from missing fstype support. But my kernel does have xfs. Which is also displayed in the error message.
NeddySeagoon wrote:If virtio is in use, your guest drive drive should be vda, not sda.
You get sda when you use emulated hardware.
But using the partuuid should make the difference irrelevant?
NeddySeagoon wrote:VirtualBox on arm64 is new to me. I've always used QEMU with virt-manager.
How is the guest HDD connected in the guest setup in Virtualbox?
It is attached as a .vdi file. The settings tells me that it is a "VID (VirtualBox Disk Image)". But there are other options available: VHD, VNDK, HDD, QCOW, QED
But I don't think that this is a problem, because the install-arm64-minimal-*.iso can work with it.
Posted: Mon Apr 21, 2025 12:25 pm
by pingtoo
I think we need to see more on boot messages in order to understand how kernel see the VM.
Can you add serial console to VM so you can save the messages somewhere and share it.
Posted: Mon Apr 21, 2025 12:42 pm
by Banana
pingtoo wrote:I think we need to see more on boot messages in order to understand how kernel see the VM.
Can you add serial console to VM so you can save the messages somewhere and share it.
Well, I did some search and came up with this:
https://gist.github.com/snb/284940/11e6 ... ed49ebd143
Used the file output, since the other options did not work or the commends are not available, but the result was strange. Only three lines are recored.
Something like starting uefi... and then nothing.
The boot does show more stuff. But now I do not even get the mentioned error message from the first post and stops at "md: ... autorun DONE." and does nothing further.
Not even without the serialport... I'm confused and do not really remember changing anything to the VM...
Posted: Mon Apr 21, 2025 1:02 pm
by pingtoo
I don't know virtualbox enough to comment on how to setup serial port. I too use UTM.
One option could be introduce initrd into boot, so it is possible to examine kernel view use early root (in memroy)
Did you change grub to add "console=tty0 console=ttyS0,115200n8" on kernel command line argument?
I ask Gemini, it said for the "Port Mode:" It is possible to use "Raw File", do your virtualbox gave you this option?
Just thought of another test. what if you change the kernel command line argument root=/dev/sda3 or root=/dev/vda3 to just test if there is a right driver in kernel.
Posted: Mon Apr 21, 2025 2:49 pm
by Banana
I was able to set it to a file but as mentioned did not record anything usefull.
I've managed to grab a screenshot with the changed boot cmd. No look so far:
https://pasteboard.co/v2ArHjgbqdvX.png
I'm not bound to virtualBox. I will give it some more rounds and then try utm. Any suggestion about that or is it straight forward?
Posted: Mon Apr 21, 2025 5:32 pm
by pingtoo
I don't know if you tried with /dev/vda3 as well, however if it also failed that mean driver missing, however I don't know kernel enough to simply read .config file to see what is missing, I usually depend on looking at dmesg and lsmod and compare with a successful boot to figure out what missing.
for UTM, I have not tried with gentoo kernel yet. I just use alpinelinux iso which work out of box without me doing anything. However this is just simple test boot, I do container inside a alpinelinux host. BTW, mine is MacBook Pro M2 (MBP)
Try with other livecd, alpinelinux or ubuntu so you can identify modules required and from working dmesg usually can identify what is needed.
Posted: Mon Apr 21, 2025 5:39 pm
by NeddySeagoon
Banana,
tells that the kernel cannot see any block devices at all.
If you get
it tells that the kernel can find the block device with major,minor number but not read what it finds.
That's usually a missing filesystem. Its not got that far.
Notice the line at
Code: Select all
0.8472223 Please append a correct "root=" boot option; here are the available partitions:
The list is empty, so the kernel can't see any partitions.
xfs is listed in bdev filesfstems, so you are good there.
Posted: Tue Apr 22, 2025 12:48 am
by flysideways
I have been successfully using arm64 sys-kernel/Gentoo-kernel on an M1 MacBook Pro in both UTM and VMWare Fusion for a while now.
In addition to Gentoo, arm64 versions of Alpine, Debian, and Kali, have also successfully run in both UTM and VMWare Fusion for me on the M1 Apple Silicon.
I am glad to see Virtualbox also now available for Apple Silicon, and was intending to try it when I find the time.
Posted: Mon Apr 28, 2025 12:52 pm
by Banana
Thx for the feedback so far. Wasn't able to do anything in this topic lately.
I currently had success in booting after the normal handbook install on UTM and arm64 minimal cd image.
I'm not yet sure what was the change which made it work, but I will gather some info and write them down.
Posted: Fri May 02, 2025 9:38 am
by Banana
Current state about running it with UTM (version 4.6.5).
- UTM with default settings for this VM
- Used the install-arm64-minimal iso to boot from
- Used the default handbook Used https://wiki.gentoo.org/wiki/Handbook:AMD64
- GPT, UEFI and dhcpd
- It is not /dev/sdam, it is /dev/vda
- arm stage file
- Manual kernel config
- Using Grub, no initramfs
I do think now that the combination of GRUB and those VIRTIO config settings in the kernel did the trick.
Using efi stub did not work.
One of the last changes to the kernel was adding
CONFIG_VIRTIO_FS.
CONFIG_VIRTIO_BLK was already there, so it looks like the _FS was needed.
Code: Select all
CONFIG_BLK_MQ_VIRTIO=y
CONFIG_ARM_SCMI_TRANSPORT_VIRTIO=y
CONFIG_ARM_SCMI_TRANSPORT_VIRTIO_VERSION1_COMPLIANCE=y
# CONFIG_ARM_SCMI_TRANSPORT_VIRTIO_ATOMIC_ENABLE is not set
CONFIG_VIRTIO_BLK=y
CONFIG_SCSI_VIRTIO=y
CONFIG_VIRTIO_NET=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_HW_RANDOM_VIRTIO=y
# CONFIG_I2C_VIRTIO is not set
# CONFIG_GPIO_VIRTIO is not set
CONFIG_DRM_VIRTIO_GPU=y
CONFIG_DRM_VIRTIO_GPU_KMS=y
CONFIG_VIRTIO_ANCHOR=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_PCI_LIB=y
CONFIG_VIRTIO_PCI_LIB_LEGACY=y
CONFIG_VIRTIO_MENU=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_PCI_LEGACY=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_MEM=y
CONFIG_VIRTIO_INPUT=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
CONFIG_VIRTIO_DMA_SHARED_BUFFER=y
# CONFIG_VIRTIO_DEBUG is not set
CONFIG_VIRTIO_IOMMU=y
# CONFIG_RPMSG_VIRTIO is not set
CONFIG_VIRTIO_FS=y
# CONFIG_CRYPTO_DEV_VIRTIO is not set
Posted: Thu May 08, 2025 6:29 am
by Banana
I've ditched the idea about virtualBox and using UTM now.