ERROR: [Errno 2] GRUB platform directory "/usr/lib/grub/x86_64-efi" not found on openSUSE
On Tumbleweed.
$ grub2-theme-preview --verbose /usr/share/grub/themes/openSUSE
INFO: Appending to fonts to load: ascii.pf2
INFO: Appending to fonts to load: DejaVuSans-Bold14.pf2
INFO: Appending to fonts to load: DejaVuSans10.pf2
INFO: Appending to fonts to load: DejaVuSans12.pf2
ERROR: [Errno 2] GRUB platform directory "/usr/lib/grub/x86_64-efi" not found
$ mount | grep "/sys "
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
$ ls /sys/firmware/efi
config_table efivars esrt fw_platform_size fw_vendor mok-variables runtime runtime-map systab
/usr/lib/grub folder does not exist.
$ pwd
/
$ find . -name 'x86_64-efi' 2>/dev/null
./usr/share/grub2/x86_64-efi
./boot/grub2/x86_64-efi
Hi @bartland,
for a first quick reply: This could be differences in GRUB packaging across distros. It's /usr/lib/grub/x86_64-efi/ on Gentoo and elsewhere last time I checked. Could you help out with a link to the openSUSE package and its filelisting with regard to /usr/share/grub2/x86_64-efi? I would like to validate that information and then maybe we need different paths across distributions. Thanks in advance!
https://software.opensuse.org/package/grub2-x86_64-efi
Information for package grub2-x86_64-efi:
-----------------------------------------
Repository : Main Repository (OSS)
Name : grub2-x86_64-efi
Version : 2.12-23.1
Arch : noarch
Vendor : openSUSE
Installed Size : 6.0 MiB
Installed : Yes
Status : up-to-date
Source package : grub2-2.12-23.1.src
Upstream URL : http://www.gnu.org/software/grub/
Summary : Bootloader with support for Linux, Multiboot and more
Description :
The GRand Unified Bootloader (GRUB) is a highly configurable and customizable
bootloader with modular architecture. It supports rich variety of kernel formats,
file systems, computer architectures and hardware devices. This subpackage
provides support for EFI systems.
/usr/share/efi
/usr/share/efi/x86_64
/usr/share/efi/x86_64/grub.der
/usr/share/efi/x86_64/grub.efi
/usr/share/grub2/x86_64-efi
/usr/share/grub2/x86_64-efi/acpi.mod
/usr/share/grub2/x86_64-efi/adler32.mod
/usr/share/grub2/x86_64-efi/affs.mod
/usr/share/grub2/x86_64-efi/afs.mod
/usr/share/grub2/x86_64-efi/afsplitter.mod
/usr/share/grub2/x86_64-efi/ahci.mod
/usr/share/grub2/x86_64-efi/all_video.mod
/usr/share/grub2/x86_64-efi/aout.mod
/usr/share/grub2/x86_64-efi/appended_signature_test.mod
/usr/share/grub2/x86_64-efi/appendedsig.mod
/usr/share/grub2/x86_64-efi/appleldr.mod
/usr/share/grub2/x86_64-efi/archelp.mod
/usr/share/grub2/x86_64-efi/asn1.mod
/usr/share/grub2/x86_64-efi/at_keyboard.mod
/usr/share/grub2/x86_64-efi/ata.mod
/usr/share/grub2/x86_64-efi/backtrace.mod
/usr/share/grub2/x86_64-efi/bfs.mod
/usr/share/grub2/x86_64-efi/bitmap.mod
/usr/share/grub2/x86_64-efi/bitmap_scale.mod
/usr/share/grub2/x86_64-efi/bli.mod
/usr/share/grub2/x86_64-efi/blocklist.mod
/usr/share/grub2/x86_64-efi/blscfg.mod
/usr/share/grub2/x86_64-efi/boot.mod
/usr/share/grub2/x86_64-efi/bsd.mod
/usr/share/grub2/x86_64-efi/bswap_test.mod
/usr/share/grub2/x86_64-efi/btrfs.mod
/usr/share/grub2/x86_64-efi/bufio.mod
/usr/share/grub2/x86_64-efi/cat.mod
/usr/share/grub2/x86_64-efi/cbfs.mod
/usr/share/grub2/x86_64-efi/cbls.mod
/usr/share/grub2/x86_64-efi/cbmemc.mod
/usr/share/grub2/x86_64-efi/cbtable.mod
/usr/share/grub2/x86_64-efi/cbtime.mod
/usr/share/grub2/x86_64-efi/chain.mod
/usr/share/grub2/x86_64-efi/cmdline.mod
/usr/share/grub2/x86_64-efi/cmdline_cat_test.mod
/usr/share/grub2/x86_64-efi/cmp.mod
/usr/share/grub2/x86_64-efi/cmp_test.mod
/usr/share/grub2/x86_64-efi/command.lst
/usr/share/grub2/x86_64-efi/configfile.mod
/usr/share/grub2/x86_64-efi/cpio.mod
/usr/share/grub2/x86_64-efi/cpio_be.mod
/usr/share/grub2/x86_64-efi/cpuid.mod
/usr/share/grub2/x86_64-efi/crc64.mod
/usr/share/grub2/x86_64-efi/crypto.lst
/usr/share/grub2/x86_64-efi/crypto.mod
/usr/share/grub2/x86_64-efi/cryptodisk.mod
/usr/share/grub2/x86_64-efi/crypttab.mod
/usr/share/grub2/x86_64-efi/cs5536.mod
/usr/share/grub2/x86_64-efi/ctz_test.mod
/usr/share/grub2/x86_64-efi/date.mod
/usr/share/grub2/x86_64-efi/datehook.mod
/usr/share/grub2/x86_64-efi/datetime.mod
/usr/share/grub2/x86_64-efi/disk.mod
/usr/share/grub2/x86_64-efi/diskfilter.mod
/usr/share/grub2/x86_64-efi/div.mod
/usr/share/grub2/x86_64-efi/div_test.mod
/usr/share/grub2/x86_64-efi/dm_nv.mod
/usr/share/grub2/x86_64-efi/echo.mod
/usr/share/grub2/x86_64-efi/efi_gop.mod
/usr/share/grub2/x86_64-efi/efi_uga.mod
/usr/share/grub2/x86_64-efi/efifwsetup.mod
/usr/share/grub2/x86_64-efi/efinet.mod
/usr/share/grub2/x86_64-efi/efitextmode.mod
/usr/share/grub2/x86_64-efi/ehci.mod
/usr/share/grub2/x86_64-efi/elf.mod
/usr/share/grub2/x86_64-efi/eval.mod
/usr/share/grub2/x86_64-efi/exfat.mod
/usr/share/grub2/x86_64-efi/exfctest.mod
/usr/share/grub2/x86_64-efi/ext2.mod
/usr/share/grub2/x86_64-efi/extcmd.mod
/usr/share/grub2/x86_64-efi/f2fs.mod
/usr/share/grub2/x86_64-efi/fat.mod
/usr/share/grub2/x86_64-efi/fdt.lst
/usr/share/grub2/x86_64-efi/file.mod
/usr/share/grub2/x86_64-efi/fixvideo.mod
/usr/share/grub2/x86_64-efi/font.mod
/usr/share/grub2/x86_64-efi/fs.lst
/usr/share/grub2/x86_64-efi/fshelp.mod
/usr/share/grub2/x86_64-efi/functional_test.mod
/usr/share/grub2/x86_64-efi/gcry_arcfour.mod
/usr/share/grub2/x86_64-efi/gcry_blowfish.mod
/usr/share/grub2/x86_64-efi/gcry_camellia.mod
/usr/share/grub2/x86_64-efi/gcry_cast5.mod
/usr/share/grub2/x86_64-efi/gcry_crc.mod
/usr/share/grub2/x86_64-efi/gcry_des.mod
/usr/share/grub2/x86_64-efi/gcry_dsa.mod
/usr/share/grub2/x86_64-efi/gcry_idea.mod
/usr/share/grub2/x86_64-efi/gcry_md4.mod
/usr/share/grub2/x86_64-efi/gcry_md5.mod
/usr/share/grub2/x86_64-efi/gcry_rfc2268.mod
/usr/share/grub2/x86_64-efi/gcry_rijndael.mod
/usr/share/grub2/x86_64-efi/gcry_rmd160.mod
/usr/share/grub2/x86_64-efi/gcry_rsa.mod
/usr/share/grub2/x86_64-efi/gcry_seed.mod
/usr/share/grub2/x86_64-efi/gcry_serpent.mod
/usr/share/grub2/x86_64-efi/gcry_sha1.mod
/usr/share/grub2/x86_64-efi/gcry_sha256.mod
/usr/share/grub2/x86_64-efi/gcry_sha512.mod
/usr/share/grub2/x86_64-efi/gcry_tiger.mod
/usr/share/grub2/x86_64-efi/gcry_twofish.mod
/usr/share/grub2/x86_64-efi/gcry_whirlpool.mod
/usr/share/grub2/x86_64-efi/geli.mod
/usr/share/grub2/x86_64-efi/gettext.mod
/usr/share/grub2/x86_64-efi/gfxmenu.mod
/usr/share/grub2/x86_64-efi/gfxterm.mod
/usr/share/grub2/x86_64-efi/gfxterm_background.mod
/usr/share/grub2/x86_64-efi/gfxterm_menu.mod
/usr/share/grub2/x86_64-efi/gptsync.mod
/usr/share/grub2/x86_64-efi/grub-tpm.efi
/usr/share/grub2/x86_64-efi/grub.efi
/usr/share/grub2/x86_64-efi/gzio.mod
/usr/share/grub2/x86_64-efi/halt.mod
/usr/share/grub2/x86_64-efi/hashsum.mod
/usr/share/grub2/x86_64-efi/hdparm.mod
/usr/share/grub2/x86_64-efi/hello.mod
/usr/share/grub2/x86_64-efi/help.mod
/usr/share/grub2/x86_64-efi/hexdump.mod
/usr/share/grub2/x86_64-efi/hfs.mod
/usr/share/grub2/x86_64-efi/hfsplus.mod
/usr/share/grub2/x86_64-efi/hfspluscomp.mod
/usr/share/grub2/x86_64-efi/http.mod
/usr/share/grub2/x86_64-efi/iorw.mod
/usr/share/grub2/x86_64-efi/iso9660.mod
/usr/share/grub2/x86_64-efi/jfs.mod
/usr/share/grub2/x86_64-efi/jpeg.mod
/usr/share/grub2/x86_64-efi/json.mod
/usr/share/grub2/x86_64-efi/kernel.exec
/usr/share/grub2/x86_64-efi/kernel.img
/usr/share/grub2/x86_64-efi/key_protector.mod
/usr/share/grub2/x86_64-efi/keylayouts.mod
/usr/share/grub2/x86_64-efi/keystatus.mod
/usr/share/grub2/x86_64-efi/ldm.mod
/usr/share/grub2/x86_64-efi/legacy_password_test.mod
/usr/share/grub2/x86_64-efi/legacycfg.mod
/usr/share/grub2/x86_64-efi/linux.mod
/usr/share/grub2/x86_64-efi/linux16.mod
/usr/share/grub2/x86_64-efi/linuxefi.mod
/usr/share/grub2/x86_64-efi/loadbios.mod
/usr/share/grub2/x86_64-efi/loadenv.mod
/usr/share/grub2/x86_64-efi/loopback.mod
/usr/share/grub2/x86_64-efi/ls.mod
/usr/share/grub2/x86_64-efi/lsacpi.mod
/usr/share/grub2/x86_64-efi/lsefi.mod
/usr/share/grub2/x86_64-efi/lsefimmap.mod
/usr/share/grub2/x86_64-efi/lsefisystab.mod
/usr/share/grub2/x86_64-efi/lsmmap.mod
/usr/share/grub2/x86_64-efi/lspci.mod
/usr/share/grub2/x86_64-efi/lssal.mod
/usr/share/grub2/x86_64-efi/luks.mod
/usr/share/grub2/x86_64-efi/luks2.mod
/usr/share/grub2/x86_64-efi/lvm.mod
/usr/share/grub2/x86_64-efi/lzopio.mod
/usr/share/grub2/x86_64-efi/macbless.mod
/usr/share/grub2/x86_64-efi/macho.mod
/usr/share/grub2/x86_64-efi/mdraid09.mod
/usr/share/grub2/x86_64-efi/mdraid09_be.mod
/usr/share/grub2/x86_64-efi/mdraid1x.mod
/usr/share/grub2/x86_64-efi/memdisk.mod
/usr/share/grub2/x86_64-efi/memrw.mod
/usr/share/grub2/x86_64-efi/minicmd.mod
/usr/share/grub2/x86_64-efi/minix.mod
/usr/share/grub2/x86_64-efi/minix2.mod
/usr/share/grub2/x86_64-efi/minix2_be.mod
/usr/share/grub2/x86_64-efi/minix3.mod
/usr/share/grub2/x86_64-efi/minix3_be.mod
/usr/share/grub2/x86_64-efi/minix_be.mod
/usr/share/grub2/x86_64-efi/mmap.mod
/usr/share/grub2/x86_64-efi/moddep.lst
/usr/share/grub2/x86_64-efi/modinfo.sh
/usr/share/grub2/x86_64-efi/morse.mod
/usr/share/grub2/x86_64-efi/mpi.mod
/usr/share/grub2/x86_64-efi/msdospart.mod
/usr/share/grub2/x86_64-efi/mul_test.mod
/usr/share/grub2/x86_64-efi/multiboot.mod
/usr/share/grub2/x86_64-efi/multiboot2.mod
/usr/share/grub2/x86_64-efi/nativedisk.mod
/usr/share/grub2/x86_64-efi/net.mod
/usr/share/grub2/x86_64-efi/newc.mod
/usr/share/grub2/x86_64-efi/nilfs2.mod
/usr/share/grub2/x86_64-efi/normal.mod
/usr/share/grub2/x86_64-efi/ntfs.mod
/usr/share/grub2/x86_64-efi/ntfscomp.mod
/usr/share/grub2/x86_64-efi/odc.mod
/usr/share/grub2/x86_64-efi/offsetio.mod
/usr/share/grub2/x86_64-efi/ohci.mod
/usr/share/grub2/x86_64-efi/part_acorn.mod
/usr/share/grub2/x86_64-efi/part_amiga.mod
/usr/share/grub2/x86_64-efi/part_apple.mod
/usr/share/grub2/x86_64-efi/part_bsd.mod
/usr/share/grub2/x86_64-efi/part_dfly.mod
/usr/share/grub2/x86_64-efi/part_dvh.mod
/usr/share/grub2/x86_64-efi/part_gpt.mod
/usr/share/grub2/x86_64-efi/part_msdos.mod
/usr/share/grub2/x86_64-efi/part_plan.mod
/usr/share/grub2/x86_64-efi/part_sun.mod
/usr/share/grub2/x86_64-efi/part_sunpc.mod
/usr/share/grub2/x86_64-efi/partmap.lst
/usr/share/grub2/x86_64-efi/parttool.lst
/usr/share/grub2/x86_64-efi/parttool.mod
/usr/share/grub2/x86_64-efi/password.mod
/usr/share/grub2/x86_64-efi/password_pbkdf2.mod
/usr/share/grub2/x86_64-efi/pata.mod
/usr/share/grub2/x86_64-efi/pbkdf2.mod
/usr/share/grub2/x86_64-efi/pbkdf2_test.mod
/usr/share/grub2/x86_64-efi/pcidump.mod
/usr/share/grub2/x86_64-efi/pgp.mod
/usr/share/grub2/x86_64-efi/pkcs1_v15.mod
/usr/share/grub2/x86_64-efi/plainmount.mod
/usr/share/grub2/x86_64-efi/play.mod
/usr/share/grub2/x86_64-efi/png.mod
/usr/share/grub2/x86_64-efi/priority_queue.mod
/usr/share/grub2/x86_64-efi/probe.mod
/usr/share/grub2/x86_64-efi/procfs.mod
/usr/share/grub2/x86_64-efi/progress.mod
/usr/share/grub2/x86_64-efi/raid5rec.mod
/usr/share/grub2/x86_64-efi/raid6rec.mod
/usr/share/grub2/x86_64-efi/random.mod
/usr/share/grub2/x86_64-efi/rdmsr.mod
/usr/share/grub2/x86_64-efi/read.mod
/usr/share/grub2/x86_64-efi/reboot.mod
/usr/share/grub2/x86_64-efi/regexp.mod
/usr/share/grub2/x86_64-efi/reiserfs.mod
/usr/share/grub2/x86_64-efi/relocator.mod
/usr/share/grub2/x86_64-efi/romfs.mod
/usr/share/grub2/x86_64-efi/scsi.mod
/usr/share/grub2/x86_64-efi/search.mod
/usr/share/grub2/x86_64-efi/search_fs_file.mod
/usr/share/grub2/x86_64-efi/search_fs_uuid.mod
/usr/share/grub2/x86_64-efi/search_label.mod
/usr/share/grub2/x86_64-efi/serial.mod
/usr/share/grub2/x86_64-efi/setjmp.mod
/usr/share/grub2/x86_64-efi/setjmp_test.mod
/usr/share/grub2/x86_64-efi/setpci.mod
/usr/share/grub2/x86_64-efi/sfs.mod
/usr/share/grub2/x86_64-efi/shift_test.mod
/usr/share/grub2/x86_64-efi/signature_test.mod
/usr/share/grub2/x86_64-efi/sleep.mod
/usr/share/grub2/x86_64-efi/sleep_test.mod
/usr/share/grub2/x86_64-efi/smbios.mod
/usr/share/grub2/x86_64-efi/spkmodem.mod
/usr/share/grub2/x86_64-efi/squash4.mod
/usr/share/grub2/x86_64-efi/strtoull_test.mod
/usr/share/grub2/x86_64-efi/syslinuxcfg.mod
/usr/share/grub2/x86_64-efi/tar.mod
/usr/share/grub2/x86_64-efi/terminal.lst
/usr/share/grub2/x86_64-efi/terminal.mod
/usr/share/grub2/x86_64-efi/terminfo.mod
/usr/share/grub2/x86_64-efi/test.mod
/usr/share/grub2/x86_64-efi/test_asn1.mod
/usr/share/grub2/x86_64-efi/test_blockarg.mod
/usr/share/grub2/x86_64-efi/testload.mod
/usr/share/grub2/x86_64-efi/testspeed.mod
/usr/share/grub2/x86_64-efi/tftp.mod
/usr/share/grub2/x86_64-efi/tga.mod
/usr/share/grub2/x86_64-efi/time.mod
/usr/share/grub2/x86_64-efi/tpm.mod
/usr/share/grub2/x86_64-efi/tpm2.mod
/usr/share/grub2/x86_64-efi/tr.mod
/usr/share/grub2/x86_64-efi/trig.mod
/usr/share/grub2/x86_64-efi/true.mod
/usr/share/grub2/x86_64-efi/udf.mod
/usr/share/grub2/x86_64-efi/ufs1.mod
/usr/share/grub2/x86_64-efi/ufs1_be.mod
/usr/share/grub2/x86_64-efi/ufs2.mod
/usr/share/grub2/x86_64-efi/uhci.mod
/usr/share/grub2/x86_64-efi/usb.mod
/usr/share/grub2/x86_64-efi/usb_keyboard.mod
/usr/share/grub2/x86_64-efi/usbms.mod
/usr/share/grub2/x86_64-efi/usbserial_common.mod
/usr/share/grub2/x86_64-efi/usbserial_ftdi.mod
/usr/share/grub2/x86_64-efi/usbserial_pl2303.mod
/usr/share/grub2/x86_64-efi/usbserial_usbdebug.mod
/usr/share/grub2/x86_64-efi/usbtest.mod
/usr/share/grub2/x86_64-efi/video.lst
/usr/share/grub2/x86_64-efi/video.mod
/usr/share/grub2/x86_64-efi/video_colors.mod
/usr/share/grub2/x86_64-efi/video_fb.mod
/usr/share/grub2/x86_64-efi/videoinfo.mod
/usr/share/grub2/x86_64-efi/videotest.mod
/usr/share/grub2/x86_64-efi/videotest_checksum.mod
/usr/share/grub2/x86_64-efi/wrmsr.mod
/usr/share/grub2/x86_64-efi/xfs.mod
/usr/share/grub2/x86_64-efi/xnu.mod
/usr/share/grub2/x86_64-efi/xnu_uuid.mod
/usr/share/grub2/x86_64-efi/xnu_uuid_test.mod
/usr/share/grub2/x86_64-efi/xzio.mod
/usr/share/grub2/x86_64-efi/zstd.mod
293 files total
@bartland thank you! I'm starting to think that with regard to the File System Hierarchy (FHS) standard /usr/share is the wrong place for these files because it's containing architecture dependent compiled code while /usr/share is about "Architecture-independent data" is there a chance that you could file a bug about their packaging? They are not supposed to go against FHS. If they have solid reasoning to, it would be interesting to learn about that. What do you think?
I have raised the issue in their forum: https://forums.opensuse.org/t/why-is-x86-64-efi-installed-into-usr-share-rather-than-usr-lib/179092
Interesting discussion on various locations at https://github.com/rear/rear/issues/2338
What do you think about me symlinking /usr/lib/grub2 and /usr/lib/grub to /usr/share/grub2 ?
What do you think about me symlinking /usr/lib/grub2 and /usr/lib/grub to /usr/share/grub2 ?
Response from SUSE: " Probably a bad idea, it is a noarch (Architecture-independent) package."
Explanation regarding location:
"Because the architecture of grub is completely unrelated to the architecture of the system. The grub binaries are not executed in the running system and so do not need to match its architecture, they are just opaque data. I can create grub image for any architecture on any system; I can install grub binaries on ESP from any system, and architecture of the system does not need to match the architecture of the EFI (32 bit EFI vs. 64 bit system being the most common case)."
I have raised the issue in their forum: https://forums.opensuse.org/t/why-is-x86-64-efi-installed-into-usr-share-rather-than-usr-lib/179092
@bartland very nice, thank you!
Interesting discussion on various locations at rear/rear#2338
What do you think about me symlinking /usr/lib/grub2 and /usr/lib/grub to /usr/share/grub2 ?
A symlink only solves the problem for tools like grub2-theme-preview, not the actual (apparently arguable) FHS violation.
What do you think about me symlinking /usr/lib/grub2 and /usr/lib/grub to /usr/share/grub2 ?
Response from SUSE: " Probably a bad idea, it is a noarch (Architecture-independent) package."
Explanation regarding location:
"Because the architecture of grub is completely unrelated to the architecture of the system. The grub binaries are not executed in the running system and so do not need to match its architecture, they are just opaque data. I can create grub image for any architecture on any system; I can install grub binaries on ESP from any system, and architecture of the system does not need to match the architecture of the EFI (32 bit EFI vs. 64 bit system being the most common case)."
There are apparently two ways to see this:
- a) some of these files fit the host architecture and some don't, some may be run on the very host after installation of GRUB and a reboot and some have no chance to; so this view considers them architecture-dependent and in the wrong place
- b) the files are no binaries intended to be run from an already-booted machine, and that's somehow considered architecture-independent and in the right place.
From my wording it's probably clear that I'm with school (a) while openSUSE wants to be in team (b). GRUB Upstream is team (a) as can be seen by e.g. their use of /usr/lib/grub/<cpu>-<platform> at https://git.savannah.gnu.org/cgit/grub.git/tree/docs/grub.texi#n622 and they're not wrong about it (but that's team (a) thinking).
So I guess we'll need to make grub2-theme-preview either (A) do auto-detection of folder presence or (B) do auto-detection of open SUSE and use hard-coded /usr/share for them. The latter would likely fail for derivatives of openSUSE if any.
I just re-discovered this code in grub2-theme-preview…
https://github.com/hartwork/grub2-theme-preview/blob/ac6d9c4ed7bc008dad5ff7e9bcdbc527ea6b5ce5/grub2_theme_preview/main.py#L353
…so you could try invocation with G2TP_GRUB_LIB=/usr/share already today. The code was introduced with commit 6eeaec5f7b1bcbb110276a6dfcb36f08b207ca31 originally to support NixOS and that feature is supposed to be working in version >=2.6.0:
# git tag --contains 6eeaec5f7b1bcbb110276a6dfcb36f08b207ca31
2.6.0
2.7.0
2.8.0
Please let me know if environment variable G2TP_GRUB_LIB makes things work for you even without the symlink. I'll need to sleep over the topic of auto-detection to make things work out of the box on openSUSE.
What do you think?
Gets further. Both these:
$ G2TP_GRUB_LIB=/boot/grub2 grub2-theme-preview --verbose /usr/share/grub/themes/openSUSE
$ G2TP_GRUB_LIB=/usr/share/grub2 grub2-theme-preview --verbose /usr/share/grub/themes/openSUSE
give the same error:
INFO: Appending to fonts to load: ascii.pf2
INFO: Appending to fonts to load: DejaVuSans-Bold14.pf2
INFO: Appending to fonts to load: DejaVuSans10.pf2
INFO: Appending to fonts to load: DejaVuSans12.pf2
ERROR: [Errno 2] OVMF image file "/usr/share/[..]/OVMF_CODE.fd" is missing, please install package 'edk2-ovmf' or 'ovmf'.
ovmf is installed:
$ zypper if ovmf
Loading repository data...
Reading installed packages...
Information for package ovmf:
-----------------------------
Repository : Main Repository (OSS)
Name : ovmf
Version : 202405-3.1
Arch : x86_64
Vendor : openSUSE
Installed Size : 7.0 KiB
Installed : Yes (automatically)
Status : up-to-date
Source package : ovmf-202405-3.1.src
Upstream URL : https://github.com/tianocore/edk2
Summary : Open Virtual Machine Firmware
Description :
The Open Virtual Machine Firmware (OVMF) project aims to support
firmware for Virtual Machines using the edk2 code base.
$ rpm -ql ovmf
/usr/share/doc/packages/ovmf
/usr/share/doc/packages/ovmf/README
$ rpm -ql ovmf-tools
/usr/bin/EfiRom
/usr/share/doc/packages/ovmf-tools
/usr/share/doc/packages/ovmf-tools/EfiRom_Utility_Man_Page.rtf
$ rpm -ql qemu-ovmf-x86_64
/usr/share/licenses/qemu-ovmf-x86_64
/usr/share/licenses/qemu-ovmf-x86_64/License-ovmf.txt
/usr/share/licenses/qemu-ovmf-x86_64/License.txt
/usr/share/qemu
/usr/share/qemu/firmware
/usr/share/qemu/firmware/50-ovmf-x86_64-secure-ms.json
/usr/share/qemu/firmware/50-ovmf-x86_64-secure-opensuse.json
/usr/share/qemu/firmware/50-ovmf-x86_64-secure-suse.json
/usr/share/qemu/firmware/50-ovmf-x86_64-secure.json
/usr/share/qemu/firmware/50-ovmf-x86_64-sev.json
/usr/share/qemu/firmware/50-xen-hvm-x86_64.json
/usr/share/qemu/firmware/60-ovmf-x86_64-2m-ms.json
/usr/share/qemu/firmware/60-ovmf-x86_64-2m-opensuse.json
/usr/share/qemu/firmware/60-ovmf-x86_64-2m-suse.json
/usr/share/qemu/firmware/60-ovmf-x86_64-2m.json
/usr/share/qemu/firmware/60-ovmf-x86_64-ms.json
/usr/share/qemu/firmware/60-ovmf-x86_64-opensuse.json
/usr/share/qemu/firmware/60-ovmf-x86_64-suse.json
/usr/share/qemu/firmware/60-ovmf-x86_64.json
/usr/share/qemu/ovmf-x86_64-4m-code.bin
/usr/share/qemu/ovmf-x86_64-4m-vars.bin
/usr/share/qemu/ovmf-x86_64-4m.bin
/usr/share/qemu/ovmf-x86_64-code.bin
/usr/share/qemu/ovmf-x86_64-ms-4m-code.bin
/usr/share/qemu/ovmf-x86_64-ms-4m-vars.bin
/usr/share/qemu/ovmf-x86_64-ms-4m.bin
/usr/share/qemu/ovmf-x86_64-ms-code.bin
/usr/share/qemu/ovmf-x86_64-ms-vars.bin
/usr/share/qemu/ovmf-x86_64-ms.bin
/usr/share/qemu/ovmf-x86_64-opensuse-4m-code.bin
/usr/share/qemu/ovmf-x86_64-opensuse-4m-vars.bin
/usr/share/qemu/ovmf-x86_64-opensuse-4m.bin
/usr/share/qemu/ovmf-x86_64-opensuse-code.bin
/usr/share/qemu/ovmf-x86_64-opensuse-vars.bin
/usr/share/qemu/ovmf-x86_64-opensuse.bin
/usr/share/qemu/ovmf-x86_64-sev.bin
/usr/share/qemu/ovmf-x86_64-smm-code.bin
/usr/share/qemu/ovmf-x86_64-smm-ms-code.bin
/usr/share/qemu/ovmf-x86_64-smm-ms-vars.bin
/usr/share/qemu/ovmf-x86_64-smm-ms.bin
/usr/share/qemu/ovmf-x86_64-smm-opensuse-code.bin
/usr/share/qemu/ovmf-x86_64-smm-opensuse-vars.bin
/usr/share/qemu/ovmf-x86_64-smm-opensuse.bin
/usr/share/qemu/ovmf-x86_64-smm-suse-code.bin
/usr/share/qemu/ovmf-x86_64-smm-suse-vars.bin
/usr/share/qemu/ovmf-x86_64-smm-suse.bin
/usr/share/qemu/ovmf-x86_64-smm-vars.bin
/usr/share/qemu/ovmf-x86_64-smm.bin
/usr/share/qemu/ovmf-x86_64-suse-4m-code.bin
/usr/share/qemu/ovmf-x86_64-suse-4m-vars.bin
/usr/share/qemu/ovmf-x86_64-suse-4m.bin
/usr/share/qemu/ovmf-x86_64-suse-code.bin
/usr/share/qemu/ovmf-x86_64-suse-vars.bin
/usr/share/qemu/ovmf-x86_64-suse.bin
/usr/share/qemu/ovmf-x86_64-vars.bin
/usr/share/qemu/ovmf-x86_64-xen-4m.bin
/usr/share/qemu/ovmf-x86_64-xen.bin
/usr/share/qemu/ovmf-x86_64.bin
Hi @bartland,
thanks for trying and sharing these details! I would guess it's one of those /usr/share/qemu/*.bin files? In some sense grub2-theme-preview has support for this:
https://github.com/hartwork/grub2-theme-preview/blob/ac6d9c4ed7bc008dad5ff7e9bcdbc527ea6b5ce5/grub2_theme_preview/main.py#L375-L392
Could you play with the G2TP_OVMF_IMAGE environment variable and find which of /usr/share/qemu/*.bin is working? I could then add that filename to the list of candidates. (If you figure out which image does what, I'd be curious. Is there documentation on these files somewhere?)
PS: I should probably add a section on supported environment variables to the --help output and mention the variable in the error message. Thanks for your patience with this! :+1:
PS: I should probably add a section on supported environment variables to the
--helpoutput and mention the variable in the error message.
@bartland PPS: There is pull request #329 for that now. Review is welcome, if you like.
@bartland PPPS: I found this in the mean time:
- https://build.opensuse.org/projects/openSUSE:Leap:15.3:Update/packages/libvirt.22291/files/suse-ovmf-paths.patch?expand=0
- https://powersnail.com/2022/grub2-theme-preview-opensuse/
They don't agree but very interesting.
Nearly there.
$ G2TP_GRUB_LIB=/usr/share/grub2 G2TP_OVMF_IMAGE=/usr/share/qemu/ovmf-x86_64-code.bin grub2-theme-preview --verbose /usr/share/grub/themes/openSUSE
INFO: Appending to fonts to load: ascii.pf2
INFO: Appending to fonts to load: DejaVuSans-Bold14.pf2
INFO: Appending to fonts to load: DejaVuSans10.pf2
INFO: Appending to fonts to load: DejaVuSans12.pf2
INFO: Found OVMF image at '/usr/share/qemu/ovmf-x86_64-code.bin'.
# grub2-mkrescue --directory=/usr/share/grub2/x86_64-efi --xorriso xorriso --output /tmp/tmpj1_hedln/grub2_theme_demo.img boot/grub/grub.cfg=/tmp/tmpj1_hedln/grub.cfg boot/grub/themes/DEMO/=/usr/share/grub/themes/openSUSE
xorriso 1.5.6 : RockRidge filesystem manipulator, libburnia project.
Drive current: -outdev 'stdio:/tmp/tmpj1_hedln/grub2_theme_demo.img'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 30.3g free
Added to ISO image: directory '/'='/tmp/grub.FmzQyz'
xorriso : UPDATE : 340 files added in 1 seconds
Added to ISO image: file '/boot/grub/grub.cfg'='/tmp/tmpj1_hedln/grub.cfg'
Added to ISO image: directory '/boot/grub/themes/DEMO'='/usr/share/grub/themes/openSUSE'
xorriso : UPDATE : 354 files added in 1 seconds
ISO image produced: 6356 sectors
Written to medium : 6356 sectors at LBA 0
Writing to 'stdio:/tmp/tmpj1_hedln/grub2_theme_demo.img' completed successfully.
INFO: Please give GRUB a moment to show up in QEMU...
# qemu-system-x86_64 -m 256 -drive file=/tmp/tmpj1_hedln/grub2_theme_demo.img,index=0,media=disk,format=raw -enable-kvm -drive if=pflash,format=raw,readonly,file=/usr/share/qemu/ovmf-x86_64-code.bin
qemu-system-x86_64: -drive if=pflash,format=raw,readonly,file=/usr/share/qemu/ovmf-x86_64-code.bin: warning: short-form boolean option 'readonly' deprecated
Please use readonly=on instead
Now it just sits on this:
Same for
grub2-theme-preview --display gtk /usr/share/grub/themes/openSUSE
and
grub2-theme-preview --resolution 1920x1080 /usr/share/grub/themes/openSUSE
$ qemu-system-x86_64 -display help
Available display backend types:
none
gtk
egl-headless
curses
spice-app
dbus
$ qemu-system-x86_64 --help | fgrep -A1 'default display'
The default display is equivalent to
"-display gtk"
@bartland thanks for sharing your findings! So grub doesn't even want to start? Your hardware supports EFI and KVM and KVM is enabled in the kernel, correct? I'm starting to run out of ideas what it could be. Is there any helpful display before that in the QEMU window during start-up? Does any of the non-VGA output show anything useful?
I tried those. They didn't help.
virt-manager works fine. I can run the Fedora iso.
@bartland can we rule out that it's the way we're starting QEMU? Can we rule out that the EFI output of grub-mkrescue is broken on openSUSE? Could you attach the rescue image so I can try it on my Debian EFI notebook at work on e.g. Thursday? (I have only non-EFI hardware at home.)
In case it's relevant - everything is grub2 not grub. e.g.
$ l /bin/grub2*
-rwxr-xr-x 1 root root 1542040 Oct 4 16:58 /bin/grub2-editenv
-rwxr-xr-x 1 root root 1347200 Oct 4 16:58 /bin/grub2-emu
-rwxr-xr-x 1 root root 1036056 Oct 4 16:58 /bin/grub2-file
-rwxr-xr-x 1 root root 1287896 Oct 4 16:58 /bin/grub2-fstest
-rwxr-xr-x 1 root root 113352 Oct 4 16:58 /bin/grub2-glue-efi
-rwxr-xr-x 1 root root 1684 Oct 4 16:58 /bin/grub2-kbdcomp
-rwxr-xr-x 1 root root 97016 Oct 4 16:58 /bin/grub2-menulst2cfg
-rwxr-xr-x 1 root root 142600 Oct 4 16:58 /bin/grub2-mkfont
-rwxr-xr-x 1 root root 464024 Oct 4 16:58 /bin/grub2-mkimage
-rwxr-xr-x 1 root root 119560 Oct 4 16:58 /bin/grub2-mklayout
-rwxr-xr-x 1 root root 534888 Oct 4 16:58 /bin/grub2-mknetdir
-rwxr-xr-x 1 root root 130192 Oct 4 16:58 /bin/grub2-mkpasswd-pbkdf2
-rwxr-xr-x 1 root root 298648 Oct 4 16:58 /bin/grub2-mkrelpath
-rwxr-xr-x 1 root root 1374696 Oct 4 16:58 /bin/grub2-mkrescue
-rwxr-xr-x 1 root root 640000 Oct 4 16:58 /bin/grub2-mkstandalone
-rwxr-xr-x 1 root root 948168 Oct 4 16:58 /bin/grub2-mount
-rwxr-xr-x 1 root root 980584 Oct 4 16:58 /bin/grub2-protect
-rwxr-xr-x 1 root root 1036416 Oct 4 16:58 /bin/grub2-render-label
-rwxr-xr-x 1 root root 145968 Oct 4 16:58 /bin/grub2-script-check
-rwxr-xr-x 1 root root 960848 Oct 4 16:58 /bin/grub2-syslinux2cfg
$ grub2-mkrescue -o bartland-grub2.iso
xorriso 1.5.6 : RockRidge filesystem manipulator, libburnia project.
Drive current: -outdev 'stdio:bartland-grub2.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 1152g free
Added to ISO image: directory '/'='/tmp/grub.t7mG4v'
xorriso : UPDATE : 668 files added in 1 seconds
xorriso : UPDATE : 668 files added in 1 seconds
xorriso : NOTE : Copying to System Area: 512 bytes from file '/usr/share/grub2/i386-pc/boot_hybrid.img'
ISO image produced: 9600 sectors
Written to medium : 9600 sectors at LBA 0
Writing to 'stdio:bartland-grub2.iso' completed successfully.
PS I'll be disappearing shortly for a few weeks (on a trek).
In case it's relevant - everything is grub2 not grub. e.g.
@bartland yes, it was renamed to to grub-mkrescue in Gentoo after GRUB 1.x was removed, it's all 2.x, yes, forgive my imprecision.
$ grub2-mkrescue -o bartland-grub2.iso xorriso 1.5.6 : RockRidge filesystem manipulator, libburnia project. Drive current: -outdev 'stdio:bartland-grub2.iso' Media current: stdio file, overwriteable Media status : is blank Media summary: 0 sessions, 0 data blocks, 0 data, 1152g free Added to ISO image: directory '/'='/tmp/grub.t7mG4v' xorriso : UPDATE : 668 files added in 1 seconds xorriso : UPDATE : 668 files added in 1 seconds xorriso : NOTE : Copying to System Area: 512 bytes from file '/usr/share/grub2/i386-pc/boot_hybrid.img'
Could you add --directory=/usr/share/grub2/x86_64-efi please? We can see here^^ that it's using i386-pc bios instead of amd64 EFI currently.
It boots fine, but it's not EFI yet. Happy to retry if you can share EFI.
PS I'll be disappearing shortly for a few weeks (on a trek).
Thanks for letting me know! :+1:
$ grub2-mkrescue -o bartland-grub2-efi.iso --directory=/usr/share/grub2/x86_64-efi
xorriso 1.5.6 : RockRidge filesystem manipulator, libburnia project.
Drive current: -outdev 'stdio:bartland-grub2-efi.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 1152g free
Added to ISO image: directory '/'='/tmp/grub.cuRJsF'
xorriso : UPDATE : 340 files added in 1 seconds
xorriso : UPDATE : 340 files added in 1 seconds
ISO image produced: 6316 sectors
Written to medium : 6316 sectors at LBA 0
Writing to 'stdio:bartland-grub2-efi.iso' completed successfully.
@bartland thanks for the image!
I tried…
qemu-system-x86_64 -m 256 -drive file=/tmp/tmp.59iLlGGpUI/bartland-grub2-efi.iso,index=0,media=disk,format=raw -enable-kvm -drive if=pflash,format=raw,readonly,file=/usr/share/OVMF/OVMF_CODE.fd
…on Debian bookworm with EFI hardware and a GRUB shell with GRUB 2.12 shows up successfully, so the rescue image you shared is bootable. To me that means it's either /usr/share/qemu/ovmf-x86_64-code.bin or QEMU that is the problem.
@bartland PS: G2TP_OVMF_IMAGE=XXXXXXXXXX grub2-theme-preview --verbose --plain-rescue-image "$(mktemp -d)" may be the most convenient to try out multiple OVMF images.
@bartland by now I learned that even on non-EFI hardware I can run EFI VMs in QEMU just find — which I understood that earlier. I was able to download qemu-ovmf-x86_64-202405-3.1 from https://download.opensuse.org/repositories/openSUSE:/Factory/standard/noarch/qemu-ovmf-x86_64-202405-3.1.noarch.rpm , convert to tar using rpm2tar and extract and then inspect all the images in there. Here's what I found:
1. Most come with a description:
# find -name \*.json | xargs grep description | sort
./usr/share/qemu/firmware/50-ovmf-x86_64-secure.json: "description": "UEFI firmware for x86_64, with Secure Boot and SMM",
./usr/share/qemu/firmware/50-ovmf-x86_64-secure-ms.json: "description": "UEFI firmware for x86_64, with Secure Boot, SMM, and MS certs enrolled",
./usr/share/qemu/firmware/50-ovmf-x86_64-secure-opensuse.json: "description": "UEFI firmware for x86_64, with Secure Boot, SMM, and openSUSE certs enrolled",
./usr/share/qemu/firmware/50-ovmf-x86_64-secure-suse.json: "description": "UEFI firmware for x86_64, with Secure Boot, SMM, and SUSE certs enrolled",
./usr/share/qemu/firmware/50-ovmf-x86_64-sev.json: "description": "UEFI firmware for x86_64, with AMD SEV",
./usr/share/qemu/firmware/50-xen-hvm-x86_64.json: "description": "UEFI firmware for x86_64 XENFV",
./usr/share/qemu/firmware/60-ovmf-x86_64-2m.json: "description": "UEFI firmware for x86_64 (legacy 2MB flash size)",
./usr/share/qemu/firmware/60-ovmf-x86_64-2m-ms.json: "description": "UEFI firmware for x86_64, with Secure Boot, and MS certs enrolled (legacy 2MB flash size)",
./usr/share/qemu/firmware/60-ovmf-x86_64-2m-opensuse.json: "description": "UEFI firmware for x86_64, with Secure Boot, and openSUSE certs enrolled (legacy 2MB flash size)",
./usr/share/qemu/firmware/60-ovmf-x86_64-2m-suse.json: "description": "UEFI firmware for x86_64, with Secure Boot, and SUSE certs enrolled (legacy 2MB flash size)",
./usr/share/qemu/firmware/60-ovmf-x86_64.json: "description": "UEFI firmware for x86_64",
./usr/share/qemu/firmware/60-ovmf-x86_64-ms.json: "description": "UEFI firmware for x86_64, with Secure Boot, and MS certs enrolled",
./usr/share/qemu/firmware/60-ovmf-x86_64-opensuse.json: "description": "UEFI firmware for x86_64, with Secure Boot, and openSUSE certs enrolled",
./usr/share/qemu/firmware/60-ovmf-x86_64-suse.json: "description": "UEFI firmware for x86_64, with Secure Boot, and SUSE certs enrolled",
2. Most images do not work (with regard to your bartland-grub2-efi.iso), but 3 of them do
usr/share/qemu/ovmf-x86_64-4m.bin: GOOD
usr/share/qemu/ovmf-x86_64-4m-code.bin: broken
usr/share/qemu/ovmf-x86_64.bin: GOOD
usr/share/qemu/ovmf-x86_64-code.bin: broken
usr/share/qemu/ovmf-x86_64-ms-4m.bin: broken
usr/share/qemu/ovmf-x86_64-ms-4m-code.bin: broken
usr/share/qemu/ovmf-x86_64-ms.bin: broken
usr/share/qemu/ovmf-x86_64-ms-code.bin: broken
usr/share/qemu/ovmf-x86_64-opensuse-4m.bin: broken
usr/share/qemu/ovmf-x86_64-opensuse-4m-code.bin: broken
usr/share/qemu/ovmf-x86_64-opensuse.bin: broken
usr/share/qemu/ovmf-x86_64-opensuse-code.bin: broken
usr/share/qemu/ovmf-x86_64-sev.bin: GOOD
usr/share/qemu/ovmf-x86_64-smm.bin: broken
usr/share/qemu/ovmf-x86_64-smm-code.bin: broken
usr/share/qemu/ovmf-x86_64-smm-ms.bin: broken
usr/share/qemu/ovmf-x86_64-smm-ms-code.bin: broken
usr/share/qemu/ovmf-x86_64-smm-opensuse.bin: broken
usr/share/qemu/ovmf-x86_64-smm-opensuse-code.bin: broken
usr/share/qemu/ovmf-x86_64-smm-suse.bin: broken
usr/share/qemu/ovmf-x86_64-smm-suse-code.bin: broken
usr/share/qemu/ovmf-x86_64-suse-4m.bin: broken
usr/share/qemu/ovmf-x86_64-suse-4m-code.bin: broken
usr/share/qemu/ovmf-x86_64-suse.bin: broken
usr/share/qemu/ovmf-x86_64-suse-code.bin: broken
I will add these three files to the auto-detect list for openSUSE as a pull request in a minute or two.
@bartland with both #334 and #335 merged now, I would expect Git master to work out of the box for openSUSE now. Can you confirm?
@bartland with both #334 and #335 merged now, I would expect Git
masterto work out of the box for openSUSE now. Can you confirm?
Nice work. Thanks. However I'm on the trek now, so will confirm when I get back in about 2 weeks or so.
@bartland works for me, have a good time! :beers:
@bartland are you back?
@bartland are you back?
I'm back. Jetlagged though. I'll have a look at things tomorrow.
I updated from master:
pipx install --editable . --force
grub2-theme-preview --version grub2-theme-preview 2.8.0 [FYI version number still the same]
unset G2TP_OVMF_IMAGE G2TP_GRUB_LIB
grub2-theme-preview /usr/share/grub/themes/openSUSE
Works perfectly. :)
Congrats on a brilliant tool.
@bartland perfect, thanks for testing! Release 2.9.0 with these fixes is now in PyPI.