Qemu, Arch, and VMs that don't start

This problem has been reported at least three times on this forum and chat.

The current solution is to downgrade Qemu to 9.0.

One person reported, also having to manually delete a file after the downgrade.

Can we work together to try to create a reproducible example of the problem and a detailed solution?

The issue can show up on Debian based systems too, but at least the Zabbly packages are not using qemu 9.1.

I don’t run Arch and have little experience with it. Does anyone know who is maintaining the relevant packages?

We could also collect upstream project specific bug reports.

1 Like

Arch Linux maintainers:
qemu - David Runge dvzrv@archlinux.org
lxd, incus - Morten Linderud foxboron@archlinux.org

1 Like

CC: @Foxboron

I’m at Plumbers this week and travelling to ASG next week. I don’t have a lot of time to dig into this until next month I’m afraid.

However I’ll try to take a look when I can. I suspect it’s a missing package from the qemu split package?

1 Like

Let’s do a repro (a test case that reproduces the problem)!

I launch an Arch Linux VM in Incus, then in that VM I installed incus and created an Alpine VM (VM nesting). While doing this, I got an error.

In the following I managed to reproduce the following error.

Error: Failed setting up device via monitor: Failed adding block device for disk device “root”: Failed adding block device: Failed to find file descriptor with matching flags=0x4002

$ incus launch images:archlinux/cloud archlinux --vm
Launching archlinux
Error: Failed instance creation: The image used by this instance is incompatible with secureboot. Please set security.secureboot=false on the instance
$ incus config set archlinux security.secureboot=false
$ incus start archlinux
$ incus shell archlinux
Error: VM agent isn't currently running
$ incus shell archlinux
Error: VM agent isn't currently running
$ incus shell archlinux
[root@archlinux ~]# pacman -Syu
:: Synchronizing package databases...
 core is up to date
...
 Starting full system upgrade...
 there is nothing to do
[root@archlinux ~]# pacman -S incus
...
(43/80) installing qemu-base
Optional dependencies for qemu-base    !!!
    qemu-user-static: for static user mode emulation of QEMU targets
    samba: for SMB/CIFS server support
    qemu-block-gluster: for Gluster block driver
    qemu-block-iscsi: for iSCSI block driver
    qemu-chardev-baum: for Baum chardev driver
    qemu-docs: for documentation
    qemu-emulators-full: for all system emulators
    qemu-full: for a full QEMU installation
...
[root@archlinux ~]# incus admin init
Error: Failed to connect to local daemon: Get "http://unix.socket/1.0": dial unix /var/lib/incus/unix.socket: connect: no such file or directory
[root@archlinux ~]# systemctl start incus
[root@archlinux ~]# incus list
+------+-------+------+------+------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+------+-------+------+------+------+-----------+
[root@archlinux ~]# incus admin init
Would you like to use clustering? (yes/no) [default=no]: 
Do you want to configure a new storage pool? (yes/no) [default=yes]: 
Name of the new storage pool [default=default]: 
Where should this storage pool store its data? [default=/var/lib/incus/storage-pools/default]: 
Would you like to create a new local network bridge? (yes/no) [default=yes]: 
What should the new bridge be called? [default=incusbr0]: 
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 
Would you like the server to be available over the network? (yes/no) [default=no]: 
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]: 
Would you like a YAML "init" preseed to be printed? (yes/no) [default=no]: yes
config: {}
networks:
- config:
    ipv4.address: auto
    ipv6.address: auto
  description: ""
  name: incusbr0
  type: ""
  project: default
storage_pools:
- config: {}
  description: ""
  name: default
  driver: dir
profiles:
- config: {}
  description: ""
  devices:
    eth0:
      name: eth0
      network: incusbr0
      type: nic
    root:
      path: /
      pool: default
      type: disk
  name: default
projects: []
cluster: null

[root@archlinux ~]# incus launch --vm images:alpine/edge/cloud alpine 
Launching alpine
Error: Failed instance creation: Failed creating instance record: Failed initializing instance: Invalid config: No uid/gid allocation configured. In this mode, only privileged containers are supported
[root@archlinux ~]# cat /etc/sub?id
arch:100000:65536
arch:100000:65536
[root@archlinux ~]# vi /etc/subuid
[root@archlinux ~]# vi /etc/subgid
[root@archlinux ~]# cat /etc/sub?id
root:100000:65536
arch:100000:65536
root:100000:65536
arch:100000:65536
[root@archlinux ~]# incus launch --vm images:alpine/edge/cloud alpine 
Launching alpine
Error: Failed instance creation: Failed creating instance record: Failed initializing instance: Invalid config: No uid/gid allocation configured. In this mode, only privileged containers are supported
[root@archlinux ~]# systemctl restart incus
[root@archlinux ~]# incus launch --vm images:alpine/edge/cloud alpine 
Launching alpine
Error: Failed instance creation: The image used by this instance is incompatible with secureboot. Please set security.secureboot=false on the instance
[root@archlinux ~]# incus config set alpine security.secureboot=false
[root@archlinux ~]# incus start alpine
Error: Failed setting up device via monitor: Failed adding block device for disk device "root": Failed adding block device: Failed to find file descriptor with matching flags=0x4002
Try `incus info --show-log alpine` for more info
[root@archlinux ~]# incus info --show-log alpine
Name: alpine
Status: STOPPED
Type: virtual-machine
Architecture: x86_64
Created: 2024/09/18 12:13 UTC
Last Used: 1970/01/01 00:00 UTC

Log:


[root@archlinux ~]# 
1 Like

@Banafsheh_Fatemi how did you downgrade qemu on your system? I am not familiar with pacman.

We are trying to reproduce the error and solution you used to fix your Incus 6.5 install.

Do you have any idea why we needed to edit those subuid and subgid files on Arch? Maybe the package should have taken care of that for us. :thinking:

i had to downgrade all related packages together , becasue i didnt have any caches saved in my system i did it like this:

sudo pacman -U \
https://archive.archlinux.org/packages/q/qemu-base/qemu-base-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-system-x86/qemu-system-x86-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-common/qemu-common-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-audio-spice/qemu-audio-spice-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-block-curl/qemu-block-curl-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-block-dmg/qemu-block-dmg-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-block-nfs/qemu-block-nfs-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-block-ssh/qemu-block-ssh-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-chardev-spice/qemu-chardev-spice-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-display-qxl/qemu-hw-display-qxl-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-display-virtio-gpu/qemu-hw-display-virtio-gpu-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-display-virtio-gpu-gl/qemu-hw-display-virtio-gpu-gl-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-display-virtio-gpu-pci/qemu-hw-display-virtio-gpu-pci-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-display-virtio-gpu-pci-gl/qemu-hw-display-virtio-gpu-pci-gl-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-display-virtio-vga/qemu-hw-display-virtio-vga-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-display-virtio-vga-gl/qemu-hw-display-virtio-vga-gl-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-s390x-virtio-gpu-ccw/qemu-hw-s390x-virtio-gpu-ccw-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-usb-host/qemu-hw-usb-host-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-usb-redirect/qemu-hw-usb-redirect-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-hw-usb-smartcard/qemu-hw-usb-smartcard-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-img/qemu-img-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-pr-helper/qemu-pr-helper-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-system-x86-firmware/qemu-system-x86-firmware-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-tools/qemu-tools-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-ui-curses/qemu-ui-curses-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-ui-opengl/qemu-ui-opengl-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-ui-spice-app/qemu-ui-spice-app-9.0.2-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/q/qemu-ui-spice-core/qemu-ui-spice-core-9.0.2-1-x86_64.pkg.tar.zst
1 Like

The Arch packaging for Incus does not add the necessary subuid/subgid, therefore they need to be added manually.

If you notice in my earlier terminal commands, I diligently kept all error messages as an educational instrument on how to deal with issues that may arise. Presumably, if someone looks into the commands and their output, they can get an idea on how something is done, and how to rectify errors without having to write explicitly about it.

Thanks for doing that. Without it I would have been a bit lost.

But do you know why the package would not do that automatically? Maybe there is a good reason.

I followed the steps for Arch from How to install Incus - Incus documentation

In there there’s mention to file issues at Issues · Arch Linux / Packaging / Packages / incus · GitLab

I just looked into the Arch Wiki, a high quality wiki, and it does have a page for Incus. Also, high quality content. It mentions the issue with subuid, subgid, along with nice troubleshooting. Incus - ArchWiki

However, it does not cover the issue about Error: Failed setting up device via monitor. It would be great if someone can post it at Issues · Arch Linux / Packaging / Packages / incus · GitLab

1 Like

Banafsheh’s qemu downgrade command works on my test system.

I also see that someone posted an issue about this directly on the Archlinux package repo.

They don’t link to this thread. If anyone has an account over there, please add it.

So, two things:

  • The package can be updated so that it does not use qemu 9.1.
  • The root cause with qemu 9.1 will need to be fixed.

At least we have a reproducible example and a temporary solution.

It is cool that we all worked together and got this far. :slight_smile:

@Foxboron as discussed last night, here are the changes we pushed to Incus to handle the QEMU 9.1 changes:

Only the first one is needed to get most QEMU 9.1 users to behave, the rest is to clean that up a bit and avoid other deprecation warnings.

Note that as I mentioned last night, there is an issue with QEMU 9.1 and live migration which leaves any live-migrated VM with a hung CPU0. Single CPU VMs therefore just die on migration while multi-CPU VMs will usually respond but with a very upset kernel and hung tasks…

I’ve not had time to try to figure out what’s going on there, but that’s why we’re still using QEMU 9.0 in our tests and in my packages.

3 Likes

The package with the mentioned patches has been pushed.

Thanks again for making the list!

4 Likes

I checked our reproducible example. I can’t reproduce the issue anymore, so it seems that the patches that made it into 6.5-2 fixed the issue with qemu 9.1.

:smiley:

2 Likes