Bug#1053959: grub-common: Upgrade from bookworm results in kernel packages configuration errors

Алексей Шилин rootlexx at mail.ru
Sat Oct 14 21:29:49 BST 2023


Package: grub-common
Version: 2.12~rc1-11

Hi,

Upgrading from bookworm to sid currently results in the following
message at the end:

   Errors were encountered while processing:
   linux-image-6.5.0-1-amd64
   linux-image-amd64
   
After looking through apt (term.log) and dpkg (dpkg.log) log files
(both are attached), it seems that it's caused by grub-common.

Here are the relevant parts from term.log:

   Preparing to unpack .../085-grub-common_2.12~rc1-11_amd64.deb ...
   Unpacking grub-common (2.12~rc1-11) over (2.06-13+deb12u1) ...
   
   [ skip ]
   
   Setting up linux-image-6.5.0-1-amd64 (6.5.3-1) ...
   I: /vmlinuz.old is now a symlink to boot/vmlinuz-6.1.0-13-amd64
   I: /initrd.img.old is now a symlink to boot/initrd.img-6.1.0-13-
   amd64
   I: /vmlinuz is now a symlink to boot/vmlinuz-6.5.0-1-amd64
   I: /initrd.img is now a symlink to boot/initrd.img-6.5.0-1-amd64
   /etc/kernel/postinst.d/initramfs-tools:
   update-initramfs: Generating /boot/initrd.img-6.5.0-1-amd64
   /etc/kernel/postinst.d/zz-update-grub:
   Generating grub configuration file ...
   /etc/grub.d/10_linux: 1: version_find_latest: not found
   run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return
   code 127
   dpkg: error processing package linux-image-6.5.0-1-amd64 (--
   configure):
   installed linux-image-6.5.0-1-amd64 package post-installation script
   subprocess returned error exit status 1
   
   [ skip ]
   
   Setting up grub-common (2.12~rc1-11) ...
   Installing new version of config file /etc/grub.d/00_header ...
   Installing new version of config file /etc/grub.d/10_linux ...
   Installing new version of config file /etc/grub.d/20_linux_xen ...
   Installing new version of config file /etc/grub.d/30_os-prober ...
   Installing new version of config file /etc/grub.d/30_uefi-firmware
   ...
   
So here's what's happening:
 * /etc/grub.d/10_linux in bookworm is using `version_find_latest`
   shell function defined in /usr/share/grub/grub-mkconfig_lib.
 * That function no longer exists in grub-mkconfig_lib in sid.
 * /etc/grub.d/10_linux is marked as configuration file in the package
   while /usr/share/grub/grub-mkconfig_lib is not.
 * During the upgrade, the following sequence occurs:
      1. New grub-common is unpacked. As the result, /usr/share/grub/grub-
         mkconfig_lib is now the new version which doesn't have
         `version_find_latest` function defined, but /etc/grub.d/10_linux
         is still the old version since it's a configuration file.
      2. linux-image-6.5.0-1-amd64 is unpacked.
      3. linux-image-6.5.0-1-amd64 is configured. As the result, scripts
         under /etc/kernel/postinst.d are executed which in turn run
         `update-grub`.
      4. `update-grub` tries to run /etc/grub.d/10_linux (which is still
         the old version as grub-common is not configured yet), which
         fails due to being unable to find `version_find_latest` in new
         version of grub-mkconfig_lib. As the result, the kernel package
         enters half-configured state.
      5. grub-common is finally configured, and only then new versions of
         files under /etc/grub.d are installed.
 * As the result of the above, the upgrade ends with an error leaving
   kernel packages half-configured.

So the root issue is that grub-common files which depend on each other
are installed at different times which results in a window when running
`update-grub` will fail, and kernel packages happen to be extracted and
configured during that window.

The error vanishes after re-running the upgrade command which, given
that all grub-common files are now in place, finishes successfully,
hence the "normal" severity. Still a bug though.

-- 
Алексей Шилин <rootlexx at mail.ru>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dpkg.log.xz
Type: application/x-xz
Size: 11528 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-grub-devel/attachments/20231014/c43612fb/attachment-0002.xz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: term.log.xz
Type: application/x-xz
Size: 10020 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-grub-devel/attachments/20231014/c43612fb/attachment-0003.xz>


More information about the Pkg-grub-devel mailing list