summaryrefslogtreecommitdiff
path: root/src/boot/ostree-finalize-staged.service
diff options
context:
space:
mode:
authorDan Nicholson <dbn@endlessos.org>2022-02-16 15:58:58 -0700
committerDan Nicholson <dbn@endlessos.org>2022-08-30 09:16:39 -0600
commitf3db79e7fa8d469e539b60ceb7e3d790747e530f (patch)
tree58bb4b8909f9dda92ef19a3aa4a668d00ba8cc84 /src/boot/ostree-finalize-staged.service
parente30a3b6b17c89f55c33e7985d11ccae7eb173507 (diff)
downloadostree-f3db79e7fa8d469e539b60ceb7e3d790747e530f.tar.gz
finalize-staged: Ensure /boot automount doesn't expire
If `/boot` is an automount, then the unit will be stopped as soon as the automount expires. That's would defeat the purpose of using systemd to delay finalizing the deployment until shutdown. This is not uncommon as `systemd-gpt-auto-generator` will create an automount unit for `/boot` when it's the EFI System Partition and there's no fstab entry. To ensure that systemd doesn't stop the service early when the `/boot` automount expires, introduce a new unit that holds `/boot` open until it's sent `SIGTERM`. This uses a new `--hold` option for `finalize-staged` that loads but doesn't lock the sysroot. A separate unit is used since we want the process to remain active throughout the finalization run in `ExecStop`. That wouldn't work if it was specified in `ExecStart` in the same unit since it would be killed before the `ExecStop` action was run. Fixes: #2543
Diffstat (limited to 'src/boot/ostree-finalize-staged.service')
-rw-r--r--src/boot/ostree-finalize-staged.service5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/boot/ostree-finalize-staged.service b/src/boot/ostree-finalize-staged.service
index 2f28bbb7..63621ce1 100644
--- a/src/boot/ostree-finalize-staged.service
+++ b/src/boot/ostree-finalize-staged.service
@@ -29,6 +29,11 @@ Before=basic.target final.target
After=systemd-journal-flush.service
Conflicts=final.target
+# Start the hold unit and ensure it stays active throughout this
+# service.
+Wants=ostree-finalize-staged-hold.service
+After=ostree-finalize-staged-hold.service
+
[Service]
Type=oneshot
RemainAfterExit=yes