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

Unconditionally run zpool export -a / revert systemd-shutdown implementation #2077

Merged
merged 3 commits into from
Sep 10, 2024

Conversation

ogayot
Copy link
Member

@ogayot ogayot commented Sep 9, 2024

storage: export zpools unconditionally

In the _pre_shutdown function, we used to invoke zpool export -a if we found the presence of a zpool in the storage model.

That being said, zpools can be implicitly declared by users using {"type": "format", "fstype": "zfsroot"} in the curtin actions. This is valid curtin configuration and unfortunately causes Subiquity to think that there is no zpool.

When that happened, Subiquity did not invoke zpool export -a and therefore the target system couldn't boot without a call to zpool import -f.

We now do the call to zpool export -a unconditionally. Running this command when there is no zpool is a noop so it should not be a problem.

In theory there is a risk that we could export a zpool that was not meant for exporting. However, that would involve somebody importing (or force importing) a zpool in the live installer environment and not wanting it exported at the end. This sounds like an very unlikely use case. Furthermore, this could already be a problem today since we invoke zpool export with the -a option (which exports all zpools imported on the system).

LP:#2073772

We decided to revert the use of systemd-shutdown for exporting zpools
because it didn't address the issue we were trying to solve. However,
dropping scripts for systemd-shutdown is an interesting implementation
from an architecture standpoint, because it can be executed even if
Subiquity does not cleanly exit.

Let's document the _pre_shutdown function and link to the original
systemd-shutdown implementation that we came up with for exporting
zpools earlier.

Signed-off-by: Olivier Gayot <[email protected]>
In the _pre_shutdown function, we used to invoke `zpool export -a` if we
found the presence of a zpool in the storage model.

That being said, zpools can be implicitly declared by users using
{"type": "format", "fstype": "zfsroot"} in the curtin actions. This is
valid curtin configuration and unfortunately causes Subiquity to think
that there is no zpool.

When that happened, Subiquity did not invoke `zpool export -a` and
therefore the target system couldn't boot without a call to `zpool
import -f`.

We now do the call to `zpool export -a` unconditionally. Running this
command when there is no zpool is a noop so it should not be a problem.

In theory there is a risk that we could export a zpool that was not
meant for exporting. However, that would involve somebody importing (or
force importing) a zpool in the live installer environment and not
wanting it exported at the end. This sounds like an very unlikely use
case. Furthermore, this could already be a problem today since we invoke
`zpool export` with the `-a` option (which all pools imported on the
system).

LP: #2073772

Signed-off-by: Olivier Gayot <[email protected]>
@ogayot ogayot merged commit ccca128 into canonical:main Sep 10, 2024
12 checks passed
@ogayot ogayot deleted the zpool-export-always branch September 10, 2024 07:37
@dbungert
Copy link
Collaborator

So, zfsutils-linux is not installed by default, which means zpool may not be in PATH.

@ogayot
Copy link
Member Author

ogayot commented Sep 11, 2024

So, zfsutils-linux is not installed by default, which means zpool may not be in PATH.

Oops, my bad! #2080

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.

2 participants