on merged usr system /lib/modules/<kernel>/{build,source} symlinks installed by gentoo-kernel, gentoo-kernel-bin and vanilla-kernel packages are broken. pwd /lib/modules/5.15.35-talos64 # ( canonicalize missing ) realpath -m source /usr/usr/src/linux-5.15.35-talos64 cd /usr/lib/modules/5.15.35-talos64/ realpath -m source /usr/usr/src/linux-5.15.35-talos64 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.
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.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7f907ce3d78a95139ebad835ae9a3d9ae123d9c6 commit 7f907ce3d78a95139ebad835ae9a3d9ae123d9c6 Author: Mike Gilbert <floppym@gentoo.org> AuthorDate: 2022-09-06 01:20:03 +0000 Commit: Mike Gilbert <floppym@gentoo.org> CommitDate: 2022-09-06 15:41:41 +0000 kernel-install.eclass: pkg_preinst: fix symlinks for merged-usr Closes: https://bugs.gentoo.org/843821 Signed-off-by: Mike Gilbert <floppym@gentoo.org> eclass/kernel-install.eclass | 6 ++++++ 1 file changed, 6 insertions(+)