I thought about -f at some point, but this would exclude valid symbolic links to a regular file that is the actual DTB.
On Fri, 11 Oct 2024 at 18:41, Julian Andres Klode < [email protected]> wrote: > A better patch IMO would be to just check for -f instead of -e. > > OTOH this *should* issue a diagnostic if stuff expects a file there. > > -- > You received this bug notification because you are subscribed to the bug > report. > https://bugs.launchpad.net/bugs/2084071 > > Title: > grub-mkconfig mistakingly adds a devicetree command when the dtb file > is actually a directory > > Status in grub2 package in Ubuntu: > Confirmed > > Bug description: > grub-mkconfig adds a "devicetree /boot/dtb" command even if /boot/dtb > is a directory, causing grub to complain at bootup with "Not a regular > file", which may prevent automatic bootup, as user interaction is > needed to acknowledge this warning. > > /etc/grub.d/10_linux is responsible for detecting and adding the > command: > > if test -n "${dtb}" ; then > if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then > message="$(gettext_printf "Loading device tree blob...")" > sed "s/^/$submenu_indentation/" << EOF > echo '$(echo "$message" | grub_quote)' > EOF > fi > sed "s/^/$submenu_indentation/" << EOF > devicetree ${rel_dirname}/${dtb} > EOF > fi > [...] > dtb= > for i in "dtb-${version}" "dtb-${alt_version}" "dtb"; do > if test -e "${dirname}/${i}" ; then > dtb="$i" > break > fi > done > > Since "dtb" exists in /boot, the dtb variable is not empty and the > command gets added. The test command is wrong, it catches directories, > so the command should be added only if the file exists (-e) AND if > it's not a directory (! -d). This piece of code comes from ubuntu-add- > devicetree-command-support.patch, see my patch for a potential fix. > > To manage notifications about this bug go to: > https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/2084071/+subscriptions > > -- Best regards. Michaël Blanc -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2084071 Title: grub-mkconfig mistakingly adds a devicetree command when the dtb file is actually a directory To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/2084071/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
