recovery-chooser-trigger.service: Survive the switch root#64
Conversation
anonymouse64
left a comment
There was a problem hiding this comment.
thanks for this change, can you clarify what the order of release should be? if this change was included in the initramfs today without the signal handling you mention are there any side-effects? do we need to do that signal handling before this change can be released/included in kernel snaps?
...ory/usr/lib/systemd/system/snapd.recovery-chooser-trigger.service.d/survive-switch-root.conf
Show resolved
Hide resolved
anonymouse64
left a comment
There was a problem hiding this comment.
as clarified on mattermost since this does not need the signal handling added to the recovery chooser trigger (it would merely be an improvement), this looks good to me
The side effect is only memory not released right away. We do not need change in Also note that this PR will only do something after #58. So maybe we can wait for #58 to be merged. Potentially without #58, we could have 2 runs of recovery-chooser-trigger in the same time. Though it should not be a problem, but I have not tested that. |
In general I think it's actually better to do the inverse - land as much as possible changes that do nothing, then turn them on with a simple PR at the end. So I think we should land this before the stateful re-exec in #58 (and also I think we should do the stateful re-exec change as part of #59 too unless there's a compelling reason not to) |
OK, I have tested manually the change and it does not seem to break. Do I need to trigger snapd spread tests for just that change? |
|
FTR, this is how plymouth changes its working folder after the switch root: |
b6fae14 to
9cd5471
Compare
`snap-bootstrap recovery-chooser-trigger` is only expected to use `/run` so it can safely survive the switch root. When using stateful re-execution of systemd, this will keep the same service started from initramfs and continue into the main boot. Because we need to pull it into `initrd-switch-root.target`, we also need to remove default dependencies so that we do not indirectly pull `sysinit.target` or `local-fs.target` into `initrd-switch-root.target`. Note, we should probably add a signal handler in `snap-bootstrap recovery-chooser-trigger` to be notified when `initrd-root-fs.target` is reached to `chdir` into `/sysroot` so that we do not drag the old initramfs in memory until it is stopped. This is because systemd will lazily umount the old root.
9cd5471 to
2fb3b70
Compare
core-initrd for UC20 is missing the following fixes: * canonical/core-initrd#64 * canonical/core-initrd#70 * canonical/core-initrd#97 Because of that, it still kills recovery-chooser-trigger from initrd, and expects it to re-run from snapd snap. Until those fixes are backported, we need to keep on building snap-bootstrap. This is not needed by UC22+
core-initrd for UC20 is missing the following fixes: * canonical/core-initrd#64 * canonical/core-initrd#70 * canonical/core-initrd#97 Because of that, it still kills recovery-chooser-trigger from initrd, and expects it to re-run from snapd snap. Until those fixes are backported, we need to keep on building snap-bootstrap. This is not needed by UC22+
snap-bootstrap recovery-chooser-triggeris only expected to use/runso it can safely survive the switch root.When using stateful re-execution of systemd, this will keep the same
service started from initramfs and continue into the main boot.
Because we need to pull it into
initrd-switch-root.target, we alsoneed to remove default dependencies so that we do not indirectly pull
sysinit.targetorlocal-fs.targetintoinitrd-switch-root.target.Note, we should probably add a signal handler in
snap-bootstrap recovery-chooser-triggerto be notified wheninitrd-root-fs.targetis reached to
chdirinto/sysrootso that we do not drag the oldinitramfs in memory until it is stopped. This is because systemd will
lazily umount the old root.