GRUB: use persistent device names under /dev/disk/by-id/ for install_devices mika/grub
authorMichael Prokop <mika@grml.org>
Fri, 31 Mar 2023 10:14:09 +0000 (12:14 +0200)
committerMichael Prokop <mika@grml.org>
Fri, 31 Mar 2023 10:17:10 +0000 (12:17 +0200)
commitb379e2401637be5569cd87f26e39bc54549fa834
tree4c465fecb2fd87fec9a1ce59816c11e8f95417c0
parent8aed9f5ae9266c199568b8ae6ebd142ab5625899
GRUB: use persistent device names under /dev/disk/by-id/ for install_devices

We pass the requested --grub … device argument to the GRUB package
configuration, like:

| # debconf-show grub-pc | grep grub-pc/install_devices:
| * grub-pc/install_devices: /dev/sda

But the GRUB package tries to use /dev/disk/by-id/... for
install_devices setting (since 2010 and Debian/squeeze AFAICS), as can
be observed by reconfiguring the GRUB package (which then automatically
converts the /dev/sdX to the proper /dev/disk/by-id/... device when
being asked in the debconf prompt):

| # dpkg-reconfigure grub-pc
| grub-pc: Running grub-install ...
| [...]
| # debconf-show grub-pc | grep grub-pc/install_devices:
| * grub-pc/install_devices: /dev/disk/by-id/ata-VBOX_HARDDISK_VBf4f4391c-6316fa69

The available_ids() and device_to_id() helper functions are based on
code by Colin Watson <cjwatson@debian.org> in GRUB's postinst script
of the Debian package, see git commits 4830efd9e + ce2a43c85 at
https://salsa.debian.org/grub-team/grub.git.

Closes: https://github.com/grml/grml-debootstrap/issues/206
chroot-script