Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 2086  / 1 Year ago, thu, december 22, 2022, 7:51:43

In my system I have the following kernel versions installed:


Found linux image: /boot/vmlinuz-5.4.0-107-generic
Found initrd image: /boot/initrd.img-5.4.0-107-generic

Found linux image: /boot/vmlinuz-5.4.0-105-generic
Found initrd image: /boot/initrd.img-5.4.0-105-generic

Found linux image: /boot/vmlinuz-5.4.0-104-generic
Found initrd image: /boot/initrd.img-5.4.0-104-generic

I always use the latest version, but for the last few days I have had to use the 5.4.0-104-generic version, because if I let my system use 5.4.0-105-generic or 5.4.0-107-generic my system freezes after login and I need to shut down with the power off button.


I never saw this behavior before. What can I do? Is it possible to keep the 5.4.0-104-generic version (only that works) forever? I am afraid that version could disappear from my system, I don't know.


More From » boot

 Answers
2

First thing is you should be trying to discern what the problem is with the new kernels.


To persistently boot into the kernel of your choice:


Numerous ways to go about this. Some are mentioned in other answers, essentially setting grub to boot into the desired kernel by default.


If I am in the same situation, and I am going to want to switch effortlessly while testing. In /etc/default/grub, you can edit:



GRUB_DEFAULT=saved



and then update-grub


Then from that point, anytime you want to test or set a default kernel you can just use sudo grub-set-default <your menuentry selection> and reboot.


<your menuentry selection> is going to be your grub menuentry or entry list number...


If your Grub menu looks like:



Ubuntu

Advanced options for Ubuntu

System Setup



Then Ubuntu=0, Advanced options for Ubuntu=1, System Setup=3

Because you are dealing with a submenu of 1, you have to note that too.


Under 'Advanced options for Ubuntu' you MIGHT have something like:



Ubuntu, with Linux 5.4.0-107-generic

Ubuntu, with Linux 5.4.0-107-generic (recovery mode)

Ubuntu, with Linux 5.4.0-105-generic

Ubuntu, with Linux 5.4.0-105-generic (recovery mode)

Ubuntu, with Linux 5.4.0-104-generic

Ubuntu, with Linux 5.4.0-104-generic (recovery mode)



in the 0-based enumeration, the 104 kernel would be number 4


You can then set your new default like:
sudo grub-set-default "1>4" and reboot


or


sudo grub-set-default "Advanced options for Ubuntu>Ubuntu, with Linux 5.4.0-104-generic and reboot.


There are easily searched way to pull the menuentry's from /boot/grub/grub.cfg so you can get the correct names and numbers without opening the file and looking... Most are grep-ing or awk-ing the file and returning menuentry results as it finds them in the file and assigns them sequential numbers.


A quick and dirty way to get a (out of order) listing, is to just type grub-set-default and then the TAB key a couple of times until the auto-complete kicks the output. (This command does not give the correct numbers)


This stays permanent until you changed the saved default.


You can view the saved_entry with:

cat /boot/grub/grubenv


To prevent any further updates in the meantime:


You would, just NOT install the updates... simply uncheck the boxes with anything related to those updates.."5.4.0-1XX" ... linux image and header files... (unrelated system pictured here)
enter image description here


On my system, I ran sudo apt update and then sudo apt list --upgradable.

Then I searched through the "upgradable list" for anything that resembled the next kernel upgrade... 4.15.0.175 in my case... I found linux-generic, linux-headers-generic, and linux-image-generic.


I could simply uncheck those in the GUI, but I know I don't pay attention to what's going on there. So instead I'll permanently set those packages to "hold".

sudo apt-mark hold linux-generic linux-headers-generic linux-image-generic


apt-mark showhold verifies...


Don't screw this up at this point... DO NOT go up to that box and hit "Install Now" without unchecking those boxes. The hold stops the install of those packages on the command line if you use apt upgrade (and to be honest I rebooted before I attempted the upgrade, so I'm not even 100% confident in that assessment), but I don't know if there is something in the background that is going to prevent from that box, that was already open, from doing what it knows to do, which is install all the "checked" packages. So CLOSE THE Software Updater and reopen it if you want to see your changes work. The apt-mark hold basically unchecks those boxes for you(and doesn't let you check them anymore) until you unhold them. [I had failed results the first time i tried this, but that could have been because I tried to hold a SPECIFIC kernel... don't do that, just hold the package without version]


When I upgraded with either method, the next kernel did not get installed.


Now if those are the only packages that need upgrading, Software Updater says my system is current. If I do sudo apt list --upgradable I see the latest versions of those 3 packages.


...and in addressing the OP's "concern"... you can always reinstall a kernel from the repository. Your system may be able to stay accessible in a console to do so.


[#700] Friday, December 23, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ardingiba

Total Points: 497
Total Questions: 95
Total Answers: 109

Location: Gabon
Member since Sat, Jan 15, 2022
2 Years ago
;