Package: debirf
Severity: normal
Version: 0.37
Dear Maintainer,
when I tried building an initrd based upon stretch + stretch-backports,
I noticed that the wrong kernel had been selected: From the apt sources
and preferences I had configured to be used inside the chroot, I would
have expected the kernel from stretch-backports
(linux-image-4.17.0-0.bpo.1-amd64 at the time) to be installed; instead
I got the version from stretch (linux-image-4.9.0-7-amd64).
It turns out that linux-image-* package selection in the default
install-kernel module is fragile if multiple kernel versions are
available because "sort -r" will not always select the newest version.
Please consider my patch that uses apt to determine the version. This
has the added benefit that any a preferences that have been configured
are honored.
Thanks.
Cheers,
-Hilko
--- /usr/share/debirf/modules/install-kernel 2017-05-18 18:10:07.000000000 +0200
+++ install-kernel 2018-08-04 15:54:22.806297546 +0200
@@ -27,24 +27,8 @@
# download/copy in kernel package
if [ -z "$DEBIRF_KERNEL_PACKAGE" ] ; then
# determine kernel to install. assume arch of build host.
-
- # determine kernel arch. need everything after the kernel version
- # and debian version
KARCH=${DEBIRF_KERNEL_FLAVOR:-$(uname -r | cut -d- -f3-)}
-
- # determine the full kernel version from the dependency of the
- # generic linux-image-ARCH package in the debirf root (since it
- # may be different than what is installed on the build host)
- KNAME=$(debirf_exec apt-cache show linux-image-"$KARCH" | grep '^Depends: ' | sed 's/^Depends: //' | tr ',' '\n' | tr -d ' ' | grep ^linux-image | sort -r | head -n1)
-
- # download only the desired kernel package for later dpkg
- # extraction. this also downloads the kernel dependencies, but
- # they will not be installed, and the downloaded packages will all
- # be purged in the end by the clean-root module. it would be nice
- # to just use "apt-get download", but that's only supported since
- # wheezy.
- debirf_exec apt-get install -d -y "$KNAME"
-
+ debirf_exec apt-get install -d -y linux-image-"$KARCH"
else
# install kernel deb if given at command line
cp "$DEBIRF_KERNEL_PACKAGE" "$DEBIRF_ROOT"/var/cache/apt/archives/