Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage: lean on systemd-shutdown to export zpools on shutdown #2064

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

ogayot
Copy link
Member

@ogayot ogayot commented Aug 23, 2024

People have reported issues involving non exported zpools at the end of Ubuntu installations. Diagnosing such issues is tricky because the zpool export commands have to run after the target is unmounted. And once the target is unmounted, logs can no longer be copied over to the target so bug reports don't include traces of potential zpool export failures (or failures to unmount target).

Instead of relying on Subiquity's _pre_shutdown hook, we now make use of systemd-shutdown to export the zpools. The chance of successfully exporting the zpools is expected to be higher since it will happen later in the shutdown sequence ; after more mounts have been detached.

This is an attempt to fix LP:#2073772 but since I never reproduced the issue, I can't tell if that would actually fix it.

People have reported issues involving non exported zpools at the end of
Ubuntu installations. Diagnosing such issues is tricky because the
`zpool export` commands have to run after the target is unmounted. And
once the target is unmounted, logs can no longer be copied over to the
target so bug reports don't include traces of potential `zpool export`
failures (or failures to unmount target).

Instead of relying on Subiquity's _pre_shutdown hook, we now make use of
systemd-shutdown to export the zpools. The chance of successfully
exporting the zpools is expected to be higher since it will happen later
in the shutdown sequence ; after more mounts have been detached.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
@ogayot ogayot requested a review from dbungert August 26, 2024 12:06
if not cmds:
return

shutdown_dir = root / "usr/lib/systemd/system-shutdown"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: in etc instead? I think this only matters though if the install environment /usr is RO, which is well outside our assumptions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, /etc (or even /run - which I wanted initially) feels cleaner but systemd-shutdown only supports /usr it seems.

@ogayot ogayot merged commit f5c04a7 into canonical:main Aug 27, 2024
12 checks passed
@ogayot ogayot deleted the systemd-shutdown branch August 27, 2024 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants