Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 843821 - dist-kernel eclasses install broken symlink on merged /usr systems
Summary: dist-kernel eclasses install broken symlink on merged /usr systems
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Distribution Kernel Project
Keywords: PullRequest
Depends on:
Blocks: usrmerge, usrmerge-fixes
  Show dependency tree
Reported: 2022-05-11 21:12 UTC by Georgy Yakovlev
Modified: 2022-09-06 15:43 UTC (History)
3 users (show)

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


Note You need to log in before you can comment on or make changes to this bug.
Description Georgy Yakovlev archtester gentoo-dev 2022-05-11 21:12:44 UTC
on merged usr system /lib/modules/<kernel>/{build,source} symlinks installed by gentoo-kernel, gentoo-kernel-bin and vanilla-kernel packages are broken.

# ( canonicalize missing )
realpath -m source  

cd /usr/lib/modules/5.15.35-talos64/
realpath -m source 

so the relative symlink is broken from both /usr/lib/modules and /lib/modules locations.

Probably best solution is to introduce USE=split-usr and change the symlinks based on that.
Comment 1 Georgy Yakovlev archtester gentoo-dev 2022-05-15 11:22:12 UTC
so I identified 2 places where it goes wrong.

1st - source builds.

kernel-build.eclass does that in kernel-build_src_install()

>    # fix source tree and build dir symlinks
>    dosym ../../../usr/src/linux-${ver} /lib/modules/${ver}/build
>    dosym ../../../usr/src/linux-${ver} /lib/modules/${ver}/source

so it will need to add extra ../ based on condition for merged-usr systems.

second situation is binpkgs.

xpak files always contains /lib/modules/${ver}

but after being installed to usrmerged system it effectively becomes /usr/lib/modules/${ver}

so we need to handle binpkgs as well, so not in kernel-build only.
Comment 2 Larry the Git Cow gentoo-dev 2022-09-06 15:43:30 UTC
The bug has been closed via the following commit(s):

commit 7f907ce3d78a95139ebad835ae9a3d9ae123d9c6
Author:     Mike Gilbert <>
AuthorDate: 2022-09-06 01:20:03 +0000
Commit:     Mike Gilbert <>
CommitDate: 2022-09-06 15:41:41 +0000

    kernel-install.eclass: pkg_preinst: fix symlinks for merged-usr
    Signed-off-by: Mike Gilbert <>

 eclass/kernel-install.eclass | 6 ++++++
 1 file changed, 6 insertions(+)