#982835 installation-report: doesn't set needed rootflags for flash-kernel when btrfs is used as rootfs

#982835#5
Date:
2021-02-15 01:45:59 UTC
From:
To:
Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?

I created a ext2 for /boot and luks+lvm+btrfs for /. As d-i defaults to use a @rootfs subvolume for btrfs the linux bootargs need to have set "rootflags=subvol=@rootfs". This was not set during configuration of flash-kernel. Without this argument debian failed to boot with an error that no init was found.

   * What outcome did you expect instead?

debian-installer should set "rootflags=subvol=@rootfs" in /etc/default/flash-kernel when btrfs is used for /

   * What did you do to solve the problem?

1. I ran "setenv bootargs rootflags=subvol=@rootfs" in u-boot
2. I ran "boot" in u-boot
3. debian found init successfully
4. I added "rootflags=subvol=@rootfs" to LINUX_KERNEL_CMDLINE_DEFAULTS in /etc/default/flash-kernel
5. I ran flash-kernel
6. I rebooted
7. debian booted successfully

*** End of the template - remove these template lines ***

#982835#10
Date:
2021-10-03 02:34:01 UTC
From:
To:
After sending the boot report #995605 noticed someone was having what
could be the same problem as mine. I tested the suggested solution on
#982835 and it works :)

What can be done to get this patched?

#982835#15
Date:
2021-10-03 03:22:32 UTC
From:
To:
So, flash-kernel-installer has a debconf question that might be useable
for this purpose:

flash-kernel-installer.postinst.in:echo flash-kernel flash-kernel/linux_cmdline string $kopt_params | \
flash-kernel-installer.postinst.in-     chroot /target debconf-set-selections

I'm curious how other systems handle btrfs (e.g. grub on amd64); are
there any configuration options passed via debian-installer to set
"rootflags=subvol=@rootfs", or does grub have any configuration that are
set from update-grub or whatever ... or autodetected when rootfs is on
btrfs?


live well,
  vagrant

#982835#20
Date:
2021-10-03 03:30:24 UTC
From:
To:
To answer my own question, looks like it's autodetected in
/etc/grub.d/10_linux:

case x"$GRUB_FS" in
    xbtrfs)
    rootsubvol="`make_system_path_relative_to_its_root /`"
    rootsubvol="${rootsubvol#/}"
    if [ "x${rootsubvol}" != x ]; then
        GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol}
        ${GRUB_CMDLINE_LINUX}"
    fi;;


I suspect the way to handle this would be to have flash-kernel-installer
do something similar and pass it into the debconf option ... unless
someone can find a sane place to put that into flash-kernel at
run-time...

It might be easier to adapt other code, such as u-boot-menu and install
u-boot-menu instead of, or in addition to, flash-kernel... or at least,
that would be another case where this could be supported.


live well,
  vagrant