grub-mkconfig always generates a devicetree line when a dtb is present, causing a boot delay when grub is in lockdown
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grub2 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
When a device tree is found in /boot, grub-mkconfig automatically appends a devicetree line to the menu entry to load the device tree alongside the initrd and kernel.
Excerpt from /etc/grub.
if test -n "${dtb}" ; then
if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
sed "s/^/$submenu_
echo '$(echo "$message" | grub_quote)'
EOF
fi
sed "s/^/$submenu_
devicetree ${rel_dirname}
EOF
fi
This is however not always desired, in particular when GRUB is in lockdown (e.g. due to Secure Boot), as the devicetree command is then forbidden. This causes a ~5 second boot delay during startup as the following message is shown:
error: devicetree: the command is not allowed when lockdown is enforced.
Press any key to continue...
GRUB continues to boot without a key being pressed, but this is an unnecessary delay when booting. I suggest adding an additional variable (e.g. GRUB_DISABLE_
I don't think this is something that can be automatically detected and accounted for during grub-mkconfig, as the command may not be being executed on the target, and it may not know that the target will be booting with a locked down GRUB.
I've created a patch showing a potential fix for this using an environment variable.