Bug#803625: grub-common: 10_linux doesn't merge rootflags= from GRUB_CMDLINE_LINUX*

Leszek Dubiel leszek at dubiel.pl
Thu Mar 25 15:18:33 GMT 2021


 > 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 at 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 at pegaz:~# egrep rootflags= /etc/default/grub
GRUB_CMDLINE_LINUX="rootflags=clear_cache,space_cache=v2,subvol=pegaz"


root at 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



More information about the Pkg-grub-devel mailing list