LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-07-2017, 10:38 AM   #1
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Rep: Reputation: 103Reputation: 103
how reinstall latest kernel after deleting it from /boot


Hi,

I've deleted all initram, vmlinuz and other files related to all kernel versions with the exception of one version, which isn't the latest. So I currently have kernel 3.10.0-514.16.1, but I now that the latest is 514.21.1. I've tried yum reinstall kernel-headers, and yum does display the latest version, but this doesn't really work. There's nothing more showing up in /boot.
I've also simply tried yumdownload linux-headers, but that doesn't work either. I'm using Centos 7.

How do I go about updating to the latest version?
 
Old 06-07-2017, 10:44 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,914
Blog Entries: 13

Rep: Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948
Firstly, recommend you back up all data you intend or need to keep.

Here is a reference for how to upgrade your CentOS version and software all to the latest updates: https://www.centos.org/docs/5/html/y...ur-system.html

I do fear that you've manually tinkered too much and there may be complications.

Recommend you give that a try, however if you run into the possible complications, it may require a full re-install.
 
Old 06-07-2017, 10:55 AM   #3
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
First of all I should state that there's no panic, this is just a testing vm. I would have at least copied the kernels somewhere else instead of deleting it if it was essential. Secondly, Centos 7 has no runlevels I was mostly expecting to find a way of reindexing the rpm or something like that so that yum knows that the actual version of my kernel isn't the latest. It's obvious that it's not checking.

Even so, I don't think there's any need for a full reinstallation, I would expect yum to actually update correctly when the next kernel version arrives.

I should also add, if it isn't self-evident, that I can boot the machine very well with that kernel version.

Last edited by vincix; 06-07-2017 at 10:56 AM.
 
Old 06-07-2017, 12:04 PM   #4
sgrlscz
Member
 
Registered: Aug 2008
Posts: 123

Rep: Reputation: 84
If you do an 'rpm -q kernel', you'll get the list of kernel packages that are installed. To clean things up, just use 'yum remove' to remove the kernel RPMs for the versions you manually deleted from /boot. You'll get warnings about missing files, but the RPMs will be removed (unless something else is broken).

Then you can do a 'yum update kernel', and it will reinstall the latest kernel.
 
1 members found this post helpful.
Old 06-07-2017, 12:16 PM   #5
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
Thanks. That did the trick. On the other hand, when I tried it on another vm (which I'm using 'seriously', as it were) on the currently running kernel, yum also said that it was going to remove all sorts of dependencies, including perl, and (as a consequence, I guess?) spamassassin. So I'm just wondering what would happen if I remove it and if I could restore the other necessary packages (spamassassin is obviously one of them).
 
Old 06-07-2017, 12:48 PM   #6
sgrlscz
Member
 
Registered: Aug 2008
Posts: 123

Rep: Reputation: 84
That's strange. When I try a 'yum remove' with the running kernel, it says 'Skipping the running kernel' and won't remove it.

Any time you try a 'yum remove', and you get a long list of things to remove, be very careful. There are things that can hopelessly break a system if they are removed.
 
Old 06-07-2017, 01:11 PM   #7
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
Indeed, it is strange, because now I've tried to remove it again and it displayed the same message as in your case. And I looked up the previous command in history to make sure that I was trying to remove the same kernel version and it was the same thing: 974 yum remove kernel*21.1*
And now I tried 1012 yum remove kernel-3.*21.1*
There's no other current kernel version containing "21" after the "514" part (at least not for Centos). The previous one is 16.

Don't like the inconsistency
 
Old 06-07-2017, 01:22 PM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,797

Rep: Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222
Have you tried "yum reinstall kernel"? I don't know whether yum is going to allow reinstalling the version that is currently running.
 
Old 06-07-2017, 02:49 PM   #9
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
No, I hadn't. I only tried 'kernel-headers' for some obscure reason I deleted the kernel from /boot again, I rebooted into a previous kernel version and I reinstalled the newest kernel through yum reinstall kernel and it worked fine just like that.

Indeed, you're right, if you're currently running the respective kernel, you won't be able to reinstall it. So it works only by reinstalling/removing a previous kernel.

Last edited by vincix; 06-07-2017 at 03:23 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] reformat and reinstall not deleting data sfzombie13 Debian 1 10-03-2015 11:44 PM
deleted /boot partition Need to reinstall kernel zoidburg016 Debian 11 04-22-2007 02:50 AM
Deleting Apache and Reinstalling, PHP also need to reinstall jCash Linux - Newbie 2 02-16-2007 09:40 PM
X not starting in Fedora 2(latest kernel), already tried reinstall, didnt work RagingIfrit Fedora 11 09-22-2004 05:22 PM
Deleting old kernel and removing it from boot loader? Koolinux Linux - General 4 11-07-2002 07:10 PM

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

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