run-qemu.mount is restarted on upgrades
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
qemu (Ubuntu) | Status tracked in Noble | |||||
Focal |
Invalid
|
Undecided
|
Unassigned | |||
Jammy |
Fix Released
|
Undecided
|
Christian Ehrhardt | |||
Mantic |
Invalid
|
Undecided
|
Unassigned | |||
Noble |
Invalid
|
Undecided
|
Unassigned |
Bug Description
[ Impact ]
* Due to dh_installsystemd handling mount units not correctly
in jammy one is restarted on updates breaking the use case
and potentially crashing binaries with shared objects loaded
from that path
* The fix removed the offending restart (in a minimal fashion) as we handle enable+start ourselves already anyway. We could remove more, but this is the smallest change and therefore more reviewable and maintainable.
[ Test Plan ]
* apt install -y --reinstall qemu-block-extra; systemctl status run-qemu.mount; ls -laF /run/qemu/
* bad case, mount unit got restarted, empty dir
* good case, unit still up from before, content in the path
Example of the good case:
● 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/
Active: active (mounted) since Fri 2024-01-26 13:30:56 UTC; 2 days ago
Where: /run/qemu
What: tmpfs
Tasks: 0 (limit: 1171)
Memory: 8.0K
CPU: 2ms
CGroup: /system.
Jan 26 13:30:56 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 26 13:30:56 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 3 root root 60 Jan 29 13:27 ./
drwxr-xr-x 29 root root 920 Jan 29 07:00 ../
drwxr-xr-x 2 root root 140 Jan 29 13:27 Debian_
[ Where problems could occur ]
* This exclusively changes the mount unit handling which currently is useless by being restarted, no chance to regress that
* The other chance is to replace other lines by accident, which would be seen in services not starting (diff of postinst looked good in regard to that not happening)
[ Other Info ]
* We could try to backport changes to dh, but that is way more complex, and would impose much bigger regression risk impacting many other packages as they are rebuilt. Hence I'd avoid that post-release and fix them one by one as proposed here-
----
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-
- 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-
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_
-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://
Fetched 68.1 kB in 0s (565 kB/s)
(Reading database ... 72988 files and directories currently installed.)
Preparing to unpack .../qemu-
Unpacking qemu-block-extra (1:6.2+
Setting up qemu-block-extra (1:6.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 (/proc/
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.
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://
Fetched 113 kB in 0s (774 kB/s)
(Reading database ... 67919 files and directories currently installed.)
Preparing to unpack .../qemu-
Unpacking qemu-block-extra (1:8.0.
Setting up qemu-block-extra (1:8.0.
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/
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.
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_
=> 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-
Related branches
- git-ubuntu bot: Approve
- Sergio Durigan Junior (community): Approve
- Canonical Server Reporter: Pending requested
-
Diff: 30 lines (+11/-0)2 files modifieddebian/changelog (+7/-0)
debian/rules (+4/-0)
Changed in qemu (Ubuntu Focal): | |
status: | New → Invalid |
Changed in qemu (Ubuntu Mantic): | |
status: | New → Invalid |
Changed in qemu (Ubuntu Noble): | |
status: | New → Invalid |
Changed in qemu (Ubuntu Jammy): | |
status: | New → Confirmed |
description: | updated |
description: | updated |
tags: | added: server-todo |
Changed in qemu (Ubuntu Jammy): | |
assignee: | nobody → Christian Ehrhardt (paelzer) |
Code is similar behavior is not
Jammy: /git.launchpad. net/ubuntu/ +source/ qemu/tree/ debian/ rules?h= ubuntu/ jammy-updates# n179 /git.launchpad. net/ubuntu/ +source/ qemu/tree/ debian/ rules?h= ubuntu/ jammy-updates# n432
https:/
https:/
Mantic: /git.launchpad. net/ubuntu/ +source/ qemu/tree/ debian/ rules?h= ubuntu/ mantic- updates# n295 /git.launchpad. net/ubuntu/ +source/ qemu/tree/ debian/ rules?h= ubuntu/ mantic- updates# n475
https:/
https:/
This might or might not be related to similar issues with .socket units. /bugs.launchpad .net/ubuntu/ +source/ debhelper/ +bug/1959054
That was back in https:/
This is a huge topic, but a good study on the underlying mechanisms if you follow all the links and discussions from there.