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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
06-07-2017, 10:38 AM
|
#1
|
Senior Member
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240
Rep:
|
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?
|
|
|
06-07-2017, 10:44 AM
|
#2
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,914
|
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.
|
|
|
06-07-2017, 10:55 AM
|
#3
|
Senior Member
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240
Original Poster
Rep:
|
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.
|
|
|
06-07-2017, 12:04 PM
|
#4
|
Member
Registered: Aug 2008
Posts: 123
Rep:
|
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.
|
06-07-2017, 12:16 PM
|
#5
|
Senior Member
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240
Original Poster
Rep:
|
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).
|
|
|
06-07-2017, 12:48 PM
|
#6
|
Member
Registered: Aug 2008
Posts: 123
Rep:
|
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.
|
|
|
06-07-2017, 01:11 PM
|
#7
|
Senior Member
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240
Original Poster
Rep:
|
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
|
|
|
06-07-2017, 01:22 PM
|
#8
|
Senior Member
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,797
|
Have you tried "yum reinstall kernel"? I don't know whether yum is going to allow reinstalling the version that is currently running.
|
|
|
06-07-2017, 02:49 PM
|
#9
|
Senior Member
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240
Original Poster
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 04:14 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|