Select default Boot Kernel

bcadwell

Member
Dec 15, 2017
4
0
6
53
Hi there, I have discovered that one of my PCI cards is not compatible with 5.4.73-1-pve. A big thanks to whomever decided to preserve old kernels! I can manually at boot go back and select the kernel version working with my hardware (5.3.18-3-pve) however I have not figured out to make this kernel the new default kernel at reboot. I cannot always access the console and would like to reset it permanently to automatically boot to 5.3.18-3-pve.

I tried to add it to the manual configuration:
Code:
pve-efiboot-tool kernel add 5.3.18-3-pve
pve-efiboot-tool refresh

and "tried" to remove the old kernel using both
Code:
pve-efiboot-tool kernel remove 5.4.73-1-pve
and
Code:
apt purge pve-kernel-5.4.73-1-pve

The boot-tool command failed because I am learning it only applies to manually added kernels
the purge command removed the 5.3.18-3-pve from my automatic list instead of the 5.4.73 which I really dont understand. :(
Currently my system looks like this:
Code:
pve-efiboot-tool kernel list
Manually selected kernels:
5.3.18-3-pve

Automatically selected kernels:
5.4.73-1-pve

uname -a
Linux <hostname> 5.3.18-3-pve #1 SMP PVE 5.3.18-3 (Tue, 17 Mar 2020 16:33:19 +0100) x86_64 GNU/Linux
But upon reboot unless I explicitly select advanced options and the 5.3 kernel at the console I am still booted into the new 5.4 kernel.

I am using Bare Metal ZFS Mirrored Disks for rpool thus I believe systemd-boot for bootloading

Is there a way to get the system to reboot into the 5.3.18-3 kernel automatically?
 

bcadwell

Member
Dec 15, 2017
4
0
6
53
Thank you Hannes, I am not sure why I was under the impression that I was using system-boot. Upon closer inspection of https://pve.proxmox.com/wiki/Host_Bootloader it appears I was making this more complicated than it needed to be.

To resolve I did the following (I am hoping this was the correct process).

Code:
# as root change to the /boot image directory can create backup dir
cd /boot
mkdir /boot/backup

# move 5.4 kernel files to the backup dir
mv *5.4.73-1* /boot/backup/.

# update links in pve dir
cd /boot/pve
root@host:/boot/pve# ls -ltr
total 4
lrwxrwxrwx 1 root root 28 Feb 14  2020 vmlinuz-4.15 -> /boot/vmlinuz-4.15.18-25-pve
lrwxrwxrwx 1 root root 31 Feb 14  2020 initrd.img-4.15 -> /boot/initrd.img-4.15.18-25-pve
lrwxrwxrwx 1 root root 26 Nov 23 11:30 vmlinuz-5.3 -> /boot/vmlinuz-5.3.18-3-pve
lrwxrwxrwx 1 root root 29 Nov 23 11:30 initrd.img-5.3 -> /boot/initrd.img-5.3.18-3-pve
lrwxrwxrwx 1 root root 26 Nov 23 11:30 vmlinuz-5.4 -> /boot/vmlinuz-5.4.73-1-pve
lrwxrwxrwx 1 root root 29 Nov 23 11:30 initrd.img-5.4 -> /boot/initrd.img-5.4.73-1-pve
lrwxrwxrwx 1 root root 21 Nov 23 11:31 vmlinuz -> /boot/pve/vmlinuz-5.4
lrwxrwxrwx 1 root root 24 Nov 23 11:31 initrd.img -> /boot/pve/initrd.img-5.4

## change vmlinuz and initrd.img to point to earlier major kernel link
rm vmlinuz
ln -s /boot/pve/vmlinuz-5.3 vmlinuz
rm initrd.img
ln -s /boot/pve/initrd.img-5.3 initrd.img

# update-grub config
update-grub
root@host:/boot# update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.3.18-3-pve
Found initrd image: /boot/initrd.img-5.3.18-3-pve
Found linux image: /boot/vmlinuz-5.3.18-2-pve
Found initrd image: /boot/initrd.img-5.3.18-2-pve
Found linux image: /boot/vmlinuz-4.15.18-25-pve
Found initrd image: /boot/initrd.img-4.15.18-25-pve
Found linux image: /boot/vmlinuz-4.13.4-1-pve
Found initrd image: /boot/initrd.img-4.13.4-1-pve
Found memtest86+ image: /ROOT/pve-1@/boot/memtest86+.bin
Found memtest86+ multiboot image: /ROOT/pve-1@/boot/memtest86+_multiboot.bin
done

# reboot host
root@host:/boot# reboot


With these changes I booted back into 5.3 without having to go to through the advanced settings menu.
If this is a bad idea. Please chime in so no one else follows my path. ;)

Thanks again for your reply!
 

tinfever

Member
Jun 30, 2019
16
1
6
31
To anyone in the future looking to set the default kernel version when using the grub bootloader, here's how:

Run the command 'grep menu /boot/grub/grub.cfg' and you'll get the following output:

Code:
root@hostname:~# grep menu /boot/grub/grub.cfg
if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
  menuentry_id_option=""
export menuentry_id_option
    set timeout_style=menu
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
menuentry 'Proxmox Virtual Environment GNU/Linux' --class proxmox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-bbd2b964-2861-41c3-ae1f-1ea49068010c' {
submenu 'Advanced options for Proxmox Virtual Environment GNU/Linux' $menuentry_id_option 'gnulinux-advanced-bbd2b964-2861-41c3-ae1f-1ea49068010c' {
        menuentry 'Proxmox Virtual Environment GNU/Linux, with Linux 5.4.114-1-pve-dbg' --class proxmox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.114-1-pve-dbg-advanced-bbd2b964-2861-41c3-ae1f-1ea49068010c' {
        menuentry 'Proxmox Virtual Environment GNU/Linux, with Linux 5.4.114-1-pve' --class proxmox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.114-1-pve-advanced-bbd2b964-2861-41c3-ae1f-1ea49068010c' {
        menuentry 'Proxmox Virtual Environment GNU/Linux, with Linux 5.4.78-2-pve' --class proxmox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.78-2-pve-advanced-bbd2b964-2861-41c3-ae1f-1ea49068010c' {
        menuentry 'Proxmox Virtual Environment GNU/Linux, with Linux 5.4.34-1-pve' --class proxmox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.34-1-pve-advanced-bbd2b964-2861-41c3-ae1f-1ea49068010c' {
menuentry "Memory test (memtest86+)" {
menuentry "Memory test (memtest86+, serial console 115200)" {
menuentry "Memory test (memtest86+, experimental multiboot)" {
menuentry "Memory test (memtest86+, serial console 115200, experimental multiboot)" {
menuentry 'System setup' $menuentry_id_option 'uefi-firmware' {
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change

  1. Look for the line that starts with "submenu 'Advanced options..." and note the id for that entry. In this example that would be "gnulinux-advanced-bbd2b964-2861-41c3-ae1f-1ea49068010c".
  2. Then find the line beneath that submenu which corresponds to the kernel version you want and note the id for that entry. In this example, I want kernel version 5.4.78-2-pve so I'd note "gnulinux-5.4.78-2-pve-advanced-bbd2b964-2861-41c3-ae1f-1ea49068010c"
  3. Finally, edit /etc/default/grub and set the GRUB_DEFAULT option to the following (replace with your own values that you previously noted):
Code:
GRUB_DEFAULT="gnulinux-advanced-bbd2b964-2861-41c3-ae1f-1ea49068010c>gnulinux-5.4.78-2-pve-advanced-bbd2b964-2861-41c3-ae1f-1ea49068010c"

In case it isn't obvious, that's GRUB_DEFAULT="SUBMENU_ID>MENUENTRY_ID"

4. Don't forget to run "update-grub"
 

tristank

Member
Apr 24, 2020
35
6
13
22
For me it was as easy as:

Code:
$ apt install pve-kernel-5.11.22-7-pve
$ pve-efiboot-tool kernel list
$ pve-efiboot-tool kernel add 5.11.22-7-pve
$ update-initramfs -u -k all && pve-efiboot-tool refresh

EDIT: I was wrong, this commands just installs a specific kernel. Sadly there seems to be no pve-utility for doing this conveniently.

I followed @tinfever instructions but this does't not seem to work on systemd-boot proxmox installation. Here is my full grub.cfg.

$ grep menuentry /boot/grub/grub.cfg | grep gnulinux-advanced submenu 'Advanced options for Proxmox VE GNU/Linux' $menuentry_id_option 'gnulinux-advanced-49d80c739f2773dd' { $ grep menuentry /boot/grub/grub.cfg | grep 5.11.22-7-pve menuentry 'Proxmox VE GNU/Linux, with Linux 5.11.22-7-pve' --class proxmox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.11.22-7-pve-advanced-49d80c739f2773dd' { menuentry 'Proxmox VE GNU/Linux, with Linux 5.11.22-7-pve (recovery mode)' --class proxmox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.11.22-7-pve-recovery-49d80c739f2773dd' {

$ pve-efiboot-tool kernel list Manually selected kernels: 5.11.22-7-pve Automatically selected kernels: 5.13.19-3-pve 5.15.12-1-pve $ cat /etc/default/grub | grep GRUB_DEFAULT GRUB_DEFAULT="gnulinux-advanced-49d80c739f2773dd>gnulinux-5.11.22-7-pve-advanced-49d80c739f2773dd"

---

EDIT2: As it turns out you can define the default boot entry by selecting the entry in the systemd-boot menu and hit "d" for default. Would have been nice to to see this in the wiki-page.

dselect the default entry to boot (stored in a non-volatile EFI variable)

Quote from here.
 
Last edited:
  • Like
Reactions: patch

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!