LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-08-2019, 12:33 PM   #1
Prze-moC
LQ Newbie
 
Registered: Jul 2019
Posts: 11

Rep: Reputation: 2
Why cann't I remove old kernels?


Hi,
I'm new to all this, so let me post a bit of background before asking my questions (on the very bottom).

I had recently updated the kernel (using "yum update"):
Code:
[root@plsekatlastst01 firmware]# uname -a
Linux plsekatlastst01 4.1.12-124.28.1.el7uek.x86_64 #2 SMP Mon Jun 3 14:09:53 PDT 2019 x86_64 x86_64 x86_64 GNU/Linux
Now, I want to remove the old kernels to avoid /boot overfill.
Code:
[root@plsekatlastst01 firmware]#  ls -lah /boot/vmlinuz*
-rwxr-xr-x. 1 root root 4.5M Apr 22  2016 /boot/vmlinuz-0-rescue-2034cfa2044148d6b61b951f04bb3284
-rwxr-xr-x. 1 root root 6.4M Jun  4 20:33 /boot/vmlinuz-3.10.0-957.21.2.el7.x86_64
-rwxr-xr-x. 1 root root 6.4M Jun 18 00:54 /boot/vmlinuz-3.10.0-957.21.3.el7.x86_64
-rwxr-xr-x. 1 root root 6.2M Jun  3 23:14 /boot/vmlinuz-4.1.12-124.28.1.el7uek.x86_64
-rwxr-xr-x. 1 root root 6.2M Jun 11 09:48 /boot/vmlinuz-4.1.12-124.28.3.el7uek.x86_64
-rwxr-xr-x. 1 root root 6.2M Jun 20 21:05 /boot/vmlinuz-4.1.12-124.28.5.el7uek.x86_64
Found instructions here: https://www.2daygeek.com/remove-dele...s-fedora-rhel/ and followed, but when I run
Code:
package-cleanup --oldkernels --count=1
... it only wants to clean 3.10.0-957.21.2.el7.
What about the old 4.1.12 ones?
I also run this:
Code:
[root@plsekatlastst01 firmware]# rpm -q kernel
kernel-3.10.0-957.21.3.el7.x86_64
kernel-3.10.0-957.21.2.el7.x86_64
QUESTION 1:
How to clean-up old kernels?

QUESTION 2:
Would you know why "rpm -q kernel" shows only 3.10 entries while /boot folder contains 6 vmlinuz* files?

QUESTION 3:
Do I need to fix anything so "rpm -q kernel" shows all kernels?

Last edited by Prze-moC; 07-09-2019 at 03:41 AM.
 
Old 07-08-2019, 01:20 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
"rpm -q kernel" shows what Redhat Package Manager (RPM) packages were installed named "kernel". What you see after kernel is version and architecture information. If the command only shows the two 3.x kernels it would indicate the other kernel directories you see were NOT installed with rpm.

You could run "rpm -qa |grep kernel" to see if there are other kernel rpms installed.

For any file you see you can run "rpm -qf <pathto/file>" to see what rpm installed it. For example in my /boot I have:
-rwxr-xr-x. 1 root root 5027872 Jul 22 2015 vmlinuz-3.10.0-229.11.1.el7.x86_64
-rwxr-xr-x. 1 root root 5027648 Aug 25 2015 vmlinuz-3.10.0-229.14.1.el7.x86_64
-rwxr-xr-x. 1 root root 5152928 Nov 20 2015 vmlinuz-3.10.0-327.3.1.el7.x86_64
Running the command on each of those with outputs shown:
#rpm -qf /boot/vmlinuz-3.10.0-229.11.1.el7.x86_64
kernel-3.10.0-229.11.1.el7.x86_64

# rpm -qf vmlinuz-3.10.0-229.14.1.el7.x86_64
kernel-3.10.0-229.14.1.el7.x86_64

# rpm -qf vmlinuz-3.10.0-327.3.1.el7.x86_64
kernel-3.10.0-327.3.1.el7.x86_64


It is possible to install software by installing from a tar file, configuring and making files from source or simply by copying in binaries. None of those methods will add it to the rpm database. Since RHEL7 is based on 3.x kernel I think someone was trying to install 4.x kernels manually. My guess is rpm -qf won't show you anything on the three 4.x kernels you list.

The main point in the cleanup tool is to modify your grub configuration. If someone manually installed those 4.x kernels it is possible they also manually edited the grub configuration. You'd want to undo that but you're showing you actually booted from a 4.x kernel.

Last edited by MensaWater; 07-08-2019 at 01:22 PM.
 
1 members found this post helpful.
Old 07-08-2019, 01:29 PM   #3
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
You can change the limit in /etc/yum.conf

Update this line: installonly_limit=5

Default is 5 (in CentOS 7.x). I've set my machine to 3...

-----

Did you upgrade from RH 7 to 8 (or CentOS 7 to 8)?

Last edited by dc.901; 07-08-2019 at 01:32 PM.
 
Old 07-08-2019, 03:51 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
el7 suggests RHEL7 (or a derivative like CentOS7). The el7uek is suggestive. When I looked that up I found it is kernels provided by OEL (Oracle Unbreakable Linux). Either the OP has OEL or he has installed kernels built by Oracle on his RHEL7 or CentOS7 system. I haven't looked in a while but I know Oracle did provide their kernel "enhancements" for use on RHEL or CentOS. I never used their kernels on RHEL because Oracle wouldn't support it if it wasn't a full OEL install and RedHat wouldn't support it if it was a RHEL install but used a foreign kernel from Oracle.

I found other posts earlier indicating Fedora's EPEL had 4.x kernels for RHEL7/CentOS7 but RedHat doesn't support those on RHEL7. Since RHEL8 is in general release if the OP is using RHEL7 he might want to upgrade to RHEL8 to get the 4.x kernels that are officially supported by RedHat. If he is on OEL it seems he'd be able to contact Oracle support. Since CentOS7 is not a supported product one can put whatever they want on it. I don't think CentOS8 is available yet.

However, if they got them from OEL or RHEL they didn't use rpm (or yum) to install them (unless the name is more than just "kernel" followed by the dash, version and architecture - doing the rpm with grep I suggested might be informative).

What do "cat /etc/issue" and "cat /etc/redhat-release" show on the server? The output might help to determine the actual distro in use.

Last edited by MensaWater; 07-09-2019 at 08:04 AM.
 
1 members found this post helpful.
Old 07-09-2019, 03:54 AM   #5
Prze-moC
LQ Newbie
 
Registered: Jul 2019
Posts: 11

Original Poster
Rep: Reputation: 2
I used "yum update" to have all upgraded (incl. kernel).
Indeed rpm sees others just the prefix is little longer:
Code:
[root@plsekatlastst01 boot]# rpm -qa | grep kernel
kernel-uek-4.1.12-124.28.5.el7uek.x86_64
kernel-3.10.0-957.21.2.el7.x86_64
kernel-uek-firmware-4.1.12-124.28.1.el7uek.noarch
kernel-uek-firmware-4.1.12-124.28.3.el7uek.noarch
kernel-uek-4.1.12-124.28.3.el7uek.x86_64
kernel-uek-firmware-4.1.12-124.28.5.el7uek.noarch
kernel-tools-3.10.0-957.21.3.el7.x86_64
kernel-3.10.0-957.21.3.el7.x86_64
kernel-tools-libs-3.10.0-957.21.3.el7.x86_64
kernel-uek-4.1.12-124.28.1.el7uek.x86_64
kernel-headers-3.10.0-957.21.3.el7.x86_64
The other outputs you asked are:
Code:
[root@plsekatlastst01 boot]# cat /etc/issue
\S
Kernel \r on an \m

[root@plsekatlastst01 boot]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.6 (Maipo)
Sorry, but I do not understand your statements about RHEL7 and RHEL8. How do those answer my questions?
 
Old 07-09-2019, 06:22 AM   #6
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
I have RHEL 7.6 machines but none are showing 4.x kernels (even when I try to do yum update).

I am thinking you have a repo that has those kernels or someone downloaded from here maybe?

Can you also share your repos?
And, what is output of these commands:

Code:
yum repolist
grep installonly_limit /etc/yum.conf
 
1 members found this post helpful.
Old 07-09-2019, 07:55 AM   #7
Prze-moC
LQ Newbie
 
Registered: Jul 2019
Posts: 11

Original Poster
Rep: Reputation: 2
[przemek@plsekatlastst01 ~]$ yum repolist
Loaded plugins: ulninfo
repo id repo name status
ol7_UEKR4/x86_64 Latest Unbreakable Enterprise Kernel Release 4 for Orac 96
ol7_latest/x86_64 Oracle Linux 7Server Latest (x86_64) 13,168
repolist: 13,264
[przemek@plsekatlastst01 ~]$ grep installonly_limit /etc/yum.conf
installonly_limit=2
 
1 members found this post helpful.
Old 07-09-2019, 07:59 AM   #8
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Your output confirms you're using RHEL7.6 (as opposed to OEL or CentOS) assuming no one manually edited the files.

Your earlier uname output shows you're running the kernel provided by:
kernel-uek-firmware-4.1.12-124.28.1.el7uek.noarch

BE SURE YOU HAVE A GOOD BACKUP BEFORE DOING ANYTHING ELSE.

You can likely remove 2 of the other 4.x kernels, since they aren't in use, and associated packages by running:
Code:
yum remove kernel-uek-4.1.12-124.28.5.el7uek.x86_64 kernel-uek-firmware-4.1.12-124.28.3.el7uek.noarch kernel-uek-4.1.12-124.28.3.el7uek.x86_64 kernel-uek-firmware-4.1.12-124.28.5.el7uek.noarch 
kernel-tools-libs-3.10.0-957.21.3.el7.x86_64
Since you're running the 4.x kernel (version 4.1.12-124.28.1) you could probably remove the other 2 of the 3.x kernels with yum remove as well. It appears the cleanup tool only works for the kernel packages (3.x in this case) provided by RedHat and doesn't recognize those 4.x kernels possibly because of the uek in the names.

Quote:
Sorry, but I do not understand your statements about RHEL7 and RHEL8. How do those answer my questions?
They don't - I was musing on whether having foreign 4.x kernels on RHEL7 was a good idea. It essentially means RedHat won't support you. Since we don't know why you have those kernels we can't tell if you need them.

As mentioned earlier, though, RedHat doesn't support 4.x kernels on RHEL7. Are you running Oracle products on this server that require a 4.x kernel? You might want to consider moving on to RHEL8 so you have a supported platform (or even OEL7 if that uses 4.x kernel). If you're willing to give up support you might want to move to CentOS7 and add the 4.x kernel to save money on subscriptions.

Last edited by MensaWater; 07-09-2019 at 08:09 AM.
 
Old 07-09-2019, 08:02 AM   #9
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Originally Posted by dc.901 View Post
I have RHEL 7.6 machines but none are showing 4.x kernels (even when I try to do yum update).
As I noted yesterday. there is no official support for 4.x kernels in RHEL7 so one wouldn't have them on RHEL7 unless they came from somewhere else (e.g. Fedora EPEL or Oracle's site). My read yesterday only mentioned uek in relation to Oracle.
 
1 members found this post helpful.
Old 07-09-2019, 10:00 AM   #10
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Quote:
Originally Posted by MensaWater View Post
As I noted yesterday. there is no official support for 4.x kernels in RHEL7 so one wouldn't have them on RHEL7 unless they came from somewhere else (e.g. Fedora EPEL or Oracle's site). My read yesterday only mentioned uek in relation to Oracle.
Understood, I was mostly curious about where the 4.x kernels came from, and the OPs last response contains that info. Thanks for the explanation!
 
Old 07-09-2019, 10:11 AM   #11
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Originally Posted by Prze-moC View Post
[przemek@plsekatlastst01 ~]$ yum repolist
Loaded plugins: ulninfo
repo id repo name status
ol7_UEKR4/x86_64 Latest Unbreakable Enterprise Kernel Release 4 for Orac 96
ol7_latest/x86_64 Oracle Linux 7Server Latest (x86_64) 13,168
repolist: 13,264
[przemek@plsekatlastst01 ~]$ grep installonly_limit /etc/yum.conf
installonly_limit=2
That confirms the kernels came from Oracle's repositories.

I notice you marked this SOLVED. Did you in fact remove the two 4.x kernels with yum remove?
 
Old 07-09-2019, 10:13 AM   #12
Prze-moC
LQ Newbie
 
Registered: Jul 2019
Posts: 11

Original Poster
Rep: Reputation: 2
Thanks - "yum remove" cleaned-up the /boot, so I'm good. Apparently it was all about naming the packages as "kernel-uek" instead of just "kernel" that package-cleanup does not "see".
I had no other reasons to upgrade than that I think it is generally good to keep the OS up-to-date. I will be updating with yum and manually removing old kernels if needed, then.
 
1 members found this post helpful.
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
why cann't the getchar() return? ebd Programming 3 08-14-2009 01:28 AM
why "cann't retrieve repository meat data" is displayed on clicking on application? ari_giri111 Linux - Newbie 2 01-29-2009 02:44 AM
Why cann't unzip a .zip file? backpacker Linux - Newbie 1 02-05-2006 09:25 PM
socket program:why server cann't receive ljqu_happy Programming 7 10-30-2004 08:26 AM
Why cann't root modify the xinetd.d directory? gxie Linux - General 2 11-26-2003 03:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:37 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