"error: can't find command hwmatch" during grub
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grub2 (Debian) |
Fix Released
|
Unknown
|
|||
grub2 (Ubuntu) |
Fix Released
|
Low
|
Mauricio Faria de Oliveira | ||
Bionic |
Won't Fix
|
Low
|
Mauricio Faria de Oliveira | ||
Focal |
Fix Released
|
Low
|
Mauricio Faria de Oliveira | ||
Groovy |
Invalid
|
Undecided
|
Unassigned | ||
Hirsute |
Won't Fix
|
Low
|
Mauricio Faria de Oliveira | ||
Impish |
Won't Fix
|
Low
|
Mauricio Faria de Oliveira | ||
Jammy |
Fix Released
|
Low
|
Mauricio Faria de Oliveira | ||
grub2-signed (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Bionic |
Invalid
|
Undecided
|
Unassigned | ||
Focal |
Invalid
|
Undecided
|
Unassigned | ||
Groovy |
Invalid
|
Undecided
|
Unassigned | ||
Hirsute |
Invalid
|
Undecided
|
Unassigned | ||
Impish |
Invalid
|
Undecided
|
Unassigned | ||
Jammy |
Invalid
|
Undecided
|
Unassigned |
Bug Description
[Impact]
* Users on non-pc/i386 platforms (e.g., efi/amd64) may observe
the message "error: can't find command `hwmatch'" every boot.
* Also observed on cloud instances, generating support tickets
asking for clarification/
* There' little or no impact, as hwmatch is only used to check
hardware device ID against a list for issues w/ graphics/KMS.
When this error happens, the default is set to keep graphics.
* This has possibly always happened on non-pc/i386, as hwmatch
is patched/exists only in 'grub-core/
thus there doesn't seem to be any serious issues as a result.
[Fix]
* Check for `$grub_platform != pc` then do not call hwmatch;
just keep current behavior (ie, keep graphics/
[Test Plan]
* Boot a VM with EFI (LXD or multipass/
the serial console show the error message (or not, w/ fix.)
- lxd:
$ lxc launch ubuntu:impish impish-vm --vm --console
Creating impish-vm
Starting impish-vm
To detach from the console, press: <ctrl>+a q
BdsDxe: loading Boot0001 "UEFI QEMU QEMU HARDDISK " from ...
BdsDxe: starting Boot0001 "UEFI QEMU QEMU HARDDISK " from ...
error: can't find command `hwmatch'.
...
- multipass/
sudo snap install multipass
sudo multipass set local.driver=
sudo snap connect multipass:libvirt
multipass launch -c 1 -d 4g -m 1g -n hwmatch-i impish
sudo apt -y install ovmf
sudo mkdir -p /var/lib/
virsh edit hwmatch-i
# insert in <os> section:
<loader readonly='yes' type='pflash'
<nvram>
virsh shutdown hwmatch-i
virsh start --console hwmatch-i
* Before:
...
BdsDxe: loading Boot0003 "ubuntu" from ...\shimx64.efi
BdsDxe: starting Boot0003 "ubuntu" from ...\shimx64.efi
error: can't find command `hwmatch'.
[ 0.000000] Linux version ...
* After:
sudo dpkg -i grub_common_*.deb # test package; g-c is enough.
sudo update-grub && sudo reboot
...
BdsDxe: loading Boot0003 "ubuntu" from ...\shimx64.efi
BdsDxe: starting Boot0003 "ubuntu" from ...\shimx64.efi
[ 0.000000] Linux version ...
[Where problems could occur]
* Issues with graphics/flickering during boot on systems with
graphics adapters in use might be hit in case of regression.
* Theoretically the risk is low, since hwmatch apparently has
never worked on non-pc/i386, and we replace the broken call
while keeping current behavior observed with it ("no change".)
[Other Info]
* While it might be interesting to try and enable/fix it for
other platforms, let's have a trivial fix to be considered
to backport to stable releases, at this time (less changes.)
* The same behavior is linux_gfx_
This happens because in the error case, grub shell evaluates
if hwmatch ...; then` to true, and `if [ $match = 0 ]; then`
to true too (as it's undefined) so `set linux_gfx_
Before/After in grub shell (same behavior):
grub> hwmatch
error: can't find command `hwmatch'.
grub> echo $grub_platform
efi
grub> echo $linux_gfx_mode
keep
* Other details in Debian bug 990836 [1].
* It looks like grub2-unsigned follows grub2 automatically,
so not providing debdiffs to it/just grub2.
[Links]
* [1] https:/
[Original Description]
Upon disabling my grub menu using grub-customizer, I've noticed that just before the system boots and goes into the crypto password prompt the following error message appears on the display:
```
error: can't find command hwmatch
```
Looks like this command is referenced from /boot/grub/grub/cfg
```
if hwmatch ${prefix}
```
However, the mod doesn't exist on grub's mod folder:
```
~ ls -la /boot/grub/
269
~ ls -la /boot/grub/
fish: No matches for wildcard “/boot/
```
ProblemType: Bug
DistroRelease: Ubuntu 19.04
Package: grub-efi-
ProcVersionSign
Uname: Linux 5.0.0-25-generic x86_64
ApportVersion: 2.20.10-0ubuntu27.1
Architecture: amd64
CurrentDesktop: Unity
Date: Sun Aug 18 00:22:41 2019
InstallationDate: Installed on 2019-08-17 (0 days ago)
InstallationMedia: Ubuntu 19.04 "Disco Dingo" - Release amd64 (20190416)
SourcePackage: grub2-signed
UpgradeStatus: No upgrade log present (probably fresh install)
Related branches
- Julian Andres Klode: Pending requested
- Ubuntu Core Development Team: Pending requested
-
Diff: 78 lines (+56/-0)3 files modifieddebian/changelog (+8/-0)
debian/patches/Call-hwmatch-only-on-the-grub-pc-platform.patch (+47/-0)
debian/patches/series (+1/-0)
- Julian Andres Klode: Approve
- Ubuntu Core Development Team: Pending requested
-
Diff: 78 lines (+56/-0)3 files modifieddebian/changelog (+8/-0)
debian/patches/0241-Call-hwmatch-only-on-the-grub-pc-platform.patch (+47/-0)
debian/patches/series (+1/-0)
Changed in grub2 (Debian): | |
status: | Unknown → New |
Changed in grub2 (Ubuntu Impish): | |
importance: | Medium → Low |
Changed in grub2 (Ubuntu Hirsute): | |
importance: | Undecided → Low |
Changed in grub2 (Ubuntu Focal): | |
importance: | Undecided → Low |
description: | updated |
description: | updated |
tags: | added: patch |
Changed in grub2-signed (Ubuntu Bionic): | |
status: | New → Invalid |
Changed in grub2 (Ubuntu Bionic): | |
status: | New → In Progress |
assignee: | nobody → Mauricio Faria de Oliveira (mfo) |
importance: | Undecided → Low |
description: | updated |
Changed in grub2 (Ubuntu Impish): | |
status: | Triaged → Won't Fix |
Changed in grub2 (Debian): | |
status: | New → Fix Released |
Status changed to 'Confirmed' because the bug affects multiple users.