diff -Nru grub2-2.04/debian/changelog grub2-2.04/debian/changelog --- grub2-2.04/debian/changelog 2021-07-16 10:01:31.000000000 -0300 +++ grub2-2.04/debian/changelog 2021-07-22 11:08:29.000000000 -0300 @@ -1,3 +1,11 @@ +grub2 (2.04-1ubuntu47) impish; urgency=medium + + * d/p/0240-gfxpayload-hwmatch-only-call-on-grub-pc.patch: Silence + message "error: can't find command `hwmatch'." on non-i386/pc + platforms as x86_64/efi. (LP: #1840560) + + -- Mauricio Faria de Oliveira Thu, 22 Jul 2021 11:51:45 -0300 + grub2 (2.04-1ubuntu46) impish; urgency=medium * debian/grub-common.service: change type to oneshot, add wantedby diff -Nru grub2-2.04/debian/patches/0241-gfxpayload-hwmatch-only-call-on-grub-pc.patch grub2-2.04/debian/patches/0241-gfxpayload-hwmatch-only-call-on-grub-pc.patch --- grub2-2.04/debian/patches/0241-gfxpayload-hwmatch-only-call-on-grub-pc.patch 1969-12-31 21:00:00.000000000 -0300 +++ grub2-2.04/debian/patches/0241-gfxpayload-hwmatch-only-call-on-grub-pc.patch 2021-07-22 11:08:29.000000000 -0300 @@ -0,0 +1,41 @@ +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1840560 +Bug-Debian: https://bugs.debian.org/990836 +Author: Mauricio Faria de Oliveira +Subject: hwmatch: only call on grub-pc + +Only call hwmatch on i386/pc as it is only available there. +This avoids "error: can't find command `hwmatch'." on e.g., x86_64/efi. + +The equivalent behavior is linux_gfx_mode=keep because grub is special: +the `if hwmatch` clause is true on that error and `$match = 0` is true +too, as it is undefined (confirmed in grub shell.) A quick fix for now. + +Before and After: + + grub> hwmatch + error: can't find command `hwmatch'. + + grub> echo $grub_platform + efi + + grub> echo $linux_gfx_mode + keep + +Forwarded: no +Last-Update: 2020-07-22 + +Index: grub2-2.04/util/grub.d/10_linux.in +=================================================================== +--- grub2-2.04.orig/util/grub.d/10_linux.in ++++ grub2-2.04/util/grub.d/10_linux.in +@@ -266,7 +266,9 @@ else + cat << EOF + if [ "\${recordfail}" != 1 ]; then + if [ -e \${prefix}/gfxblacklist.txt ]; then +- if hwmatch \${prefix}/gfxblacklist.txt 3; then ++ if [ \${grub_platform} != pc ]; then ++ set linux_gfx_mode=keep ++ elif hwmatch \${prefix}/gfxblacklist.txt 3; then + if [ \${match} = 0 ]; then + set linux_gfx_mode=keep + else diff -Nru grub2-2.04/debian/patches/series grub2-2.04/debian/patches/series --- grub2-2.04/debian/patches/series 2021-07-16 10:01:31.000000000 -0300 +++ grub2-2.04/debian/patches/series 2021-07-22 11:08:29.000000000 -0300 @@ -238,3 +238,4 @@ 0238-util-grub-install-Fix-NULL-pointer-dereferences.patch 0239-arm-linux-Fix-ARM-Linux-header-layout.patch 0240-tests-ahci_test.in-Replace-ide-drive-with-ide-hd.patch +0241-gfxpayload-hwmatch-only-call-on-grub-pc.patch