]> git.ipfire.org Git - thirdparty/dracut-ng.git/commit
fix(dracut.sh): do not use uname to detect kernel version in a container
authorJo Zzsi <jozzsicsataban@gmail.com>
Wed, 16 Jul 2025 14:21:01 +0000 (10:21 -0400)
committerLaszlo <laszlo.gombos@gmail.com>
Fri, 18 Jul 2025 15:37:47 +0000 (11:37 -0400)
commit2b2debd7947b7d5a357c1a89691a75dfd3565747
treeab33358669d2f90bcf62407a46be1dbc84916646
parent950475e848c9eec03b5283bfd1d8722c051edd2d
fix(dracut.sh): do not use uname to detect kernel version in a container

A big general papercut with dracut right now in that it always assumes
the kernel it's running on is the kernel to target.

This commit lets dracut to detect that it's in a container (e.g. systemd-detect-virt -c),
and check for a single /usr/lib/modules/$kver directory and automatically use that kernel.

Currently this kernel version detection has three copies in the source
(dracut.sh, lsinitrd.sh,test-functions). This commit keeps the
logic for the three copies the same. As a follow-up commit, we should
try to actually share the code for this logic instead of copying it.

Fixes https://github.com/dracut-ng/dracut-ng/issues/1455.
dracut.sh