Score:2

Ubuntu 21.04 (64-bit) fails to boot on QEMU raspi3 machine

dz flag

I'm trying to launch prebuilt Ubuntu for Raspberry Pi on QEMU and I managed to do that successfully with 20.04.2 by following steps below.

Download the image

https://ubuntu.com/download/raspberry-pi -> (64-bit) Ubuntu Server 20.04.2 LTS

Extract files from image

NAME="ubuntu-20.04.2-preinstalled-server-arm64+raspi"

unxz ./${NAME}.img.xz
hdiutil mount ./${NAME}.img -mountpoint "/Volumes/${NAME}"
mkdir $NAME

cp -r /Volumes/${NAME}/vmlinuz ./${NAME}/
cp -r /Volumes/${NAME}/initrd.img ./${NAME}/
cp -r /Volumes/${NAME}/*dtb ./${NAME}/

hdiutil unmount "/Volumes/${NAME}"

Prepare the image

qemu-img convert -f raw -O qcow2 ${NAME}.img ${NAME}.qcow
qemu-img resize -f qcow2 ${NAME}.qcow 4G

Launch machine

qemu-system-aarch64 \
    -M raspi3 \
    -append "rw earlyprintk loglevel=7 console=ttyAMA0,115200 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootdelay=1" \
    -dtb ./$NAME/bcm2710-rpi-3-b.dtb \
    -kernel $NAME/vmlinuz \
    -drive id=card0,if=none,format=qcow2,index=0,file=./${NAME}.qcow \
    -device sd-card,drive=card0 \
    -initrd $NAME/initrd.img \
    -m 1G \
    -smp 4 \
    -serial stdio \
    -usb \
    -device usb-mouse \
    -device usb-kbd

As expected, this starts the boot process and I eventually get the login prompt in a few minutes:

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 5.4.0-1028-raspi (buildd@bos02-arm64-034) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #31-Ubuntu SMP PREEMPT Wed Jan 20 11:30:45 UTC 2021 (Ubuntu 5.4.0-1028.31-raspi 5.4.78)
[    0.000000] Machine model: Raspberry Pi 3 Model B
...

Ubuntu 20.04.2 LTS ubuntu ttyAMA0

ubuntu login:

However when I follow the exact same steps with 21.04, QEMU launches, shows the familiar four raspberries, cursor blinks for a few times, then blinking stops and nothing else happens. I receive no serial output (unlike with 20.04).

QEMU window

(Just in case it makes any difference) I'm running this on the following host configuration:

  • macOS Mojave (10.14.6)
  • MacBook Pro (13-inch, 2016, Four Thunderbolt 3 Ports)
  • 3.3 GHz Intel Core i7
  • 16 GB 2133 MHz LPDDR3
  • qemu 6.0.0 installed via Homebrew
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.