Skip to contentSkip to conversation

QEMU unexpectedly closed the monitor

DISCUSSION Itaru Kitayama 4 participants 7 messages Jul 29, 2024 – Aug 1, 2024

lore
Share & tools
lore
#0 lore raw

Hi,

Executing virt-install with the following options:

sudo virt-install --machine=virt --arch=aarch64 --name=test8 --disk path=/var/lib/libvirt/images/jammy.qcow2,format=qcow2,device=disk,bus=virtio,cache=none --memory=2048 --vcpu=1 --nographic --check all=off --features acpi=off --import --os-variant=ubuntu22.04 --virt-type kvm --boot kernel=Image-guest-cca-v4,initrd=rootfs.cpio,kernel_args='earlycon console=ttyAMA0 rdinit=/sbin/init rw root=/dev/vda acpi=off' --network none

receives an error:

Starting install...
ERROR internal error: QEMU unexpectedly closed the monitor (vm='test8'): 2024-07-29T06:23:04.717118Z qemu-system-aarch64: could not load kernel '/home/realm/Image-guest-cca-v4’

I am not sure how to investigate as the kernel Image (Image-guest-cca-v4) can work if it is used directly with the qemu-system-aarch64, like:

sudo qemu-system-aarch64 -kernel Image-guest-cca-v4 -initrd rootfs.cpio -cpu host -M virt,gic-version=3,acpi=off -enable-kvm -smp 2 -m 2048M -nographic -append 'earlycon console=ttyAMA0 rdinit=/sbin/init rw root=/dev/vda acpi=off' -net none

Userland is Ubuntu 24.04, and the host and guest kernels are for the protected VM (Realm) execution. Any help would be appreciated.

Thanks,
Itaru.

#1 lore raw
Quoted 17 lines · Itaru Kitayama

Hi,

Executing virt-install with the following options:

sudo virt-install --machine=virt --arch=aarch64 --name=test8 --disk path=/var/lib/libvirt/images/jammy.qcow2,format=qcow2,device=disk,bus=virtio,cache=none --memory=2048 --vcpu=1 --nographic --check all=off --features acpi=off --import --os-variant=ubuntu22.04 --virt-type kvm --boot kernel=Image-guest-cca-v4,initrd=rootfs.cpio,kernel_args='earlycon console=ttyAMA0 rdinit=/sbin/init rw root=/dev/vda acpi=off' --network none

receives an error:

Starting install...
ERROR internal error: QEMU unexpectedly closed the monitor (vm='test8'): 2024-07-29T06:23:04.717118Z qemu-system-aarch64: could not load kernel '/home/realm/Image-guest-cca-v4’

Quoted 6 lines

I am not sure how to investigate as the kernel Image (Image-guest-cca-v4) can work if it is used directly with the qemu-system-aarch64, like:

sudo qemu-system-aarch64 -kernel Image-guest-cca-v4 -initrd rootfs.cpio -cpu host -M virt,gic-version=3,acpi=off -enable-kvm -smp 2 -m 2048M -nographic -append 'earlycon console=ttyAMA0 rdinit=/sbin/init rw root=/dev/vda acpi=off' -net none

Is there any way to get virt-install to dump its QEMU command line? There obviously seems to be something off if it works when you build the command line by hand.

Quoted 6 lines

Userland is Ubuntu 24.04, and the host and guest kernels are for the protected VM (Realm) execution. Any help would be appreciated.

Thanks,
Itaru.

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#2 lore raw

Hi Alex,

Quoted 23 lines · Alex Bennée
Quoted 19 lines · Itaru Kitayama

Hi,

Executing virt-install with the following options:

sudo virt-install --machine=virt --arch=aarch64 --name=test8 --disk path=/var/lib/libvirt/images/jammy.qcow2,format=qcow2,device=disk,bus=virtio,cache=none --memory=2048 --vcpu=1 --nographic --check all=off --features acpi=off --import --os-variant=ubuntu22.04 --virt-type kvm --boot kernel=Image-guest-cca-v4,initrd=rootfs.cpio,kernel_args='earlycon console=ttyAMA0 rdinit=/sbin/init rw root=/dev/vda acpi=off' --network none

receives an error:

Starting install...
ERROR internal error: QEMU unexpectedly closed the monitor (vm='test8'): 2024-07-29T06:23:04.717118Z qemu-system-aarch64: could not load kernel '/home/realm/Image-guest-cca-v4’

I am not sure how to investigate as the kernel Image (Image-guest-cca-v4) can work if it is used directly with the qemu-system-aarch64, like:

Quoted 8 lines
Quoted 4 lines

sudo qemu-system-aarch64 -kernel Image-guest-cca-v4 -initrd rootfs.cpio -cpu host -M virt,gic-version=3,acpi=off -enable-kvm -smp 2 -m 2048M -nographic -append 'earlycon console=ttyAMA0 rdinit=/sbin/init rw root=/dev/vda acpi=off' -net none

Is there any way to get virt-install to dump its QEMU command line? There obviously seems to be something off if it works when you build the command line by hand.

Not in a form we wish, but structured way, see the attached log with the —debug option.

Itaru.

Quoted 12 lines
Quoted 8 lines

Userland is Ubuntu 24.04, and the host and guest kernels are for the protected VM (Realm) execution. Any help would be appreciated.

Thanks,
Itaru.

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#3 lore raw
Quoted 30 lines · Itaru Kitayama

Hi Alex,

Quoted 28 lines · Alex Bennée
Quoted 23 lines · Itaru Kitayama

Hi,

Executing virt-install with the following options:

sudo virt-install --machine=virt --arch=aarch64 --name=test8 --disk path=/var/lib/libvirt/images/jammy.qcow2,format=qcow2,device=disk,bus=virtio,cache=none --memory=2048 --vcpu=1 --nographic --check all=off --features acpi=off --import --os-variant=ubuntu22.04 --virt-type kvm --boot kernel=Image-guest-cca-v4,initrd=rootfs.cpio,kernel_args='earlycon console=ttyAMA0 rdinit=/sbin/init rw root=/dev/vda acpi=off' --network none

receives an error:

Starting install...
ERROR internal error: QEMU unexpectedly closed the monitor (vm='test8'): 2024-07-29T06:23:04.717118Z qemu-system-aarch64: could not load kernel '/home/realm/Image-guest-cca-v4’

I am not sure how to investigate as the kernel Image (Image-guest-cca-v4) can work if it is used directly with the qemu-system-aarch64, like:

sudo qemu-system-aarch64 -kernel Image-guest-cca-v4 -initrd rootfs.cpio -cpu host -M virt,gic-version=3,acpi=off -enable-kvm -smp 2 -m 2048M -nographic -append 'earlycon console=ttyAMA0 rdinit=/sbin/init rw root=/dev/vda acpi=off' -net none

Quoted 6 lines
Quoted 3 lines

Is there any way to get virt-install to dump its QEMU command line? There obviously seems to be something off if it works when you build the command line by hand.

Not in a form we wish, but structured way, see the attached log with the —debug option.

You can extract the XML into a file and then do:

virsh domxml-to-native qemu-argv test.xml

which will give you an excessive command line like this:

/usr/bin/qemu-system-aarch64 -name guest=test8,debug-threads=on -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/home/alex/.config/libvirt/qemu/lib/domain--1-test8/master-key.aes"}' -machine virt-6.2,usb=off,dump-guest-core=off,gic-version=3,memory-backend=mach-virt.ram -accel kvm -cpu host -m 2048 -object '{"qom-type":"memory-backend-ram","id":"mach-virt.ram","size":2147483648}' -overcommit mem-lock=off -smp 1,sockets=1,cores=1,threads=1 -uuid b32a6305-44e2-470e-b514-2c0aff76549b -display none -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/home/alex/.config/libvirt/qemu/lib/domain--1-test8/monitor.sock,server=on,wait=off -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -no-acpi -boot strict=on -kernel /home/realm/Image-v6.10 -initrd /home/realm/rootfs.cpio -append 'earlycon console=ttyAMA0 rdinit=/sbin/init rw root=/dev/vda acpi=on' -device pcie-root-port,port=8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,addr=0x1 -device pcie-root-port,port=9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 -device pcie-root-port,port=10,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 -device pcie-root-port,port=11,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 -device pcie-root-port,port=12,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 -device pcie-root-port,port=13,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 -device pcie-root-port,port=14,chassis=7,id=pci.7,bus=pcie.0,addr=0x1.0x6 -device pcie-root-port,port=15,chassis=8,id=pci.8,bus=pcie.0,addr=0x1.0x7 -device pcie-root-port,port=16,chassis=9,id=pci.9,bus=pcie.0,multifunction=on,addr=0x2 -device pcie-root-port,port=17,chassis=10,id=pci.10,bus=pcie.0,addr=0x2.0x1 -device pcie-root-port,port=18,chassis=11,id=pci.11,bus=pcie.0,addr=0x2.0x2 -device pcie-root-port,port=19,chassis=12,id=pci.12,bus=pcie.0,addr=0x2.0x3 -device pcie-root-port,port=20,chassis=13,id=pci.13,bus=pcie.0,addr=0x2.0x4 -device pcie-root-port,port=21,chassis=14,id=pci.14,bus=pcie.0,addr=0x2.0x5 -device qemu-xhci,p2=15,p3=15,id=usb,bus=pci.1,addr=0x0 -device virtio-serial-pci,id=virtio-serial0,bus=pci.2,addr=0x0 -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/jammy.qcow2","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' -device virtio-blk-pci,bus=pci.3,addr=0x0,drive=libvirt-1-format,id=virtio-disk0,bootindex=1,write-cache=on -chardev pty,id=charserial0 -serial chardev:charserial0 -chardev socket,id=charchannel0,path=/home/alex/.config/libvirt/qemu/channel/target/domain--1-test8/org.qemu.guest_agent.0,server=on,wait=off -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0 -audiodev '{"id":"audio1","driver":"none"}' -device virtio-balloon-pci,id=balloon0,bus=pci.4,addr=0x0 -object '{"qom-type":"rng-random","id":"objrng0","filename":"/dev/urandom"}' -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.5,addr=0x0 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny -msg timestamp=on

You then need to manually strip out all the various chardevs for libvirt control sockets and you can an equivalent command line you can run from the console. One thing that did jump out as a bit weird to me was:

-rtc base=utc -no-shutdown -no-acpi -boot strict=on \
-kernel /home/realm/Image-v6.10 \
-initrd /home/realm/rootfs.cpio \
-append 'earlycon console=ttyAMA0 rdinit=/sbin/init rw root=/dev/vda acpi=on'

which seems to be both disabling ACPI and then enabling it in the kernel options. Maybe that is a firmware thing?

Quoted 17 lines

Itaru.

[2. application/octet-stream; log]...

Quoted 11 lines
Quoted 7 lines

Userland is Ubuntu 24.04, and the host and guest kernels are for the protected VM (Realm) execution. Any help would be appreciated.

Thanks,
Itaru.

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#4 lore raw
Quoted 8 lines · Alex Bennée

You then need to manually strip out all the various chardevs for libvirt control sockets and you can an equivalent command line you can run from the console. One thing that did jump out as a bit weird to me was:

-rtc base=utc -no-shutdown -no-acpi -boot strict=on \
-kernel /home/realm/Image-v6.10 \
-initrd /home/realm/rootfs.cpio \
-append 'earlycon console=ttyAMA0 rdinit=/sbin/init rw root=/dev/vda acpi=on'

Also worth checking here I guess is whether virt-install is running QEMU as a user which doesn't have access to the /home/realm/Image-v6.10 etc files -- are they world readable?

thanks
-- PMM

#5 lore raw
Quoted 10 lines · Peter Maydell
Quoted 8 lines · Alex Bennée

You then need to manually strip out all the various chardevs for libvirt control sockets and you can an equivalent command line you can run from the console. One thing that did jump out as a bit weird to me was:

-rtc base=utc -no-shutdown -no-acpi -boot strict=on \
-kernel /home/realm/Image-v6.10 \
-initrd /home/realm/rootfs.cpio \
-append 'earlycon console=ttyAMA0 rdinit=/sbin/init rw root=/dev/vda acpi=on'

Quoted 4 lines

Also worth checking here I guess is whether virt-install is running QEMU as a user which doesn't have access to the /home/realm/Image-v6.10 etc files -- are they world readable?

Most likely it is the directory permissions which are the problem since $HOME is typically set to deny access from other users, which would include the user QEMU runs as.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#6 lore raw
Quoted 20 lines · Daniel P. Berrangé
Quoted 5 lines · Peter Maydell
Quoted 4 lines · Alex Bennée

You then need to manually strip out all the various chardevs for libvirt control sockets and you can an equivalent command line you can run from the console. One thing that did jump out as a bit weird to me was:

Quoted 9 lines

Review

Quoted 4 lines
(quoted diff) +0 -4
-rtc base=utc -no-shutdown -no-acpi -boot strict=on \
-kernel /home/realm/Image-v6.10 \
-initrd /home/realm/rootfs.cpio \
-append 'earlycon console=ttyAMA0 rdinit=/sbin/init rw root=/dev/vda acpi=on'

Also worth checking here I guess is whether virt-install is running QEMU as a user which doesn't have access to the /home/realm/Image-v6.10 etc files -- are they world readable?

Quoted 3 lines

Most likely it is the directory permissions which are the problem since $HOME is typically set to deny access from other users, which would include the user QEMU runs as.

Hi Daniel, Peter,

That was it, I was (unintentinally) adding additional ACL control on my home directory ie /home/realm; I removed it and doing chmod o+rw /home/realm helped it. Kernel Image and initrd files were world readable. Also, placing them under /var/lib/libvirt/boot worked as well.

Alex,
Thanks for showing me the steps to reconstruct the set of QEMU options used by libvirt.

Thanks,
Itaru.

Quoted 7 lines

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|