[vserver] "update-grub" patch to prioritize VServer kernels before the others on Debian

From: Jean Weisbuch <jean_at_phpnet.org>
Date: Mon 30 Nov 2015 - 17:47:51 GMT
Message-ID: <565C8BC7.4080109@phpnet.org>

Here are the simples patches i apply during the post install of my
Debian preseeded installations to prioritize VServer-Beng, Proxmox and
OpenVZ kernels (you just have to modify the egrep regex if you want to
match other kernels) to be put before the other ones when "grub-update"
is ran on the system and thus put at first on "/boot/grub/grub.cfg".

No need to mess anymore with the "GRUB_DEFAULT" on /etc/debian/grub-pc
nor to remove the Debian kernels if you dont want to have problems in
case you would use older VServer/Proxmox/OpenVZ kernels than the ones
from Debian.

As the kernel version comparison is made using "dpkg
--compare-versions", the trick is to simply add an epoch of "1:" before
the kernel version on the comparison variable on
"/usr/share/grub/grub-mkconfig_lib" (which is used by "update-grub).
The kernels with the epoch as a prefix will have an absolute priority
over the ones without it but the order between "prioritized ones" will
still be the same (newer VServer ones will be kept before older VServers
and before the newest non-VServer ones).

--
"grub-pc_vz-pmx_priority.diff" is for both Squeeze and Wheezy and 
"grub-pc_vz-pmx_priority.jessie.diff" is for Jessie, it might also work 
on Ubuntu but i havent tried it.
How to apply :
    patch -d /usr/share/grub/ -p0 < grub-pc_vz-pmx_priority.diff
    update-grub
Before :
    # update-grub
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-4.2.0-0.bpo.1-amd64
    Found initrd image: /boot/initrd.img-4.2.0-0.bpo.1-amd64
    Found linux image: /boot/vmlinuz-3.18.21-vs2.3.7.4-beng
    Found initrd image: /boot/initrd.img-3.18.21-vs2.3.7.4-beng
    Found linux image: /boot/vmlinuz-3.16.0-4-amd64
    Found initrd image: /boot/initrd.img-3.16.0-4-amd64
       No volume groups found
    done
_
_After :
    # update-grub
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-3.18.21-vs2.3.7.4-beng
    Found initrd image: /boot/initrd.img-3.18.21-vs2.3.7.4-beng
    Found linux image: /boot/vmlinuz-4.2.0-0.bpo.1-amd64
    Found initrd image: /boot/initrd.img-4.2.0-0.bpo.1-amd64
    Found linux image: /boot/vmlinuz-3.16.0-4-amd64
    Found initrd image: /boot/initrd.img-3.16.0-4-amd64
       No volume groups found
    done

Received on Tue Dec 1 07:13:39 2015
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Tue 01 Dec 2015 - 07:13:39 GMT by hypermail 2.1.8