Issue
While running a regular apt upgrade
, apt shows me that there's a new kernel, but the installation fails with the following message:
Setting up linux-image-4.19.0-18-amd64 (4.19.208-1) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.19.0-18-amd64
cp: -r not specified; omitting directory '/etc/udev/rules.d/70-persistent-net.rules'
E: /usr/share/initramfs-tools/hooks/udev failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.19.0-18-amd64 with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-4.19.0-18-amd64 (--configure):
installed linux-image-4.19.0-18-amd64 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-amd64:
linux-image-amd64 depends on linux-image-4.19.0-18-amd64; however:
Package linux-image-4.19.0-18-amd64 is not configured yet.
Errors were encountered while processing:
linux-image-4.19.0-18-amd64
linux-image-amd64
initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
And it just won't generate a new initrd
. None of apt install -f
, dpkg-reconfigure linux-image-4.19.0-18-amd64
, dpkg-reconfigure initramfs-tool
work. I also downloaded those deb files but also to no avail. What should I go on?
Solution
The error message hinted that the error is located at /usr/share/initramfs-tools/hooks/udev
.
Near the end of the script you can find something like
# now copy all custom udev rules which don't have an equivalent in /lib (e. g.
# 70-persistent-net.rules or similar); They might contain network names or
# other bits which are relevant for the initramfs.
for rules in /etc/udev/rules.d/*.rules; do
if [ -e "$rules" ] && [ ! -e "/lib/${rules#/etc/}" ]; then
cp -p "$rules" "$DESTDIR/lib/udev/rules.d/"
fi
done
Add a -r
option to cp
like cp -rp "$rules" "$DESTDIR/lib/udev/rules.d/
and everything runs smoothly after apt install -f
.
Answered By - dibery