Yu Watanabe
c21a49cd3d
core/swap: don't resurrect swap units whose device link disappeared ( #43443 )
...
Fixes #43442 .
A `.swap` unit can end up **active but unloadable, with no device**, and
stopping such a unit aborts PID 1.
### What it looks like
```
$ systemctl show 'dev-disk-byx2dpartlabel-primary.swap' -p LoadState,ActiveState,What
LoadState=not-found
ActiveState=active
What= # <-- no device
$ systemctl stop 'dev-disk-byx2dpartlabel-primary.swap'
systemd[1]: About to execute: /usr/sbin/swapoff # <-- no argument
systemd[1]: Caught <ABRT>, from our own process.
systemd[1]: Freezing execution.
```
PID 1 stays alive but frozen, so the machine stops answering `systemctl`
and never reboots.
### How it happens
1. systemd creates one `.swap` unit per udev device link of every device
in `/proc/swaps`.
2. A device link gets repointed at another device while the swap stays
on. `/proc/swaps` doesn't change, so nothing re-examines the unit — it
stays active.
3. The next `daemon-reload` drops all units and rebuilds them.
Enumeration from `/proc/swaps` no longer produces this name, so only the
deserialization brings the unit back: by name, with no fragment on disk.
4. `swap_load()` only calls `swap_add_extras()` for units that loaded a
fragment or are backed by `/proc/swaps`, so this one gets neither a
`What=` nor a patched `ExecContext`.
5. `swap_coldplug()` restores its active state anyway.
6. Shutdown stops it. `unit_stop()` deliberately permits stopping units
whose load failed, so it reaches `exec_spawn()` and trips the
`PrivateVarTmp=` assertion in `exec_context_serialize()`.
2026-09-04 04:11:29 +09:00
..
2025-12-07 09:09:03 +09:00
2024-05-08 12:27:24 +02:00
2025-11-04 15:53:23 +00:00
2025-07-13 05:49:00 +09:00
2026-06-20 01:41:46 +01:00
2026-08-26 11:32:51 +01:00
2026-08-14 16:00:49 +02:00
2024-05-14 12:43:28 +02:00
2026-08-14 16:00:49 +02:00
2025-11-07 21:35:45 +00:00
2025-08-01 05:42:51 +09:00
2026-08-14 16:00:49 +02:00
2026-08-14 16:00:49 +02:00
2026-07-16 01:52:39 +09:00
2026-06-23 12:41:38 +02:00
2026-07-07 09:45:03 +02:00
2026-08-14 16:00:49 +02:00
2026-05-04 14:30:03 +01:00
2026-08-14 16:00:49 +02:00
2024-07-31 16:29:07 +02:00
2026-08-14 16:00:49 +02:00
2026-05-12 23:38:52 +01:00
2026-04-02 22:58:19 +09:00
2026-02-22 15:13:02 +01:00
2026-08-03 14:29:07 +09:00
2026-08-14 16:00:49 +02:00
2026-02-19 15:08:20 +01:00
2026-04-14 20:35:24 +02:00
2025-09-23 15:48:53 +01:00
2025-12-07 09:09:03 +09:00
2025-12-07 09:09:03 +09:00
2024-07-10 18:52:29 +02:00
2025-12-18 00:19:09 +01:00
2025-12-07 09:09:03 +09:00
2026-06-29 12:06:33 +01:00
2024-05-14 12:43:28 +02:00
2025-12-07 09:09:03 +09:00
2024-08-29 14:16:43 +01:00
2025-01-07 11:35:03 +00:00
2026-03-11 18:09:27 +01:00
2025-09-23 15:48:53 +01:00
2025-09-04 10:58:33 +09:00
2025-06-21 02:22:28 +09:00
2026-08-14 16:00:49 +02:00
2026-08-13 09:58:53 +01:00
2026-08-14 16:00:49 +02:00
2024-05-14 12:43:28 +02:00
2025-07-24 20:55:10 +09:00
2025-09-23 15:48:53 +01:00
2025-12-07 09:09:03 +09:00
2025-09-26 07:20:04 +09:00
2026-05-05 11:53:01 +01:00
2026-07-29 11:17:14 +02:00
2024-12-10 19:31:18 +00:00
2026-05-11 10:59:00 +02:00
2024-12-31 00:22:53 +01:00
2026-05-19 22:53:59 +01:00
2025-10-28 13:26:15 +00:00
2026-04-14 20:35:24 +02:00
2026-01-06 03:26:15 -08:00
2026-06-20 01:41:46 +01:00
2025-09-23 15:48:53 +01:00
2026-06-05 04:39:00 +09:00
2026-05-21 18:06:07 +02:00
2024-05-22 12:42:09 +02:00
2024-08-05 15:13:38 +02:00
2026-06-20 01:41:46 +01:00
2026-07-16 14:31:32 +02:00
2026-04-14 20:35:24 +02:00
2026-08-26 11:45:35 +02:00
2026-07-23 13:19:11 +09:00
2026-08-14 16:00:49 +02:00
2026-08-14 16:00:49 +02:00
2026-08-14 16:00:49 +02:00
2026-01-18 14:14:24 +09:00
2025-12-07 09:09:03 +09:00
2025-04-05 17:33:31 +09:00
2025-11-17 16:50:50 +01:00
2026-07-10 16:09:34 +08:00
2026-01-14 16:32:38 +01:00
2026-02-15 12:51:00 +00:00
2026-06-20 01:41:46 +01:00
2026-08-14 16:00:49 +02:00
2026-07-10 16:05:24 +08:00
2026-05-20 11:39:11 +02:00
2026-08-25 06:05:37 -07:00
2026-01-14 16:32:38 +01:00
2026-01-14 16:32:38 +01:00
2026-08-14 16:00:49 +02:00
2026-01-14 16:32:38 +01:00
2025-04-05 17:33:31 +09:00
2026-06-20 01:41:46 +01:00
2026-05-28 02:08:24 +09:00
2026-07-13 12:18:49 +08:00
2026-08-14 16:00:49 +02:00
2026-08-02 19:16:19 +09:00
2025-04-05 17:33:31 +09:00
2025-04-05 17:33:31 +09:00
2025-04-03 10:28:25 +09:00
2025-12-10 12:09:10 +01:00
2025-12-10 12:09:10 +01:00
2026-02-11 11:24:37 +01:00
2026-01-14 16:32:38 +01:00
2024-05-14 12:43:28 +02:00
2026-08-14 16:00:49 +02:00
2024-05-14 12:43:28 +02:00
2026-08-14 16:00:49 +02:00
2026-08-28 06:26:09 +09:00
2026-08-14 16:00:49 +02:00
2026-08-14 16:00:49 +02:00
2026-08-14 16:00:49 +02:00
2025-09-05 08:29:52 +02:00
2026-07-29 15:29:54 +08:00
2026-07-23 19:33:08 +08:00
2025-09-23 15:48:53 +01:00
2025-09-23 15:48:53 +01:00
2024-05-14 12:43:28 +02:00
2024-05-14 12:43:28 +02:00
2026-07-30 13:45:52 +08:00
2025-09-23 15:48:53 +01:00
2025-09-23 15:48:53 +01:00
2026-07-29 03:47:58 +09:00
2025-09-23 15:48:53 +01:00
2025-09-23 15:48:53 +01:00
2026-08-14 16:00:49 +02:00
2026-09-01 03:03:46 +09:00
2025-09-26 07:20:04 +09:00
2025-11-17 16:50:50 +01:00
2025-09-26 07:20:04 +09:00
2025-09-26 07:20:04 +09:00
2025-09-26 07:20:04 +09:00
2024-08-29 12:48:55 +01:00
2026-08-14 16:00:49 +02:00
2025-12-07 09:09:03 +09:00
2025-05-29 05:41:29 +09:00
2026-06-20 01:41:46 +01:00
2025-09-26 07:20:04 +09:00
2025-09-26 07:20:04 +09:00
2026-08-14 16:00:49 +02:00
2026-05-22 14:09:16 +01:00
2026-08-22 11:31:55 +09:00
2026-05-20 16:11:45 +02:00
2026-07-16 10:03:19 +08:00
2026-07-15 16:30:15 +08:00
2026-01-14 16:32:38 +01:00
2026-08-14 16:00:49 +02:00
2026-06-20 01:41:46 +01:00
2026-06-20 01:41:46 +01:00
2026-06-28 13:40:07 +09:00
2025-09-26 07:20:04 +09:00
2025-12-10 12:09:10 +01:00
2026-07-16 01:26:46 +09:00
2026-08-19 02:29:39 +09:00
2026-08-27 04:54:38 +09:00
2025-09-23 15:48:53 +01:00
2026-07-18 15:53:00 +08:00
2025-12-18 09:12:54 +01:00
2026-08-14 16:00:49 +02:00
2026-06-16 00:16:05 +01:00
2026-07-15 21:13:24 +01:00
2026-07-24 01:54:40 +09:00
2026-01-30 09:30:20 -05:00
2026-05-05 17:22:26 +02:00
2026-01-30 09:30:20 -05:00
2026-05-11 10:57:46 +02:00
2026-08-14 16:00:49 +02:00
2026-07-18 15:53:00 +08:00
2026-08-24 01:33:20 +09:00
2026-08-28 11:16:29 +02:00
2025-12-10 12:09:10 +01:00
2026-06-01 11:48:19 +02:00
2025-12-10 12:09:10 +01:00
2025-11-17 16:50:50 +01:00
2026-06-30 16:24:06 +01:00
2026-08-12 03:54:33 -07:00
2025-09-26 07:20:04 +09:00
2026-05-18 02:44:46 +09:00
2026-05-03 18:08:33 +01:00
2026-08-14 16:00:49 +02:00
2026-08-14 16:00:49 +02:00
2026-07-10 08:07:47 +02:00
2026-08-14 16:00:49 +02:00
2026-08-14 16:00:49 +02:00
2026-08-14 16:00:49 +02:00
2026-08-14 16:00:49 +02:00
2026-08-20 15:30:20 +02:00
2026-08-14 16:00:49 +02:00
2026-08-14 16:00:49 +02:00
2026-08-23 14:10:22 +01:00
2026-08-26 19:51:31 +01:00
2025-06-23 15:32:11 +02:00
2026-06-13 09:39:28 +01:00
2024-05-14 12:43:28 +02:00
2026-06-03 14:02:44 +01:00
2024-05-14 12:43:28 +02:00
2024-05-14 12:43:28 +02:00
2025-09-23 15:48:53 +01:00
2025-01-24 08:37:51 +01:00
2026-07-26 13:20:55 +09:00
2026-08-14 16:00:49 +02:00
2026-07-17 11:09:34 +08:00
2026-08-14 16:00:49 +02:00
2026-08-28 14:50:10 +02:00
2026-08-14 16:00:49 +02:00
2026-07-24 14:10:30 +09:00
2026-08-14 16:00:49 +02:00
2025-02-18 13:49:24 +01:00
2026-08-14 16:00:49 +02:00
2025-11-17 16:50:50 +01:00
2025-07-23 22:11:42 +09:00
2026-04-20 15:01:17 +01:00
2026-08-24 23:56:06 +02:00
2026-08-12 03:11:02 +09:00
2026-08-14 16:00:49 +02:00
2026-08-14 16:00:49 +02:00
2026-03-20 09:37:24 +01:00
2026-08-14 16:00:49 +02:00
2026-08-14 16:00:49 +02:00
2026-07-29 03:47:58 +09:00
2026-08-14 16:00:49 +02:00
2026-08-14 16:00:49 +02:00
2026-05-19 11:05:55 +02:00
2026-07-25 15:35:28 +09:00
2026-06-20 01:41:46 +01:00
2025-09-23 15:48:53 +01:00
2026-09-02 10:41:54 +02:00
2026-06-20 01:41:46 +01:00
2026-08-05 17:31:03 -07:00
2024-05-14 12:43:28 +02:00
2025-09-18 20:22:42 +02:00
2026-08-14 11:59:58 +02:00
2025-09-23 15:48:53 +01:00
2026-08-14 16:00:49 +02:00
2024-05-14 12:43:28 +02:00
2026-05-21 16:02:43 +01:00
2026-08-14 16:00:49 +02:00
2026-08-14 16:00:49 +02:00
2026-08-27 05:54:17 +09:00
2025-01-24 08:37:51 +01:00
2025-11-07 14:12:56 +01:00
2026-02-06 18:19:33 +01:00
2026-05-05 17:22:26 +02:00
2026-08-14 16:00:49 +02:00
2025-09-04 02:05:09 +09:00
2026-04-29 12:26:52 +02:00
2026-08-21 00:48:25 +09:00
2026-08-14 16:00:49 +02:00
2025-12-10 12:09:10 +01:00
2026-08-14 16:00:49 +02:00
2026-08-14 16:00:49 +02:00
2026-07-30 09:13:35 +01:00
2026-08-01 03:54:58 +09:00
2026-08-31 23:33:40 +02:00
2026-08-14 16:00:49 +02:00
2026-08-31 23:33:40 +02:00
2026-08-14 16:00:49 +02:00
2026-06-30 10:21:18 +01:00
2026-07-31 11:06:30 +09:00
2026-07-10 14:01:24 +02:00
2026-08-12 15:57:07 +02:00
2026-08-14 16:00:49 +02:00
2026-08-14 16:00:49 +02:00