# dpkg-query -W initramfs-tools linux-base initramfs-tools 0.140ubuntu4 linux-base 4.5ubuntu8
# cat /etc/kernel-img.conf do_symlinks = yes do_bootloader = no do_initrd = yes link_in_boot = no # ls -latr / | grep '> boot' # apt install linux-generic # ls -l / | grep '> boot' lrwxrwxrwx 1 root root 33 May 27 13:12 initrd.img -> boot/initrd.img-5.11.0-16-generic lrwxrwxrwx 1 root root 33 May 27 13:12 initrd.img.old -> boot/initrd.img-5.11.0-16-generic lrwxrwxrwx 1 root root 30 May 27 13:12 vmlinuz -> boot/vmlinuz-5.11.0-16-generic lrwxrwxrwx 1 root root 30 May 27 13:12 vmlinuz.old -> boot/vmlinuz-5.11.0-16-generic # apt install linux-lowlatency # ls -l / | grep '> boot' lrwxrwxrwx 1 root root 36 May 27 13:17 initrd.img -> boot/initrd.img-5.11.0-16-lowlatency lrwxrwxrwx 1 root root 33 May 27 13:12 initrd.img.old -> boot/initrd.img-5.11.0-16-generic lrwxrwxrwx 1 root root 33 May 27 13:17 vmlinuz -> boot/vmlinuz-5.11.0-16-lowlatency lrwxrwxrwx 1 root root 30 May 27 13:12 vmlinuz.old -> boot/vmlinuz-5.11.0-16-generic Grab a "self-built" kernel # wget https://kernel.ubuntu.com/~kernel-ppa/mainline/daily/2021-05-26/amd64/linux-image-unsigned-5.13.0-051300rc3daily20210526-generic_5.13.0-051300rc3daily20210526.202105252209_amd64.deb # wget https://kernel.ubuntu.com/~kernel- ppa/mainline/daily/2021-05-26/amd64/linux- modules-5.13.0-051300rc3daily20210526-generic_5.13.0-051300rc3daily20210526.202105252209_amd64.deb # dpkg-deb -x linux-modules-5.13.0-051300rc3daily20210526-generic_5.13.0-051300rc3daily20210526.202105252209_amd64.deb linux/ # dpkg-deb -x linux-image-unsigned-5.13.0-051300rc3daily20210526-generic_5.13.0-051300rc3daily20210526.202105252209_amd64.deb linux/ # cp -r linux/lib/modules/5.13.0-051300rc3daily20210526-generic /lib/modules/ # installkernel 5.13.0-051300rc3daily202 10526-generic ./linux/boot/vmlinuz-5.13.0-051300rc3daily20210526-generic ./linux/boot/System.map-5.13.0-051300rc3daily20210526-generic run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 5.13.0-051300rc3daily20210526-generic /boot/vmlinuz-5.13.0-051300rc3daily20210526-generic run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.13.0-051300rc3daily20210526-generic /boot/vmlinuz-5.13.0-051300rc3daily20210526-generic update-initramfs: Generating /boot/initrd.img-5.13.0-051300rc3daily20210526-generic # ls -l / | grep '> boot' lrwxrwxrwx 1 root root 36 May 27 13:29 initrd.img -> boot/initrd.img-5.11.0-16-lowlatency lrwxrwxrwx 1 root root 33 May 27 13:33 initrd.img.old -> boot/initrd.img-5.11.0-16-generic lrwxrwxrwx 1 root root 33 May 27 13:29 vmlinuz -> boot/vmlinuz-5.11.0-16-lowlatency lrwxrwxrwx 1 root root 30 May 27 13:29 vmlinuz.old -> boot/vmlinuz-5.11.0-16-generic and fail.... Let's see what's wrong with my patch. -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux-base in Ubuntu. https://bugs.launchpad.net/bugs/1929255 Title: update-initrd-links creates incorrect symlinks Status in linux-base package in Ubuntu: Confirmed Status in linux-base source package in Bionic: Confirmed Status in linux-base source package in Focal: New Status in linux-base source package in Groovy: New Status in linux-base source package in Hirsute: New Status in linux-base source package in Impish: Confirmed Bug description: [Impact] ## Problem description Executing the `/etc/kernel/postinst.d/xx-update-initrd-links` script incorrectly detects symbolic links targets and then creates malformed (hence broken) ones instead: /initrd.img -> initrd.imgboot/vmlinuz-5.3.0-53-generic /initrd.img.old -> initrd.imgboot/vmlinuz-5.3.0-53-generic while it should actually be: /initrd.img -> boot/initrd.img-5.3.0-53-generic /initrd.img.old -> boot/initrd.img-5.3.0-53-generic The problem appeared with the release of the version 4.5ubuntu1.5 of the linux-base package, which made this script executable. [Test Plan] * Install new linux-base and initramfs-tools * create /etc/kernel-img.conf with do_symlinks = yes do_bootloader = no do_initrd = yes link_in_boot = yes * Install one kernel flavour, check that symlinks in /boot have sane targets * Install another kernel, check that symlinks in /boot/ have sane targets * create a selfbuilt kernel and install it by calling installkernel (you can download kernel debs from kernel-ppa, and unpack them to pretend one has self built it). and check that symlinks in /boot have sane targets. * Purge all kernel, and remove symlinks in /boot * Update /etc/kernel-img.conf to do_symlinks = yes do_bootloader = no do_initrd = yes link_in_boot = no * Install one kernel flavour, check that symlinks in / have sane targets * Install another kernel, check that symlinks in / have sane targets * create a selfbuilt kernel and install it by calling installkernel (you can download kernel debs from kernel-ppa, and unpack them to pretend one has self built it) * remove all kernels, purge initramfs-tools, clean up symlinks in / and /boot * repeat all of the above, without having initramfs-tools installed. I.e. install kernels _without_ recommneds. [Where problems could occur] * The rewritten postinst.d script now simply mostly calls linux- update-links like the normal linux-image postinst script does. One has to make sure that .deb installations of kernels happens correctly and that installkernel way of installing kernels happens correctly. Under different kernel-img.conf settings. The previous incarnations of fixing this and related issues did not account for the above cases and codepaths. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux-base/+bug/1929255/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp