[PR #34] mkinitcpio: use a resolvable module entry for the systemd hook #127

Open
opened 2026-10-26 16:41:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Zagitta/gpu-unlock/pull/34
Author: @alex-tee
Created: 10/24/2026
Status: 🔄 Open

Base: main ← Head: mkinitcpio-systemd-hook-fix


📝 Commits (1)

  • 014779a mkinitcpio: use a resolvable module entry for the systemd hook

📊 Changes

2 files changed (+33 additions, -8 deletions)

View changed files

📝 packaging/boot/mkinitcpio.conf (+12 -3)
📝 tests/test_packaging.py (+21 -5)

📄 Description

The packaged drop-in appends gpu_unlock? to MODULES. The ? suffix is
a mkinitcpio build-time convention (meaningful only to add_module), but
with the systemd hook in HOOKS, MODULES is copied verbatim into
/etc/modules-load.d/MODULES.conf, where kmod cannot resolve the suffix:

systemd-modules-load[175]: Failed to find module 'gpu_unlock?'

so on systemd-hook systems the module is never inserted and the card
stays stock. nvidia binds it a moment later.

This resolves the entry at config-parse time with
modinfo -k $KERNELVERSION, which is available when mkinitcpio sources
the config:

  • module built for the kernel being imaged → insert the plain name
    (gpu_unlock), which both the busybox init and the systemd hook's
    modules-load.d copy load correctly, still right before nvidia
  • module not built for that kernel → insert nothing, so image builds
    keep succeeding (previously covered by the ? skip)

The packaging test now mocks modinfo via PATH so both the resolved and
unresolved paths are deterministic on any machine.

Verified on Arch Linux: mkinitcpio 42.2, systemd hook, GRUB, kernel
7.2.11-arch1-1, NVIDIA 615.78.08 (nvidia-open), RTX 3090 at 0000:01:00.0.
The image's etc/modules-load.d/MODULES.conf contains gpu_unlock, and
a cold boot logs:

kernel: pci 0000:01:00.0: gpu_unlock: unlocked

Fixes #29


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Zagitta/gpu-unlock/pull/34 **Author:** [@alex-tee](https://github.com/alex-tee) **Created:** 10/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `mkinitcpio-systemd-hook-fix` --- ### 📝 Commits (1) - [`014779a`](https://github.com/Zagitta/gpu-unlock/commit/014779a279b82f866103c5c26051d7929e9933b6) mkinitcpio: use a resolvable module entry for the systemd hook ### 📊 Changes **2 files changed** (+33 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `packaging/boot/mkinitcpio.conf` (+12 -3) 📝 `tests/test_packaging.py` (+21 -5) </details> ### 📄 Description The packaged drop-in appends `gpu_unlock?` to MODULES. The `?` suffix is a mkinitcpio build-time convention (meaningful only to `add_module`), but with the `systemd` hook in HOOKS, MODULES is copied verbatim into `/etc/modules-load.d/MODULES.conf`, where kmod cannot resolve the suffix: systemd-modules-load[175]: Failed to find module 'gpu_unlock?' so on systemd-hook systems the module is never inserted and the card stays stock. `nvidia` binds it a moment later. This resolves the entry at config-parse time with `modinfo -k $KERNELVERSION`, which is available when mkinitcpio sources the config: - module built for the kernel being imaged → insert the plain name (`gpu_unlock`), which both the busybox init and the systemd hook's modules-load.d copy load correctly, still right before `nvidia` - module not built for that kernel → insert nothing, so image builds keep succeeding (previously covered by the `?` skip) The packaging test now mocks `modinfo` via PATH so both the resolved and unresolved paths are deterministic on any machine. Verified on Arch Linux: mkinitcpio 42.2, `systemd` hook, GRUB, kernel 7.2.11-arch1-1, NVIDIA 615.78.08 (nvidia-open), RTX 3090 at 0000:01:00.0. The image's `etc/modules-load.d/MODULES.conf` contains `gpu_unlock`, and a cold boot logs: kernel: pci 0000:01:00.0: gpu_unlock: unlocked Fixes #29 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Zagitta/gpu-unlock#127
No description provided.