pub(crate) fn hold_boot() -> Result<()>Expand description
Keep /boot open until we’re killed, which systemd does with SIGTERM
when bootc-finalize-staged-hold.service is stopped after
bootc-finalize-staged.service.
When /boot is an automount (e.g. the ESP set up by systemd-gpt-auto-generator), an idle expire breaks finalization in two ways. If it races with shutdown, it deadlocks: the finalization (which looks up /boot) blocks on the expire, while the unmount is ordered after the finalization. If it completes before shutdown, systemd won’t remount /boot once shutdown has begun, so finalization fails to open it (EHOSTDOWN) and the old deployment boots. An open file descriptor makes autofs treat the mount as busy, so it never expires. Note this only works from the root mount namespace.