[SOLVED] Revert to prior Kernel

patch

Member
Aug 5, 2021
44
3
8
32
What is the recommended way of doing this?

An older Kernel can be selected at boot time if
  • A screen and keyboard is connected,
  • and and someone is there when the hypervisor boots
So not that convenient for a headless server

The boot order can be edited as follows (there is no boot menu option to change the boot order)
  • Finding the EFI partition using fdisk -l
  • Mounting the EFI partition
  • Editing /loader/loader.conf and /loader/entries/proxmox-x.x.xx-x-pve.conf
  • Then using pve-efiboot-tool refresh
However when an update has been installed and found to be incompatible, the risks of further corruption are significant and don't really justify the value in keeping a non-functional kernel.

Another option thanks to @tristank

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.


Quote from here.

The non-functional kernel could just be removed
For permanently switching back: Remove the installed pve-kernel-5.11-.... kernel package with apt remove PKG, that should remove the meta package too and thus only the in PVE 6.4 still default 5.4 kernel should be available, then reboot.
Does this still apply? I'm trying to revert back to the prior kernel 5.11.22-7-pve

Bash:
root@pve:~# proxmox-boot-tool status
Re-executing '/usr/sbin/proxmox-boot-tool' in new private mount namespace..
System currently booted with uefi
920C-3858 is configured with: uefi (versions: 5.11.22-7-pve, 5.13.19-1-pve)
root@pve:~#

But when I try I get:

Bash:
root@pve:~# apt remove pve-kernel-5.13
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  proxmox-ve pve-kernel-5.13
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 38.9 kB disk space will be freed.
Do you want to continue? [Y/n] y
W: (pve-apt-hook) !! WARNING !!
W: (pve-apt-hook) You are attempting to remove the meta-package 'proxmox-ve'!
W: (pve-apt-hook)
W: (pve-apt-hook) If you really want to permanently remove 'proxmox-ve' from your system, run the following command
W: (pve-apt-hook)       touch '/please-remove-proxmox-ve'
W: (pve-apt-hook) run apt purge proxmox-ve to remove the meta-package
W: (pve-apt-hook) and repeat your apt invocation.
W: (pve-apt-hook)
W: (pve-apt-hook) If you are unsure why 'proxmox-ve' would be removed, please verify
W: (pve-apt-hook)       - your APT repository settings
W: (pve-apt-hook)       - that you are using 'apt full-upgrade' to upgrade your system
E: Sub-process /usr/share/proxmox-ve/pve-apt-hook returned an error code (1)
E: Failure running script /usr/share/proxmox-ve/pve-apt-hook
root@pve:~#

For reference
Bash:
root@pve:~# apt update
Hit:1 http://security.debian.org bullseye-security InRelease
Hit:2 http://ftp.au.debian.org/debian bullseye InRelease
Hit:3 http://ftp.au.debian.org/debian bullseye-updates InRelease
Hit:4 http://download.proxmox.com/debian/pve bullseye InRelease
Reading package lists... Done        
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
root@pve:~# apt dist-upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@pve:~#
 
Last edited:

oguz

Proxmox Staff Member
Staff member
Nov 19, 2018
5,207
677
118
  • Like
Reactions: patch

patch

Member
Aug 5, 2021
44
3
8
32
Thank you for the insight. I can work with that and it is valuable to have it listed with the other alternatives.

I had hoped reverting the kernel would fix my problems however I have since shown my problem is not just the kernel so changing the boot order is not a fix.

It would be great if Proxmox had a method of undoing an update from the GUI, perhaps in
GUI -> Datacenter -> pve -> Update -> Change boot order (new button)

Or even better a rollback a full system update but that's clearly more complex and would probably only be possible with some file systems.

Having a boot menu option for the hypervisor similar to virtual machines running under Proxmox would be an alternative but not as useful for headless servers.
 
Last edited:

oguz

Proxmox Staff Member
Staff member
Nov 19, 2018
5,207
677
118
It would be great if Proxmox had a method of undoing an update from the GUI, perhaps in
GUI -> Datacenter -> pve -> Update -> Change boot order (new button)

Or even better a rollback a full system update but that's clearly more complex and would probably only be possible with some file systems.

Having a boot menu option for the hypervisor similar to virtual machines running under Proxmox would be an alternative but not as useful for headless servers.
thanks for the suggestions. no promises though feel free to open a feature request on our bugtracker [0]

[0]: https://bugzilla.proxmox.com
 

mmenaz

Active Member
Jun 25, 2009
828
20
38
Northern east Italy
hi,

no need to remove the package,
you can select an older kernel to boot with:
Code:
$ proxmox-boot-tool kernel list
$ proxmox-boot-tool kernel add|remove <kernel-version>
$ proxmox-boot-tool refresh

take a look also here [0]

hope this helps!

[0]: https://pve.proxmox.com/wiki/Host_Bootloader#sysboot_proxmox_boot_tool
Is it me that I'm doing something wrong, or because my test machine (a VM with Proxmox zfs installed but BIOS mode) needs different commands, and if so, which are?
I.e. in this example I've tried to boot with 5.4.128-1-pve but after reboot the same 5.11.22-5-pve was used

Code:
# proxmox-boot-tool status
Re-executing '/usr/sbin/proxmox-boot-tool' in new private mount namespace..
System currently booted with legacy bios
5340-9ACF is configured with: uefi (versions: 5.3.18-3-pve, 5.4.103-1-pve, 5.4.78-2-pve), grub (versions: 5.11.22-3-pve, 5.11.22-5-pve, 5.4.128-1-pve)
5342-0034 is configured with: uefi (versions: 5.3.18-3-pve, 5.4.103-1-pve, 5.4.78-2-pve), grub (versions: 5.11.22-3-pve, 5.11.22-5-pve, 5.4.128-1-pve)
root@prox6zfs:~#

# proxmox-boot-tool kernel list
Manually selected kernels:
None.

Automatically selected kernels:
5.11.22-3-pve
5.11.22-5-pve
5.4.128-1-pve
# proxmox-boot-tool kernel add|remove <kernel-version>
es.
# proxmox-boot-tool kernel add 5.4.128-1-pve
Added kernel '5.4.128-1-pve' to manual kernel list. Use the 'refresh' command to update the ESPs.
root@prox6zfs:~# proxmox-boot-tool kernel list
Manually selected kernels:
5.4.128-1-pve

Automatically selected kernels:
5.11.22-3-pve
5.11.22-5-pve
# proxmox-boot-tool refresh

as stated, the kernel used by the boot is still the same.
I would like to know a secure way to reboot different default kernels
 

oguz

Proxmox Staff Member
Staff member
Nov 19, 2018
5,207
677
118

mmenaz

Active Member
Jun 25, 2009
828
20
38
Northern east Italy
when you're booting do you see GRUB or systemd-boot? [0]

[0]: https://pve.proxmox.com/wiki/Host_Bootloader#sysboot_determine_bootloader_used
Grub blue menu, as you can read in my post I do have a "legacy boot" setup (no UEFI) (also proxmox-boot-tool status output confirms this).
That's why I ask if the proxmox-boot-tool commands to set the boot kernel to use is only for UEFI, if not and I'm doing something wrong, or also there is a flag/different command if I'm in "grub / legacy" config
 

oguz

Proxmox Staff Member
Staff member
Nov 19, 2018
5,207
677
118
yes you'll need to use grub commands instead (namely update-grub after editing the configuration in /etc/default/grub or config snippets in /etc/default/grub.d).

for example first check which kernels are presented in the grub menu:
Code:
$ grep menuentry /boot/grub/grub.cfg
menuentry 'Proxmox VE GNU/Linux' --class proxmox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-62b81a8b-7278-439e-9df2-6c81c2e3441e' {
submenu 'Advanced options for Proxmox VE GNU/Linux' $menuentry_id_option 'gnulinux-advanced-62b81a8b-7278-439e-9df2-6c81c2e3441e' {
        menuentry 'Proxmox VE GNU/Linux, with Linux 5.13.19-1-pve' --class proxmox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.13.19-1-pve-advanced-62b81a8b-7278-439e-9df2-6c81c2e3441e' {
        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-62b81a8b-7278-439e-9df2-6c81c2e3441e' {
        menuentry 'Proxmox VE GNU/Linux, with Linux 5.11.22-6-pve' --class proxmox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.11.22-6-pve-advanced-62b81a8b-7278-439e-9df2-6c81c2e3441e' {
        menuentry 'Proxmox VE GNU/Linux, with Linux 5.11.22-5-pve' --class proxmox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.11.22-5-pve-advanced-62b81a8b-7278-439e-9df2-6c81c2e3441e' {

then you can edit /etc/default/grub:
Code:
# add first the submenu, then '>' followed by the menuentry for your kernel 
GRUB_DEFAULT="gnulinux-advanced-62b81a8b-7278-439e-9df2-6c81c2e3441e>gnulinux-5.11.22-6-pve-advanced-62b81a8b-7278-439e-9df2-6c81c2e3441e"

followed by running update-grub. after rebooting you should boot with the selected kernel.
 

mmenaz

Active Member
Jun 25, 2009
828
20
38
Northern east Italy
No luck, I've tested and failed with
Code:
 grep menuentry /boot/grub/grub.cfg | grep 5.4.128
        menuentry 'Proxmox VE GNU/Linux, with Linux 5.4.128-1-pve' --class proxmox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5
.4.128-1-pve-advanced-cc2c0db059b7f802' {

so I edited /etc/default/grub and put
Code:
GRUB_DEFAULT="my-description-for-old-kernel>gnulinux-5.4.128-1-pve-advanced-cc2c0db059b7f802"
and also
I've tested with
Code:
GRUB_DEFAULT=2
instead of
Code:
GRUB_DEFAULT=0
in the original file, of course after editing I did "update-grub" (BTW, how do you generate the markdown for "update-grub" or "/etc/default/grub" in your comment?) and rebooted.
My /etc/default/grub is now:
Code:
GRUB_DEFAULT="my-description-for-old-kernel>gnulinux-5.4.128-1-pve-advanced-cc2c0db059b7f802"
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Proxmox Virtual Environment"
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX="root=ZFS=rpool/ROOT/pve-1 boot=zfs"
GRUB_DISABLE_OS_PROBER=true
GRUB_DISABLE_RECOVERY="true"
 

oguz

Proxmox Staff Member
Staff member
Nov 19, 2018
5,207
677
118
so I edited /etc/default/grub and put
Code:
GRUB_DEFAULT="my-description-for-old-kernel>gnulinux-5.4.128-1-pve-advanced-cc2c0db059b7f802"
please read my post above again, you need to put the menuentry_id of "submenu" for the advanced options first, and then the entry for the kernel you'd like to boot.

I've tested with
Code:
GRUB_DEFAULT=2
instead of
Code:
GRUB_DEFAULT=0
i'd comment these out completely since you won't be able to boot it to another kernel this way (previous kernel versions are inside the submenu for advanced options so changing the index will only get you as far as the menu itself but not the suboption)
 

mmenaz

Active Member
Jun 25, 2009
828
20
38
Northern east Italy
Sigh, I did not noticed the "menu" / "submenu" structure, my fault!
For the record, with my setup, the right line was:
GRUB_DEFAULT="gnulinux-advanced-cc2c0db059b7f802>gnulinux-5.4.128-1-pve-advanced-cc2c0db059b7f802"
Now worked as expected, thanks!
BTW, since proxmox-boot-tool are able to understand if boot is done with systemd or grub, would be wonderful if they take care of the difference, and/or provide a simple straightforward way to select the default boot kernel "boot type agnostic"
 

oguz

Proxmox Staff Member
Staff member
Nov 19, 2018
5,207
677
118
BTW, since proxmox-boot-tool are able to understand if boot is done with systemd or grub, would be wonderful if they take care of the difference, and/or provide a simple straightforward way to select the default boot kernel "boot type agnostic"
thanks for the suggestion, it seems there was recently an entry for that in the bug tracker [0]. fingers crossed ;)

Now worked as expected, thanks!
great, you can mark the thread [SOLVED] :)


[0]: https://bugzilla.proxmox.com/show_bug.cgi?id=3761
 

fabian

Proxmox Staff Member
Staff member
Jan 7, 2016
7,691
1,450
164
  • Like
Reactions: tristank and Neobin

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!