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

update-grub doesn't include pool in root=ZFS=<pool>/root #9562

Closed
nielslaukens opened this issue Nov 7, 2019 · 6 comments
Closed

update-grub doesn't include pool in root=ZFS=<pool>/root #9562

nielslaukens opened this issue Nov 7, 2019 · 6 comments
Labels
Component: GRUB GRUB integration

Comments

@nielslaukens
Copy link

Hi,

First of all, thank you for making ZFS available on Linux. I really appreciate all the time and effort you all are putting into it.

I've been trying to set up Debian Buster to have its root filesystem on ZFS (/boot still regular ext2), but ran into problems regarding GRUB: the generated grub.cfg is missing the pool-name:

[...]
    linux	/vmlinuz-4.19.0-6-amd64 root=ZFS=/root ro
[...]

instead of the expected

[...]
    linux	/vmlinuz-4.19.0-6-amd64 root=ZFS=tank/root ro
[...]

There are lots of similar open issues, but I haven't found any that actually solves the root cause:

System information

Type Version/Name
Distribution Name Debian
Distribution Version Buster (10)
Linux Kernel 4.19.67-2+deb10u1
Architecture amd64
ZFS Version 0.7.12-2+deb10u1
SPL Version 0.7.12-2
Grub Version 2.02+dfsg1-20

Steps to reproduce

The GRUB config file is created by scripts in /etc/grub.d, in particular 10_linux. Relevant code is in lines 81-85:

rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs%/}"

The issue is triggered in the first line above.

I've created the Root ZFS pool by following the Wiki step 2a and 3, slightly modified for my disk layout:

zpool create -o ashift=12 \
    -O acltype=posixacl -O canmount=off -O compression=lz4 \
    -O dnodesize=auto -O normalization=formD -O relatime=on -O xattr=sa \
    -O mountpoint=/ -R /mnt tank /dev/sda2

grub-probe --device /dev/sda2 --target=fs_label  # still works now

zfs create -o canmount=noauto -o mountpoint=/ tank/root

grub-probe --device /dev/sda2 --target=fs_label  # fails with:
# grub-probe: error: unknown filesystem.

The problem seem to be that GRUB doesn't support feature@large_dnode (and thus the -O dnodesize=auto). If I change the zpool create to include -o feature@large_dnode=disabled and omit the -O dnodesize=auto, GRUB keeps recognizing the ZFS label, and everything works as expected.

I know that other issues have been closed and moved to the grub-repo, but since the source of the issue seems to be the instructions in the Wiki, I opened this issue on this repo anyway. I have no idea why the wiki suggests the dnodesize=auto option, but if it's not critical that it is set, I'd suggest changing the Wiki instructions to remain GRUB-compatible. Or at least add a warning that this particular feature breaks GRUB (at least the current version)

@PrivatePuffin
Copy link
Contributor

PrivatePuffin commented Nov 13, 2019

Did you look into how the proxmox installer handles this?

Did you try this fix:
zfsonlinux/grub#22 (comment)

I think this is user error, the above problem has already been accounted for in step 5.3 and this user did not follow the guide. His commands in NO WAY follow the steps from 2a and 3 of the guide.

The error gets thrown executing commands that are not a part of the setup proces from the guide.

5.3 also includes a fix for zfsonlinux/grub#22 (comment)
if you want you can try that fix, or try again and follow the guide this time.

@behlendorf behlendorf added the Component: GRUB GRUB integration label Nov 13, 2019
@nielslaukens
Copy link
Author

Hi,

No, I did not look into how Proxmox handles this, since I don't use nor have Proxmox.

The comment you point to zfsonlinux/grub#22 (comment) also solves this issue, but I consider this to be a workaround at best, not a solution.

Indeed, I did not follow the guide to the letter, since the guide does not describe the solution I want to achieve. So I cherry-picked the parts that were relevant for my situation, and that didn't work. So I figured out what I thought was the root cause, and reported it here to help other people with the same problem.

I'm sorry I've invested my time to write up this issue.

@PrivatePuffin
Copy link
Contributor

PrivatePuffin commented Nov 14, 2019

The proxmox thing was my first guess, because proxmox already did what you tried to do. Distro's are not that different in the end.

"The comment you point to zfsonlinux/grub#22 (comment) also solves this issue, but I consider this to be a workaround at best, not a solution."
For people following the guide, a solution is put forward: its 5.3. That should also fix the issue of these workarounds not being documented.

"Indeed, I did not follow the guide to the letter, since the guide does not describe the solution I want to achieve"
The reason I, I hindsight, seemed overly snappy about that, was because there actually is a solution in the guide. Making an issue insinuating you followed the guide, means it also costs me time to figure out it had nothing to do with the guide in the end.

But i'm glad it solved your issue.
If you like an easier solution in the future you could try doing stop 5.3 in the guide.

@PrivatePuffin
Copy link
Contributor

PrivatePuffin commented Nov 14, 2019

@kpande I never wanted to state the underlaying issue is fixed, I reread my own words and It might come sound that way. I edited the previous comment to make that a little more clear, thanks for noticing.

This issue was primarily about the fix not being documented and seemed to blame the guide. With
"Fixed" I meant to say that the issue of the fix not being documented is fixed, not the underlaying issue with grub (which has been ignored a long time by now).

I was only trying to be helpfull here and actually did do the required research. I like to sincerely request you stop your repeated agressive attitude towards me from now on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: GRUB GRUB integration
Projects
None yet
Development

No branches or pull requests

4 participants
@behlendorf @nielslaukens @PrivatePuffin and others