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

Initramfs zfs script error when pool previously imported #16176

Open
jose-pr opened this issue May 8, 2024 · 0 comments
Open

Initramfs zfs script error when pool previously imported #16176

jose-pr opened this issue May 8, 2024 · 0 comments
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@jose-pr
Copy link

jose-pr commented May 8, 2024

Describe the problem you're observing

When you run zfs with initramfs and have a previous script import the pool, in my case to unlock it with a custom method to get the key, initramfs will drop you in a shell as the the zfs mountscripts doens't doesnt update POOL_IMPORTED

Describe how to reproduce the problem

Have a scripts in initramfs that call import on the root pool, before or during local.premount

zpool import -N rpool

Problem seem to happen here:
https://github.com/openzfs/zfs/blob/04bae5ec95f7273105237159a882d5b72ec2b998/contrib/initramfs/scripts/zfs#L197C1-L198C1

	"${ZPOOL}" get -H -o value name,guid 2>/dev/null | grep -Fxq "$pool" && return 0

Where it knows pool is imported but return without setting POOL_IMPORTED
and then it goes to find the find_rootfs and errors out.

Would suggest something along the lines of:

if "${ZPOOL}" get -H -o value name,guid 2>/dev/null | grep -Fxq "$pool"; then
  POOL_IMPORTED=1
  return 0
fi
@jose-pr jose-pr added the Type: Defect Incorrect behavior (e.g. crash, hang) label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

No branches or pull requests

1 participant