FYI: update-grub / grub-mkconfig somewhat "broken"

Tom H tomh0665 at gmail.com
Mon Feb 15 11:54:52 UTC 2021


On Sun, Feb 14, 2021 at 4:09 PM Robert Heller <heller at deepsoft.com>
wrote:


> For what it is worth:
>
> The default setup for grub-mkconfig is somewhat "broken". It
> poorly handles the case where there is a shared /boot file system
> shared by two or more Linux distros. I have two systems that can
> dual boot Ubuntu 18.04 (4.15.0-* kernels) and CentOS 6.10
> (2.6.32-* kernels). The default behaviour will include the options
> to boot with a 2.6.32 kernel with the Ubuntu root file system (this
> really won't work!)

How's grub supposed to know which kernel belongs to which installation
is "/boot" is shared?! grub-mkconfig's not broken, your setup is. The
only way to deal with your setup would be for grub-mkconfig to check
"/etc/os-release" and use the appropriate tool, dpkg/pacman/rpm/...,
to query the package database and find out which kernels are owned by
which of the installed distros.


> Also I found an interesting passage in the grub manual:
>
> " grub-mkconfig does have some limitations. While adding extra
> custom menu entries to the end of the list can be done by editing
> '/etc/grub.d/40_custom' or creating '/boot/grub/custom.cfg',
> changing the order of menu entries or changing their titles may
> require making complex changes to shell scripts stored in
> '/etc/grub.d/'. This may be improved in the future. In the
> meantime, those who feel that it would be easier to write 'grub.cfg'
> directly are encouraged to do so (see Chapter 5 [Booting], page 15,
> and Section 6.3 [Shell-like scripting], page 25), and to disable
> any system provided by their distribution to automatically run
> grub-mkconfig."
>
> So it seems that even the grub devs don't full trust
> grub-mkconfig...

Your dislike of grub's making you misinterpret the above. The
developers are simply saying that the more that you want to customize
"/boot/grub/grub.cfg", the more complex the changes that you have to
make have to be.




More information about the ubuntu-users mailing list