- Package:
- grub-common
- Source:
- grub2
- Description:
- GRand Unified Bootloader (common files)
- Submitter:
- Christoph Anton Mitterer
- Date:
- 2021-03-25 15:33:11 UTC
- Severity:
- important
Hi. That's basically a follor-up or at least related to #803624. When the root-fs is on a btrfs subvolume (and perhaps in other cases as well), 10_linux adds a rootflags= to the kernel parameters, not merging any possibly already set such option in GRUB_CMDLINE_LINUX_DEFAULT or GRUB_CMDLINE_LINUX. Now coming back to my degraded-RAID-should-still-boot scenario from #803624, even when I manually set GRUB_CMDLINE_LINUX=rootflags=degraded things won't work (and the boot fails when a disk is e.g. missing). It results in a grub.cfg line like: linux /root/boot/vmlinuz-4.2.0-1-amd64 root=UUID=d430d7ee-8059-11e5-9834-502690aa641f ro rootflags=subvol=root rootflags=degraded and apparently the 2nd rootflags= is simply ignored. When I manually change the line to: linux /root/boot/vmlinuz-4.2.0-1-amd64 root=UUID=d430d7ee-8059-11e5-9834-502690aa641f ro rootflags=subvol=root,degraded everything works (even though I don't know what would happen if there was a subvolume named "root,degraded", so perhaps one needs some quoting in that case?). Any ideas? Cheers, Chris.
> It results in a grub.cfg line like: > linux /root/boot/vmlinuz-4.2.0-1-amd64 root=UUID=d430d7ee-8059-11e5-9834-502690aa641f ro rootflags=subvol=root rootflags=degraded > and apparently the 2nd rootflags= is simply ignored. My tests shows that first "rootflags" is ignored, and the second one matters: root@pegaz# cat /boot/grub/grub.cfg | egrep subvol | head -n1 linux /pegaz/boot/vmlinuz-4.19.0-14-amd64 root=UUID=ea6ae51d-d9b0-4628-a8f3-3406e1dc59c6 ro rootflags=subvol=pegaz rootflags=space_cache=v2 quiet This one is iginored: rootflags=subvol=pegaz and this one takes effect: rootflags=space_cache=v2 so default subvolume is mounted instead of "pegaz" subvolume. This is severe and can change how system boots. My workaround is to put whole rootflags in /etc/default/grub: root@pegaz:~# egrep rootflags= /etc/default/grub GRUB_CMDLINE_LINUX="rootflags=clear_cache,space_cache=v2,subvol=pegaz" root@pegaz:~# egrep rootflags= /boot/grub/grub.cfg | head -n1 linux /pegaz/boot/vmlinuz-4.19.0-14-amd64 root=UUID=ea6ae51d-d9b0-4628-a8f3-3406e1dc59c6 ro rootflags=subvol=pegaz rootflags=clear_cache,space_cache=v2,subvol=pegaz quiet This is ignored: rootflags=subvol=pegaz and this takes effect: rootflags=clear_cache,space_cache=v2,subvol=pegaz