Shutdown when triggering daemon-reload early in boot
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
systemd (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Focal |
Fix Released
|
High
|
Nick Rosbrook | ||
Jammy |
Fix Released
|
High
|
Nick Rosbrook |
Bug Description
In Ubuntu Core 20, and Ubuntu Core 22, we are encountering an issue where if a service, started earlier than devices are processed by udev, does `systemctl daemon-reload`, the system shuts down. This is due to devices for mounted filesystem temporarily taken dead, which pulls most units down.
This was fixed by upstream in https:/
But this was not backported to the versions used by Ubuntu packages for focal and jammy. The needed commit from that PR is the one with message `core/device: ignore DEVICE_FOUND_UDEV bit on switching root`.
This patch applies to 245.4-4ubuntu3.22 (focal) without rebasing needed. And I suppose it does also for jammy.
I have manually tested the fix with Ubuntu Core 20, and this fixes our issue.
We would like this patch to be backported to focal-updates and jammy-updates.
Thank you in advance.
[ Impact ]
If a user adds a service that calls `systemctl daemon-reload`, and if this service is started before systemd-udevd. And if the initrd is systemd (the case of Ubuntu Core), then most service will be stopped or cancel, and the machine will mostly shutdown everything and hang.
The fix has been backported down to 250 upstream. It is already on kinetic and later.
The fix only affects systems where systemd is used in initrd.
[ Test Plan ]
On Ubuntu Core 20 (with Core 22 kernel) or on Ubuntu Core 22. Or on any system that uses systemd in initrd.
Add a systemd service that calls `systemctl daemon-reload`.
The service should have `DefaultDepende
Restart the machine.
If fix is not applied, after the service is started, most of units with be shutdown, and the system will be unusable.
[ Where problems could occur ]
This should affect systems with systemd in initrd.
There are risks on systems that have an udev rule in initrd not present in the main system.
There are risks on systems that use db_persist in initrd where the device can potentially get dead state. Though this does not seem to happen on Ubuntu Core 22, even though we use db_persist for dev mapper devices. Regression is upstream bug #23429. Commits named "core/device: device_coldplug(): don't set DEVICE_DEAD" and "core/device: do not downgrade device state if it is already enumerated" could be applied as well.
Related branches
- Lukas Märdian: Approve
-
Diff: 391 lines (+345/-0)7 files modifieddebian/changelog (+24/-0)
debian/patches/lp1837227-core-mount-adjust-deserialized-state-based-on-proc-self-m.patch (+119/-0)
debian/patches/lp1969365-Fall-back-to-kexec-when-no-kexec-binary-exists.patch (+28/-0)
debian/patches/lp2024009-dns-query-bump-CNAME_MAX-to-16.patch (+24/-0)
debian/patches/lp2029352-test-ignore-LXC-filesystem-when-checking-for-writable-loc.patch (+29/-0)
debian/patches/lp2037281-core-device-ignore-DEVICE_FOUND_UDEV-bit-on-switching-roo.patch (+116/-0)
debian/patches/series (+5/-0)
- Lukas Märdian: Approve
-
Diff: 472 lines (+303/-25)5 files modifieddebian/changelog (+16/-0)
debian/patches/debian/UBUNTU-Support-system-image-read-only-etc.patch (+164/-25)
debian/patches/lp2037281-core-device-ignore-DEVICE_FOUND_UDEV-bit-on-switching-roo.patch (+116/-0)
debian/patches/series (+1/-0)
debian/tests/upstream (+6/-0)
Changed in systemd (Ubuntu Focal): | |
importance: | Undecided → High |
Changed in systemd (Ubuntu Jammy): | |
importance: | Undecided → High |
Changed in systemd (Ubuntu): | |
status: | New → Fix Released |
tags: | added: systemd-sru-next |
tags: | added: foundations-todo |
Changed in systemd (Ubuntu Focal): | |
assignee: | nobody → Nick Rosbrook (enr0n) |
Changed in systemd (Ubuntu Jammy): | |
assignee: | nobody → Nick Rosbrook (enr0n) |
description: | updated |
description: | updated |
Changed in systemd (Ubuntu): | |
importance: | Undecided → Critical |
importance: | Critical → High |
importance: | High → Undecided |
summary: |
- Shutdown when triggering daemon-reload eary in boot + Shutdown when triggering daemon-reload early in boot |
Just adding a comment on how to reproduce the bug, because I have lost a day trying to figure it out again. This fails only when not using secure boot because the device mapper state is kept from initrd to main boot.