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
36 lines
1.3 KiB
Desktop File
36 lines
1.3 KiB
Desktop File
# Copyright (C) 2018 Red Hat, Inc.
|
|
# Copyright (C) 2022 Endless OS Foundation LLC
|
|
#
|
|
# This library is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
# License as published by the Free Software Foundation; either
|
|
# version 2 of the License, or (at your option) any later version.
|
|
#
|
|
# This library is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
# Lesser General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
# License along with this library. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
# See https://github.com/ostreedev/ostree/pull/2543 for background.
|
|
[Unit]
|
|
Description=Hold /boot Open for OSTree Finalize Staged Deployment
|
|
Documentation=man:ostree(1)
|
|
ConditionPathExists=/run/ostree-booted
|
|
DefaultDependencies=no
|
|
|
|
RequiresMountsFor=/sysroot /boot
|
|
After=local-fs.target
|
|
Before=basic.target final.target
|
|
|
|
[Service]
|
|
Type=exec
|
|
|
|
# This is explicitly run in the root namespace to ensure an automounted
|
|
# /boot doesn't time out since autofs doesn't handle mount namespaces.
|
|
#
|
|
# https://bugzilla.redhat.com/show_bug.cgi?id=2056090
|
|
ExecStart=+/usr/bin/ostree admin finalize-staged --hold
|