Comment 0 for bug 2051153

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

This has gone through some iterations, and it seems something has broken the variant in Jammy.

Background in bug 1847361

What this does as TL;DR:
- on package upgrade it saves the modules you might later hot-attach in a temporary path
- if a guest was started before upgrade and still runs, it can not load the .so of the current qemu in /usr
- instead it falls back to load them from that temporary path, allowing "guests started before upgrade" to still be able to load drivers
- up to Focal that is tmpfs
- later this changed to a systemd mount unit
- where it is a systemd unit, we use --no-restart-on-upgrade to keep it active
- in both cases the prerm saves the files
- the postrm in remove/purge case cleans
- otherwise it stays until reboot as it is a temporary directory

Now the problem is, it seems on Jammy --no-restart-on-upgrade is ignored.

Focal (no unit yet):
$ apt install -y --reinstall qemu-block-extra
$ ll /var/run/qemu/
total 4
drwxr-xr-x 3 root root 80 Jan 24 17:18 ./
drwxr-xr-x 31 root root 880 Jan 24 17:18 ../
drwxr-xr-x 2 root root 120 Jan 24 17:18 Debian_1_4.2-3ubuntu6.28/
-rw-r--r-- 1 root root 145 Jan 24 17:18 README

=> all good here

Jammy (mount unit, but restarted which it should not be)

root@j-vm:~# apt install -y --reinstall qemu-block-extra; systemctl status run-qemu.mount; ls -laF /run/qemu/
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 68.1 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 qemu-block-extra amd64 1:6.2+dfsg-2ubuntu6.16 [68.1 kB]
Fetched 68.1 kB in 0s (565 kB/s)
(Reading database ... 72988 files and directories currently installed.)
Preparing to unpack .../qemu-block-extra_1%3a6.2+dfsg-2ubuntu6.16_amd64.deb ...
Unpacking qemu-block-extra (1:6.2+dfsg-2ubuntu6.16) over (1:6.2+dfsg-2ubuntu6.16) ...
Setting up qemu-block-extra (1:6.2+dfsg-2ubuntu6.16) ...
Scanning processes...
Scanning linux images...

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
● run-qemu.mount - Prepare /run/qemu to allow still running qemu binaries of former builds (after package upgrades) to fallback-load modules from there
     Loaded: loaded (/proc/self/mountinfo; enabled; vendor preset: enabled)
     Active: active (mounted) since Wed 2024-01-24 17:18:51 UTC; 2s ago
      Where: /run/qemu
       What: tmpfs
      Tasks: 0 (limit: 1171)
     Memory: 8.0K
        CPU: 1ms
     CGroup: /system.slice/run-qemu.mount

Jan 24 17:18:51 j-vm systemd[1]: run-qemu.mount: Deactivated successfully.
Jan 24 17:18:51 j-vm systemd[1]: Unmounted Prepare /run/qemu to allow still running qemu binaries of former builds (after package upgrades) to fallback-load modules from there.
Jan 24 17:18:51 j-vm systemd[1]: Mounting Prepare /run/qemu to allow still running qemu binaries of former builds (after package upgrades) to fallback-load modules from there...
Jan 24 17:18:51 j-vm systemd[1]: Mounted Prepare /run/qemu to allow still running qemu binaries of former builds (after package upgrades) to fallback-load modules from there.
total 0
drwxr-xr-x 2 root root 40 Jan 24 17:18 ./
drwxr-xr-x 29 root root 840 Jan 24 17:13 ../

=> Broken

Mantic (mount unit, behaving as it should)

root@m-vm:~# apt install -y --reinstall qemu-block-extra; systemctl status run-qemu.mount; ls -laF /run/qemu/
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 113 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu mantic-updates/main amd64 qemu-block-extra amd64 1:8.0.4+dfsg-1ubuntu3.23.10.2 [113 kB]
Fetched 113 kB in 0s (774 kB/s)
(Reading database ... 67919 files and directories currently installed.)
Preparing to unpack .../qemu-block-extra_1%3a8.0.4+dfsg-1ubuntu3.23.10.2_amd64.deb ...
Unpacking qemu-block-extra (1:8.0.4+dfsg-1ubuntu3.23.10.2) over (1:8.0.4+dfsg-1ubuntu3.23.10.2) ...
Setting up qemu-block-extra (1:8.0.4+dfsg-1ubuntu3.23.10.2) ...
Scanning processes...
Scanning linux images...

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
● run-qemu.mount - Prepare /run/qemu to allow still running qemu binaries of former builds (after package upgrades) to fallback-load modules from there
     Loaded: loaded (/lib/systemd/system/run-qemu.mount; enabled; preset: enabled)
     Active: active (mounted) since Wed 2024-01-24 17:12:40 UTC; 6min ago
      Where: /run/qemu
       What: tmpfs
      Tasks: 0 (limit: 1095)
     Memory: 8.0K
        CPU: 2ms
     CGroup: /system.slice/run-qemu.mount

Jan 24 17:12:40 m-vm systemd[1]: Mounting run-qemu.mount - Prepare /run/qemu to allow still running qemu binaries of former builds (after package upgrades) to fallback-load modules from there...
Jan 24 17:12:40 m-vm systemd[1]: Mounted run-qemu.mount - Prepare /run/qemu to allow still running qemu binaries of former builds (after package upgrades) to fallback-load modules from there.
total 0
drwxr-xr-x 3 root root 60 Jan 24 17:18 ./
drwxr-xr-x 32 root root 900 Jan 24 17:12 ../
drwxr-xr-x 2 root root 180 Jan 24 17:18 Debian_1_8.0.4+dfsg-1ubuntu3.23.10.2/

=> Good

---

reproducing the issue is easy, just run:
  $ apt install -y --reinstall qemu-block-extra
The unit should stay as-is and the modules should be saved in the dir as shown above.

Task: find why this unit is restarted despite --no-restart-on-upgrade and prevent that.