It happens that users compile external Linux kernel modules for kernels that are not currently running on the system. This causes KV_OUT_DIR variable to not be properly set in get_version() declared inside linux-info.eclass. There is an incorrect check at line 498 that says: [ "${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}" == "$(uname -r)" ] && \ OUTPUT_DIR="..." (which is going to be used to setup KV_OUT_DIR) It's clear that $(uname -r) returns kernel release for the _running_ kernel, which results in two main, issues: 1. KV_OUT_DIR is thus set to /usr/src/linux instead of /lib/modules/<version>/build (which is the proper way) 2. KV_OUT_DIR set to /usr/src/linux causes pkg_setup to fail when using binpkgs (emerge -B on PC1 && emerge -K on PC2). KV_OUT_DIR should be ALWAYS set to the most reliable path (/usr/src/linux is too generic). Removing the conditional at line 498 seems to solve the issues without any regressions (here). Fact is, using `uname -r` is NOT really something that should be used there. So, patch would be very easy, as in rip off this line completely: "[ "${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}" == "$(uname -r)" ] && \" Reproducible: Always
Moreover, having a wrongly set KV_OUT_DIR (== /usr/src/linux) causes depmod to not be properly run for the "selected" kernel if such variable points to an invalid location.
Committed in rev 1.81 now.