packaging: install kernel modules under /usr/lib/modules - #120
Open
Bjordis Collaku (bjordiscollaku) wants to merge 1 commit into
Open
Bjordis Collaku (bjordiscollaku) wants to merge 1 commit into
Bjordis Collaku (bjordiscollaku) wants to merge 1 commit into
Conversation
Debian Policy 10.1, since 4.7.1, says packages must not install files into /bin, /lib or /sbin, which are symlinks into /usr on merged-/usr systems. The image package installed its modules, their build and source links, and the bundled DKMS modules under /lib/modules. kbuild hardcodes MODLIB to $(INSTALL_MOD_PATH)/lib/modules, so keep installing there and move the staged files with dh_movetousr, as Debian's own linux package does. dh_movetousr also rewrites the absolute build and source links into the relative form Policy 10.5 requires. The move runs from execute_after_dh_installdeb rather than at its usual place. dh_installmodules, called from override_dh_installdeb, only scans lib/modules when it adds the depmod maintainer script snippet, so moving the modules before it would silently drop that snippet. The dh-sequence-movetousr addon would run the helper too early for the same reason. Build-depend on debhelper 13.11.9, the first release where dh_movetousr also rewrites links pointing into aliased directories. Nothing moves between binary packages, so the DEP17 file loss case (P1) does not apply, and base-files ships the /lib symlink on trixie, forky and resolute, so /lib/modules keeps resolving on the target. Signed-off-by: Bjordis Collaku <bcollaku@qti.qualcomm.com>
Bjordis Collaku (bjordiscollaku)
deployed
to
Staging
September 17, 2026 17:06 — with
GitHub Actions
Active
Bjordis Collaku (bjordiscollaku)
deployed
to
Staging
September 17, 2026 17:07 — with
GitHub Actions
Active
Bjordis Collaku (bjordiscollaku)
deployed
to
Staging
September 17, 2026 17:08 — with
GitHub Actions
Active
Bjordis Collaku (bjordiscollaku)
deployed
to
Staging
September 17, 2026 17:08 — with
GitHub Actions
Active
Bjordis Collaku (bjordiscollaku)
marked this pull request as ready for review
September 17, 2026 19:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #119
Policy 10.1 (since 4.7.1) says packages must not install into /bin, /lib or /sbin. The image package still put its modules, the build and source links, and the bundled DKMS modules under /lib/modules.
kbuild hardcodes MODLIB to
$(INSTALL_MOD_PATH)/lib/modules, so the build keeps installing there anddh_movetousrmoves the staged files into /usr afterwards, the same way Debian's linux package does. It also rewrites the build and source links into the relative form Policy 10.5 wants.The move is hooked on
execute_after_dh_installdebon purpose.dh_installmodulesonly scans lib/modules when it adds the depmod snippet (same in debhelper 13.24.2 and 14.3), and it runs fromoverride_dh_installdeb, so moving any earlier, including throughdh-sequence-movetousr, would drop that snippet without an error.Debug symbols stay at /usr/lib/debug/lib/modules, which is already under /usr and is where crash and systemtap look.
Validation so far:
dh_movetousrships in the debhelper on trixie (13.24.2), forky (14.3) and resolute (13.31). Build-depends on 13.11.9 for its symlink handlingdh_movetousrandmake_symlinkcode against a staging tree laid out like ours: nothing left under lib/, build and source become../../../src/linux-headers-<KVER>, dbg, headers and metapackages untouched, permissions keptdh_movetousralso relocates the updates/qli paths packaging: ship out-of-tree DKMS modules as their own packages #114 addsBuild is green on trixie, forky and resolute, all five legs plus the S3 publishes. Checked the resulting packages from the resolute build: nothing is left under ./lib, the modules, extra/msm_kgsl.ko and modules.dep are at ./usr/lib/modules//, build and source point at ../../../src/linux-headers-, and the debug package is unchanged at ./usr/lib/debug/lib/modules/. The build log also shows dh_installmodules running before dh_movetousr, so the depmod snippet is still generated from the lib/modules layout.