Fedora boot error after changing btrfs root subvolume name

Title says it all. I changed my btrfs subvol names so I could use timeshift to manage my snapshots, after regenerating the initramfs and editing grub to point to the new subvol names all was fine however after I got a kernel upgrade recently, the latest grub entry for the kernel specifies the old subvol name, resulting in a failed boot. I dont know grub well enough to know what options to add to /etc/default/grub, or even if thats where I need to add it. After editing the entry manually it boots perfectly fine so theres my question. Is there a grub config option to specify the name for a subvolume to boot? I’d rather not manually edit grub.cfg every time theres a kernel update lol.

kyoji,

I can’t help with your specific problem, but in the past when trouble shooting my own GRUB problems on Fedora this was use useful: docs.fedoraproject.org/en-US/…/grub2-bootloader/

Specifically the ‘grubby’ application might be of help. Good luck!

Sharp312,

Really useful info here, didnt even know grubby was a thing. I came from arch and grub seems to work quite differently on fedora. Thanks for the link. Didnt have anything that could help me this time but luckily @user134450 knows a bit more than me and was able to find where the issue was.

user134450, (edited )

check the GRUB_CMDLINE_LINUX key in /etc/default/grub it should contain the info about any subvolume. if it does not then there might be another grub config hook that is used by Fedora to add that info. If you want to be able to change subvol names without having to touch the grub config you might also want to switch to using subvolid instead of subvol keys on the kernel command line, because the id will stay the same after a rename (this could backfire though if you assign functions to certain names like “fallback” etc.).

Edit: found the hook that adds the kernel command line option for btrfs subvolumes. in /etc/grub.d/10_linux there is this bit of code:


<span style="color:#323232;">case x"$GRUB_FS" in
</span><span style="color:#323232;">    xbtrfs)
</span><span style="color:#323232;">        rootsubvol="`make_system_path_relative_to_its_root /`"
</span><span style="color:#323232;">        rootsubvol="${rootsubvol#/}"
</span><span style="color:#323232;">        if [ "x${rootsubvol}" != x ]; then
</span><span style="color:#323232;">            GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
</span><span style="color:#323232;">        fi;;
</span><span style="color:#323232;">    xzfs)
</span><span style="color:#323232;">        [skipped for brevity]
</span><span style="color:#323232;">        ;;
</span><span style="color:#323232;">esac
</span>

so it seems it is always looking at the subvol name of the currently mounted root fs.

Sharp312,

Thank you man, I dont understand much of the syntax (like at all) but i figured if I just change the subvol from the variable to the name of my root it would work, and it did. Jank as fuck but hey, its my system aha. Appreciate you man

user134450,

It’s just the basic posix shell syntax. It just looks weird because they are using lots of library functions and in-place substitutions. also apparently the function, to translate a system path to something grub will understand, is an ELF binary 0_o

  • All
  • Subscribed
  • Moderated
  • Favorites
  • fedora@lemmy.ml
  • modclub
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • cubers
  • GTA5RPClips
  • thenastyranch
  • Youngstown
  • rosin
  • slotface
  • tacticalgear
  • ethstaker
  • kavyap
  • Durango
  • anitta
  • everett
  • Leos
  • provamag3
  • mdbf
  • ngwrru68w68
  • cisconetworking
  • tester
  • osvaldo12
  • megavids
  • khanakhh
  • normalnudes
  • JUstTest
  • lostlight
  • All magazines