Bug#959425: loopback command hangs in 2.04 under UEFI

Bernhard Übelacker bernhardu at mailbox.org
Sun May 3 11:07:09 BST 2020


Dear Maintainer,
I could reproduce this issue with these grub images
inside a QEmu EFI enabled VM (no secureboot enabled).

grub-efi-amd64-signed: /usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed
grub-efi-amd64-bin:    /usr/lib/grub/x86_64-efi/monolithic/grubx64.efi

Further tried to track it down by manually creating the
image like it is done in grub2-2.04/debian/build-efi-images.

At the end I had a not hanging image, where just the "tpm"
module was left out.

Kind regards,
Bernhard
-------------- next part --------------

5956434be4b81e6376151b64ef9b1596  debian-10.3.0-amd64-netinst.iso

loopback loop /debian-10.3.0-amd64-netinst.iso


#########
#########



# Bullseye/testing amd64 qemu VM 2020-05-03

apt update
apt dist-upgrade


apt install efitools fakeroot mc
apt build-dep grub2



mkdir /home/benutzer/source/grub2/orig -p
cd    /home/benutzer/source/grub2/orig
apt source grub2
cd



#########
#########



apt install grub-efi-amd64-signed
Die folgenden NEUEN Pakete werden installiert:
  grub-efi-amd64-signed mokutil shim-helpers-amd64-signed shim-signed shim-signed-common shim-unsigned



root at debian:~# dpkg -l | grep -i grub
ii  grub-common                   2.04-7                         amd64        GRand Unified Bootloader (common files)
ii  grub-efi-amd64                2.04-7                         amd64        GRand Unified Bootloader, version 2 (EFI-AMD64 version)
ii  grub-efi-amd64-bin            2.04-7                         amd64        GRand Unified Bootloader, version 2 (EFI-AMD64 modules)
ii  grub-efi-amd64-signed         1+2.04+7                       amd64        GRand Unified Bootloader, version 2 (amd64 UEFI signed by Debian)
ii  grub2-common                  2.04-7                         amd64        GRand Unified Bootloader (common files for version 2)

root at debian:~# dpkg -L grub-efi-amd64-signed
...
/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed
...

root at debian:~# md5sum /boot/efi/EFI/debian/
BOOTX64.CSV  fbx64.efi    grub.cfg     grubx64.efi  mmx64.efi    shimx64.efi  
root at debian:~# md5sum /boot/efi/EFI/debian/grubx64.efi 
b9a9e8799558393ac6e50f111ff11719  /boot/efi/EFI/debian/grubx64.efi
root at debian:~# file /boot/efi/EFI/debian/grubx64.efi
/boot/efi/EFI/debian/grubx64.efi: PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows
root at debian:~# ls -lisah /boot/efi/EFI/debian/grubx64.efi
22 1,6M -rwx------ 1 root root 1,6M Mai  3 09:17 /boot/efi/EFI/debian/grubx64.efi

root at debian:~# md5sum /usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed
b9a9e8799558393ac6e50f111ff11719  /usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed
root at debian:~# file /usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed
/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed: PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows
root at debian:~# ls -lisah /usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed
919451 1,6M -rw-r--r-- 1 root root 1,6M Apr 22 15:52 /usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed

-> Hangs



#########



dpkg --purge grub-efi-amd64-signed
grub-install

root at debian:~# md5sum /boot/efi/EFI/debian/grubx64.efi 
5e1c77f5da51d2ed6500315f2d662bda  /boot/efi/EFI/debian/grubx64.efi

root at debian:~# dpkg -S grubx64
grub-efi-amd64-bin: /usr/lib/grub/x86_64-efi/monolithic/grubx64.efi

root at debian:~# md5sum /usr/lib/grub/x86_64-efi/monolithic/grubx64.efi
c440c1cb17c6f6442fa72bb256d191d1  /usr/lib/grub/x86_64-efi/monolithic/grubx64.efi

root at debian:~# ls -lisah /boot/efi/EFI/debian/grubx64.efi /usr/lib/grub/x86_64-efi/monolithic/grubx64.efi
    22 128K -rwx------ 1 root root 128K Mai  3 11:05 /boot/efi/EFI/debian/grubx64.efi
927732 1,6M -rw-r--r-- 1 root root 1,6M Apr 22 15:52 /usr/lib/grub/x86_64-efi/monolithic/grubx64.efi

cp /usr/lib/grub/x86_64-efi/monolithic/grubx64.efi /boot/efi/EFI/debian/grubx64.efi

-> Hangs



#########



root at debian:~# grub-install 
x86_64-efi wird für Ihre Plattform installiert.
installation beendet. Keine Fehler aufgetreten.
root at debian:~# md5sum /boot/efi/EFI/debian/grubx64.efi 
5e1c77f5da51d2ed6500315f2d662bda  /boot/efi/EFI/debian/grubx64.efi


-> Works



#########



cp /usr/lib/grub/x86_64-efi/monolithic/grubx64.efi /boot/efi/EFI/debian/grubx64-backup.efi



workdir=/tmp
platform=x86_64-efi
GRUB_MODULES="all_video boot btrfs cat chain configfile echo efifwsetup efinet ext2 fat font f2fs gettext gfxmenu gfxterm gfxterm_background gzio halt help hfsplus iso9660 jfs jpeg keystatus loadenv loopback linux ls lsefi lsefimmap lsefisystab lssal memdisk minicmd normal ntfs part_apple part_msdos part_gpt password_pbkdf2 png probe reboot regexp search search_fs_uuid search_fs_file search_label sleep squash4 test true video xfs zfs zfscrypt zfsinfo cpuid linuxefi play tpm cryptodisk gcry_arcfour gcry_blowfish gcry_camellia gcry_cast5 gcry_crc gcry_des gcry_dsa gcry_idea gcry_md4 gcry_md5 gcry_rfc2268 gcry_rijndael gcry_rmd160 gcry_rsa gcry_seed gcry_serpent gcry_sha1 gcry_sha256 gcry_sha512 gcry_tiger gcry_twofish gcry_whirlpool luks lvm mdraid09 mdraid1x raid5rec raid6rec"
grub_mkimage=grub-mkimage
outdir=/tmp
efi_name=test
efi_vendor=debian
grub_core=/usr/lib/grub/x86_64-efi

cat >"$workdir/grub.cfg" <<EOF
if [ -z "\$prefix" -o ! -e "\$prefix" ]; then
        if ! search --file --set=root /.disk/info; then
                search --file --set=root /.disk/mini-info
        fi
        set prefix=(\$root)/boot/grub
fi
if [ -e \$prefix/$platform/grub.cfg ]; then
        source \$prefix/$platform/grub.cfg
elif [ -e \$prefix/grub.cfg ]; then
        source \$prefix/grub.cfg
else
        source \$cmdpath/grub.cfg
fi
EOF

echo 'normal (memdisk)/grub.cfg' >"$workdir/grub-bootstrap.cfg"

mkfs.msdos -C "$workdir/memdisk.fat" 64
mcopy -i "$workdir/memdisk.fat" "$workdir/grub.cfg" ::grub.cfg

"$grub_mkimage" -O "$platform" -o "$outdir/grub$efi_name.efi" \
        -d "$grub_core" -p "/EFI/$efi_vendor" $GRUB_MODULES

ls -lisah /tmp/grubtest.efi




root at debian:~# md5sum /tmp/grubtest.efi
c440c1cb17c6f6442fa72bb256d191d1  /tmp/grubtest.efi

        # equasls /usr/lib/grub/x86_64-efi/monolithic/grubx64.efi

cp /tmp/grubtest.efi /boot/efi/EFI/debian/grubx64.efi



###########
###########



GRUB_MODULES="all_video boot btrfs cat chain configfile echo efifwsetup efinet ext2 fat font f2fs gettext gfxmenu gfxterm gfxterm_background gzio halt help hfsplus iso9660 jfs jpeg keystatus loadenv loopback linux ls lsefi lsefimmap lsefisystab lssal memdisk minicmd normal ntfs part_apple part_msdos part_gpt password_pbkdf2 png probe reboot regexp search search_fs_uuid search_fs_file search_label sleep squash4 test true video xfs zfs zfscrypt zfsinfo cpuid linuxefi play tpm cryptodisk gcry_arcfour gcry_blowfish gcry_camellia gcry_cast5 gcry_crc gcry_des gcry_dsa gcry_idea gcry_md4 gcry_md5 gcry_rfc2268 gcry_rijndael gcry_rmd160 gcry_rsa gcry_seed gcry_serpent gcry_sha1 gcry_sha256 gcry_sha512 gcry_tiger gcry_twofish gcry_whirlpool luks lvm mdraid09 mdraid1x raid5rec raid6rec"
-> Hangs

GRUB_MODULES="all_video boot btrfs cat chain configfile echo efifwsetup efinet ext2 fat font f2fs gettext gfxmenu gfxterm gfxterm_background gzio halt help hfsplus iso9660 jfs jpeg keystatus loadenv loopback linux ls lsefi lsefimmap lsefisystab lssal memdisk minicmd normal ntfs part_apple part_msdos part_gpt password_pbkdf2 png probe reboot regexp search search_fs_uuid search_fs_file search_label sleep squash4 test true video xfs zfs zfscrypt zfsinfo cpuid linuxefi play tpm"
-> Hangs

GRUB_MODULES="all_video boot btrfs cat chain configfile echo efifwsetup efinet ext2 fat font f2fs gettext gfxmenu gfxterm gfxterm_background gzio halt help hfsplus iso9660 jfs jpeg keystatus loadenv loopback linux ls lsefi lsefimmap lsefisystab lssal memdisk minicmd normal ntfs part_apple part_msdos part_gpt password_pbkdf2 png probe reboot regexp search search_fs_uuid search_fs_file search_label sleep squash4 test true"
-> Works

GRUB_MODULES="all_video boot btrfs cat chain configfile echo efifwsetup efinet ext2 fat font f2fs gettext gfxmenu gfxterm gfxterm_background gzio halt help hfsplus iso9660 jfs jpeg keystatus loadenv loopback linux ls lsefi lsefimmap lsefisystab lssal memdisk minicmd normal ntfs part_apple part_msdos part_gpt password_pbkdf2 png probe reboot regexp search search_fs_uuid search_fs_file search_label sleep squash4 test true video xfs"
-> Works

GRUB_MODULES="all_video boot btrfs cat chain configfile echo efifwsetup efinet ext2 fat font f2fs gettext gfxmenu gfxterm gfxterm_background gzio halt help hfsplus iso9660 jfs jpeg keystatus loadenv loopback linux ls lsefi lsefimmap lsefisystab lssal memdisk minicmd normal ntfs part_apple part_msdos part_gpt password_pbkdf2 png probe reboot regexp search search_fs_uuid search_fs_file search_label sleep squash4 test true video xfs zfs zfscrypt zfsinfo"
-> Works

GRUB_MODULES="all_video boot btrfs cat chain configfile echo efifwsetup efinet ext2 fat font f2fs gettext gfxmenu gfxterm gfxterm_background gzio halt help hfsplus iso9660 jfs jpeg keystatus loadenv loopback linux ls lsefi lsefimmap lsefisystab lssal memdisk minicmd normal ntfs part_apple part_msdos part_gpt password_pbkdf2 png probe reboot regexp search search_fs_uuid search_fs_file search_label sleep squash4 test true video xfs zfs zfscrypt zfsinfo cpuid linuxefi"
-> Works

GRUB_MODULES="all_video boot btrfs cat chain configfile echo efifwsetup efinet ext2 fat font f2fs gettext gfxmenu gfxterm gfxterm_background gzio halt help hfsplus iso9660 jfs jpeg keystatus loadenv loopback linux ls lsefi lsefimmap lsefisystab lssal memdisk minicmd normal ntfs part_apple part_msdos part_gpt password_pbkdf2 png probe reboot regexp search search_fs_uuid search_fs_file search_label sleep squash4 test true video xfs zfs zfscrypt zfsinfo cpuid linuxefi play"
-> Works

GRUB_MODULES="all_video boot btrfs cat chain configfile echo efifwsetup efinet ext2 fat font f2fs gettext gfxmenu gfxterm gfxterm_background gzio halt help hfsplus iso9660 jfs jpeg keystatus loadenv loopback linux ls lsefi lsefimmap lsefisystab lssal memdisk minicmd normal ntfs part_apple part_msdos part_gpt password_pbkdf2 png probe reboot regexp search search_fs_uuid search_fs_file search_label sleep squash4 test true video xfs zfs zfscrypt zfsinfo cpuid linuxefi play tpm"
-> Hangs again

GRUB_MODULES="all_video boot btrfs cat chain configfile echo efifwsetup efinet ext2 fat font f2fs gettext gfxmenu gfxterm gfxterm_background gzio halt help hfsplus iso9660 jfs jpeg keystatus loadenv loopback linux ls lsefi lsefimmap lsefisystab lssal memdisk minicmd normal ntfs part_apple part_msdos part_gpt password_pbkdf2 png probe reboot regexp search search_fs_uuid search_fs_file search_label sleep squash4 test true video xfs zfs zfscrypt zfsinfo cpuid linuxefi play cryptodisk gcry_arcfour gcry_blowfish gcry_camellia gcry_cast5 gcry_crc gcry_des gcry_dsa gcry_idea gcry_md4 gcry_md5 gcry_rfc2268 gcry_rijndael gcry_rmd160 gcry_rsa gcry_seed gcry_serpent gcry_sha1 gcry_sha256 gcry_sha512 gcry_tiger gcry_twofish gcry_whirlpool luks lvm mdraid09 mdraid1x raid5rec raid6rec"
-> Works, just tpm left out


More information about the Pkg-grub-devel mailing list