LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 02-07-2022, 02:13 PM   #1
Hanisch
LQ Newbie
 
Registered: Mar 2016
Posts: 26

Rep: Reputation: Disabled
How can I delete the last Kernel from CentOS 8


Hello,
my last Kernel kernel-4.18.0-358.el8.x86_64 does not work in my VirtualBox-Installation.
I have now:
Quote:
$ sudo grubby --default-kernel
/boot/vmlinuz-4.18.0-348.7.1.el8_5.x86_64
Quote:
$ sudo rpm -q kernel
kernel-4.18.0-240.15.1.el8_3.x86_64
kernel-4.18.0-348.7.1.el8_5.x86_64
kernel-4.18.0-358.el8.x86_64
I should like delete the newest Kernel kernel-4.18.0-358.el8.x86_64

In the link https://www.thegeekdiary.com/how-to-...centos-rhel-8/
is show only the Deletion of older Kernels.

How can I Delete the newest Kernel?

With regards
Ch. Hanisch
 
Old 02-07-2022, 02:25 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,695

Rep: Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716
Use the commands in that document to boot to find the kernel indexes, boot to an older kernel, and then make that older kernel your default and remove the newer kernel.

After that you will have to freeze your kernel so it will not update, or take other steps to protect yourself form updates changing the kernel.
 
Old 02-07-2022, 02:55 PM   #3
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,677

Rep: Reputation: Disabled
To list all installed kernel with their indices:
Code:
$ sudo grubby --info=ALL|egrep '^(index|kernel)='
index=0
kernel="/boot/vmlinuz-4.18.0-358.el8.x86_64"
index=1
kernel="/boot/vmlinuz-4.18.0-348.7.1.el8_5.x86_64"
index=2
kernel="/boot/vmlinuz-0-rescue-99f959ba76a9461d95f94cfb1d76f253"
 
Old 02-08-2022, 08:25 AM   #4
Hanisch
LQ Newbie
 
Registered: Mar 2016
Posts: 26

Original Poster
Rep: Reputation: Disabled
Hello,
Sorry, I can't remove the newest Kernel from Boot-Menu.

Quote:
$ sudo yum remove kernel-4.18.0-358.el8.x86_64
Keine Übereinstimmung für Argumente: kernel-4.18.0-358.el8.x86_64
Keine Pakete zum Entfernen markiert.
Abhängigkeiten sind aufgelöst.
Nichts zu tun.
Fertig.
Quote:
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
GRUB-Konfigurationsdatei wird erstellt …
Hintergrund gefunden: /usr/share/backgrounds/default-mit-Text.tga
erledigt
Quote:
$ sudo rpm -q kernel
kernel-4.18.0-240.15.1.el8_3.x86_64
kernel-4.18.0-348.7.1.el8_5.x86_64

The newest Kernel is always on Top in the Boot-Menu, but it has no function.

with regards
Ch. Hanisch
 
Old 02-08-2022, 11:12 AM   #5
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,695

Rep: Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716Reputation: 2716
do not try to remove it form the grub menu, just change index 0 to the other kernel.
Then reboot and load tha other kernel so that you are not trying to remove the current kernel.
Then remove the kernel that is the problem.
To get the install name, you might have to list installed packages and see if the package name differs from what you expect.


I could probably make this more clear, if only I could read and write German.
 
Old 02-09-2022, 04:09 AM   #6
Hanisch
LQ Newbie
 
Registered: Mar 2016
Posts: 26

Original Poster
Rep: Reputation: Disabled
Hello,
why delete the command:
Quote:
sudo yum remove kernel-4.18.0-358.el8.x86_64
this kernel not?

with regards
Ch. Hanisch
 
Old 02-09-2022, 04:31 AM   #7
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,677

Rep: Reputation: Disabled
What message do you get when trying to remove it?
Code:
No match for argument: kernel-4.18.0-358.el8.x86_64 
No packages marked for removal.
Then that kernel is not installed.

Update. Ah sorry. In your case, the exact messages could be
Code:
Keine Übereinstimmung für Argumente: kernel-4.18.0-358.el8.x86_64
Keine Pakete zum Entfernen markiert.

Last edited by shruggy; 02-09-2022 at 04:39 AM.
 
Old 02-09-2022, 07:53 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,969

Rep: Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333
you do not need to remove it at all, just set the previous one as default. And probably that's all.
The message means there is no such package at all, that is not the name of the package you are looking for. And anyway the next yum update will bring it back.
 
Old 02-10-2022, 04:27 AM   #9
Hanisch
LQ Newbie
 
Registered: Mar 2016
Posts: 26

Original Poster
Rep: Reputation: Disabled
Quote:
... And anyway the next yum update will bring it back.
No, I have set:
Quote:
# cat /etc/yum.conf
[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
best=True
skip_if_unavailable=False
exclude=kernel*
My problem is, that after manual deleting all /boot/*-4.18.0-358.* the Kernel 4.18.0-358.7.1.el8_5.x86_64 stands always at the top of my Boot-menu.
Where is that written in the system?

with regards
Ch. Hanisch

Last edited by Hanisch; 02-11-2022 at 04:43 AM.
 
Old 02-10-2022, 04:33 AM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,969

Rep: Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333
I guess that is the grub config. Try to reconfigure it and run update-grub.
 
Old 02-10-2022, 09:42 AM   #11
Hanisch
LQ Newbie
 
Registered: Mar 2016
Posts: 26

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
I guess that is the grub config. Try to reconfigure it and run update-grub.
How can I reconfigure grub config?
What mean you with grub config?

with regards
Ch. Hanisch
 
Old 02-10-2022, 09:53 AM   #12
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,969

Rep: Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333
grub is the boot loader. This is the tool which will show that boot menu. You need to [re]configure it to forget the deleted kernel.
https://www.howtogeek.com/196655/how...ders-settings/
 
Old 02-10-2022, 09:53 AM   #13
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,677

Rep: Reputation: Disabled
On CentOS, you reconfigure GRUB with grubby.
 
Old 02-10-2022, 10:03 AM   #14
Hanisch
LQ Newbie
 
Registered: Mar 2016
Posts: 26

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
grub is the boot loader. This is the tool which will show that boot menu. You need to [re]configure it to forget the deleted kernel.
https://www.howtogeek.com/196655/how...ders-settings/
Sorry, I can't find the line to disable the TOP-Line in the Boot-menu.

Quote:
$ cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
GRUB_DISABLE_SUBMENU=true
#GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto resume=UUID=0cffd2aa-a2ca-4ec5-aba0-07fc7fbd1a7b rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true
#GRUB_BACKGROUND="/usr/share/backgrounds/default.png"
GRUB_BACKGROUND="/usr/share/backgrounds/default-mit-Text.tga"
with regards
Ch. Hanisch
 
Old 02-10-2022, 10:08 AM   #15
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,969

Rep: Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333Reputation: 7333
Quote:
Originally Posted by Hanisch View Post
Sorry, I can't find the line to disable the TOP-Line in the Boot-menu.
Please follow post #13, that would be better I think
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Get first day of last month and last day of last month in bash xowl Linux - Software 18 02-09-2017 09:49 AM
Can I delete files in /mnt/tmp? and Files in the trash can will not delete? M$ISBS Slackware 15 10-02-2009 11:56 PM
i can't delete last version secretboy Linux - Software 4 11-17-2004 02:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 02:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration