This question Error unknown command hwmatch is exactly what I'm asking but was closed as non reproducible. Mine is very reproducible.
Ubuntu 18.04 freshly installed on a 64-bit UEFI machine. Default grub boot options work fine, but I wanted to add a brief countdown (my normal config). After editing /etc/default/grub
as normal and running sudo update-grub
, the countdown works, but I get the error shown in the question title.
I tried the solution (copying files) in the closed question but it didn't seem to fit my configuration. Frankly I found the answer confusing.
I also tried editing /etc/grub.d/10_linux
to comment out the IF-THEN structure that uses hwmatch
. After that I did a sudo update-grub
but I still got the error.
How can I get my countdown and not see this error?
Edit per comments -
Stock grub as installed (all non-commented-out lines shown)
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
Edited grub to give countdown (all non-commented-out lines shown)
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=countdown
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
To get rid of the error message, add this line to
/etc/default/grub
:Source: #4 comment on https://bugs.launchpad.net/ubuntu/+source/grub2-signed/+bug/1840560
This will let a condition in the code get evaluated in such way that the codeblock referencing
hwmatch
gets bypassed.As to how worrying is the missing command (or not): according to mook765's comment, it's part of only grub-pc, and not grub-efi, and is supposedly being referenced as a mistake in the case of a grub-efi install.
A voluntary remark on the countdown / menu:
Using
instead of
would make the menu visible (while leaving the countdown feature (at the bottom of the screen) and automatic fallback selection intact).
Don't forget to run
sudo update-grub
after being done with the editing.I commented out the if-then structure in
/etc/grub.d/10_linux
that used hwmatch and that worked.Note this was a Brute Force and Ignorance fix because I didn't know which of the outcomes in the if-then structure to choose. The one I chose worked for me, it may not for you.
After running
sudo update-grub
I got the desired result on boot.Note: at first this didn't work because I copied
/etc/grub.d/10_linux
to/etc/grub.d/10_linux-backup
before editing it. But all executable files ingrub.d
get picked up so the original one got copied in too. I'm fortunate the system booted. I took the executable setting away from/etc/grub.d/10_linux-backup
, re-ransudo update-grub
, and that did it.