Skip to content

grub-mkconfig silently generates no Linux menu entries due to missing pkgdatadir in /etc/grub.d/10_linux #4680

Description

@antraxbr666

Which ISO version are you using?

2026.07.01

The installation log

/var/log/archinstall/install.log does not exist — cleaned up after reboot from the live ISO. Full diagnostic output demonstrating the bug is included in the issue description above (bash -x trace, broken 10_linux excerpt, and workaround).

describe the problem

Description of the issue

I installed Arch Linux via archinstall on a desktop with:

  • CPU: AMD Ryzen 7 7700 (Zen 4)
  • GPU: AMD Radeon RX 9070 XT
  • RAM: 32 GB DDR5
  • Storage: 2x NVMe SSDs
  • Boot mode: UEFI

Selected GRUB as bootloader during archinstall. Installation completed successfully. After booting into the system, I installed additional kernels (linux-cachyos and linux-zen), then ran sudo grub-mkconfig -o /boot/grub/grub.cfg. The resulting GRUB menu shows only "Arch Linux", "Windows Boot Manager" and "UEFI Firmware Settings" — zero Linux entries.

Kernels and initramfs images are present in /boot/:

/boot/vmlinuz-linux-cachyos /boot/vmlinuz-linux-zen /boot/initramfs-linux-cachyos.img /boot/initramfs-linux-zen.img /boot/amd-ucode.img

grub-probe works fine:

$ sudo grub-probe --target=device /boot && echo "OK" || echo "FAILED"
/dev/nvme1n1p1
OK

But running the kernel detection script manually reveals the bug:

$ sudo bash -x /etc/grub.d/10_linux 2>&1 | tail -5

  • set -e
  • prefix=/usr
  • exec_prefix=/usr
  • datarootdir=/usr/share
  • . /grub-mkconfig_lib
    /etc/grub.d/10_linux: line 24: /grub-mkconfig_lib: No such file or directory

The /etc/grub.d/10_linux generated by archinstall is missing the pkgdatadir variable:
```console
# archinstall's broken version:
prefix="/usr"
exec_prefix="/usr"
datarootdir="/usr/share"

. "$pkgdatadir/grub-mkconfig_lib"   # pkgdatadir is never set → expands to /grub-mkconfig_lib

The correct version (from the grub package) should be:

prefix="/usr"
exec_prefix="/usr"
datarootdir="/usr/share"
pkgdatadir="/usr/share/grub"

. "$pkgdatadir/grub-mkconfig_lib"

Because set -e is active and pkgdatadir is empty, the script dies silently without generating any menuentry blocks. grub-mkconfig reports no errors whatsoever.

Reinstalling grub (sudo pacman -S grub) does not fix it because /etc/grub.d/10_linux is treated as a config file — pacman preserves the broken version and writes the correct one only as .pacnew.

Workaround:

$ sudo sed -i '/^datarootdir=/a pkgdatadir="/usr/share/grub"' /etc/grub.d/10_linux
$ sudo grub-mkconfig -o /boot/grub/grub.cfg
$ grep -E "^menuentry " /boot/grub/grub.cfg
menuentry 'Arch Linux (CachyOS)' ...
menuentry 'Arch Linux (Zen)' ...
menuentry 'Windows Boot Manager' ...

Expected behavior: grub-mkconfig should detect all installed kernels and generate proper menuentry blocks after a fresh archinstall.

ok?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions