Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 765208 - sys-kernel/dracut: Can't find a uefi stub '/usr/lib/gummiboot/linuxx64.efi.stub' to create a UEFI executable
Summary: sys-kernel/dracut: Can't find a uefi stub '/usr/lib/gummiboot/linuxx64.efi.st...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Patrick McLean
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-13 12:41 UTC by Michał Górny
Modified: 2021-01-19 21:57 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Fix detection of UEFI stub on split-usr systems (0001-Fix-detection-of-UEFI-stub-on-split-usr-systems.patch,1.49 KB, patch)
2021-01-19 20:25 UTC, Mike Gilbert
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-01-13 12:41:21 UTC
If I add to my dracut.conf:

  uefi=yes

then dracut fails with:

  dracut: Can't find a uefi stub '/usr/lib/gummiboot/linuxx64.efi.stub' to create a UEFI executable

However, according to the manpage it should just work™:

       --uefi-stub <FILE>
           Specifies the UEFI stub loader, which will load the attached kernel, initramfs and kernel command line and boots the kernel. The
           default is $prefix/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub or
           $prefix/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub

and /usr/lib/systemd/boot/efi/linuxx64.efi.stub does exist.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-01-13 12:42:59 UTC
The relevant code in /usr/bin/dracut seems to be :

        if ! [[ -s $uefi_stub ]]; then
            for uefi_stub in \
                $dracutsysrootdir"${systemdutildir}/boot/efi/linux${EFI_MACHINE_TYPE_NAME}.efi.stub" \
                    "$dracutsysrootdir/usr/lib/gummiboot/linux${EFI_MACHINE_TYPE_NAME}.efi.stub"; do
                [[ -s $uefi_stub ]] || continue
                break
            done
        fi


where systemdutildir is:

$ pkg-config systemd --variable=systemdutildir
/lib/systemd
Comment 2 Witaut Bajaryn 2021-01-19 17:06:28 UTC
I am experiencing this as well, but on an openrc system.

# dracut --uefi
cat: /usr/lib/os-release: No such file or directory
dracut: Executing: /usr/bin/dracut --uefi
dracut: Can't find a uefi stub '/usr/lib/gummiboot/linuxx64.efi.stub' to create a UEFI executable

# dracut --uefi --uefi-stub /usr/lib/systemd/boot/efi/linuxx64.efi.stub
<...>
dracut: *** Creating image file '/boot/EFI/Linux/linux-5.4.51-gentoo-x86_64-2bd880c4efdaa26032a95a625bcfa929.efi' ***
dracut: Using UEFI kernel cmdline:
^C


On my system, there is no systemd pkg-config file:

# pkg-config systemd --variable=systemdutildir
Package systemd was not found in the pkg-config search path.
Perhaps you should add the directory containing `systemd.pc'
to the PKG_CONFIG_PATH environment variable
No package 'systemd' found

Also, while investigating a related issue in ZFSBootMenu [1], a developer mentioned that dracut would try to look at [/usr]/lib/systemd/systemd-udevd to try to determine $systemdutildir. It turns out that I don't have that either:

# ls /lib/systemd/systemd-udevd
ls: cannot access '/lib/systemd/systemd-udevd': No such file or directory
# ls /usr/lib/systemd/systemd-udevd
ls: cannot access '/usr/lib/systemd/systemd-udevd': No such file or directory


[1] https://github.com/zbm-dev/zfsbootmenu/issues/135#issuecomment-761728463
Comment 3 Mike Gilbert gentoo-dev 2021-01-19 20:25:11 UTC
Created attachment 683770 [details, diff]
Fix detection of UEFI stub on split-usr systems

Here's a patch; please test it.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-01-19 21:47:14 UTC
(In reply to Mike Gilbert from comment #3)
> Created attachment 683770 [details, diff] [details, diff]
> Fix detection of UEFI stub on split-usr systems
> 
> Here's a patch; please test it.

I can confirm that it works as expected.
Comment 5 Witaut Bajaryn 2021-01-19 21:57:36 UTC
The patch works for me as well (dracut-050-r2, /etc/portage/patches), thanks!