LinuxQuestions.org
Review your favorite Linux distribution.
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 05-20-2016, 06:32 AM   #1
leniviy
Member
 
Registered: Jul 2009
Distribution: Archlinux
Posts: 69

Rep: Reputation: 4
How to re-generate rescue kernel image for current kernel?


Hi.

Initially after installing Centos 7 1511 I had 2 entries in grub:

Code:
CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)
CentOS Linux (0-rescue-0175d9b02fad463da9f6044b7ae92091) 7 (Core)
After updating to kernel 3.10.0-327.18.2 additional hostonly entry appeared, but rescue image still boots the previous kernel version 3.10.0-327. Even after uninstalling kernel-3.10.0-327.el7.x86_64 the old rescue image is still there.

Who creates the rescue image? A kernel post-install script or anaconda?

How to fix this? Should I manually run dracut with "--no-hostonly -a 'rescue'" arguments?

Who should create /boot/vmlinuz-0-rescue* ?

Last edited by leniviy; 05-20-2016 at 06:36 AM.
 
Old 05-20-2016, 11:57 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
A rudimentary search sent me to look at /usr/lib/dracut/dracut.conf.d/02-rescue.conf (on Fedora in my case).
Code:
dracut_rescue_image="yes"
Looks like it should do the job - but doesn't. My rescue entry is from December 2013 - might have been broken for a while.

Edit: I might add, in all the years I've used Fedora (and occasionally RHEL/CentOS) I've never even thought of using this kernel.

Last edited by syg00; 05-21-2016 at 12:00 AM.
 
Old 05-21-2016, 01:52 AM   #3
leniviy
Member
 
Registered: Jul 2009
Distribution: Archlinux
Posts: 69

Original Poster
Rep: Reputation: 4
I think I found it:

Code:
rm -f /boot/vmlinuz-0-rescue-* /boot/initramfs-0-rescue-*.img
/etc/kernel/postinst.d/51-dracut-rescue-postinst.sh $(uname -r) /boot/vmlinuz-$(uname -r)
This script does not overwrite existing rescue image, this is why it's never updated.
 
1 members found this post helpful.
Old 05-21-2016, 02:56 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
So you only get one per install - maybe ok for Servers, but as in my case, version updates leave it horribly out of date.
I guess they don't want to risk replacing it each kernel update in case you need to use the immediate prior one for a recovery. Like I said, not much chance of that IMHO.
 
Old 06-18-2016, 03:39 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
And just to clean this up, yes the next kernel update did re-generate the rescue one it had been deleted.
 
1 members found this post helpful.
Old 05-03-2020, 05:27 AM   #6
Milan Kerslager
LQ Newbie
 
Registered: Sep 2005
Location: Liberec, Czech Republic
Distribution: RHEL, CentOS, Fedora Core
Posts: 2

Rep: Reputation: 0
Quote:
Originally Posted by syg00 View Post
And just to clean this up, yes the next kernel update did re-generate the rescue one it had been deleted.
To regenerate rescue kernel/initramfs immediately, reinstall kernel in CentOS 8 by:
Code:
dnf reinstall kernel-core
In CentOS 7 by:
Code:
yum reinstall kernel
 
Old 08-28-2020, 12:48 PM   #7
2ndAmendment
LQ Newbie
 
Registered: Oct 2011
Posts: 2

Rep: Reputation: Disabled
If you use the post install dracut script, you may get that command new-kernel-pkg is not found. It is a deprecated command. The rescue image files will be created, but the loader/entries/*-0-rescue.conf file will not be updated.

Quote:
Originally Posted by leniviy View Post
I think I found it:

Code:
rm -f /boot/vmlinuz-0-rescue-* /boot/initramfs-0-rescue-*.img
/etc/kernel/postinst.d/51-dracut-rescue-postinst.sh $(uname -r) /boot/vmlinuz-$(uname -r)
This script does not overwrite existing rescue image, this is why it's never updated.
If you use:
Code:
rm -f /boot/vmlinuz-0-rescue-* /boot/initramfs-0-rescue-*.img
/usr/lib/kernel/install.d/51-dracut-rescue.install add $(uname -r) "" /lib/modules/$(uname -r)/vmlinuz
you will not get the error and the rescue config file will be properly updated.
 
  


Reply

Tags
dracut



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
Kernel image corrupted : Wrong Image Format for bootm command ERROR: can't get kernel blink182 Linux - Embedded & Single-board computer 0 05-13-2011 03:11 AM
how to make boot able image from the current kernel elili Linux - Kernel 0 02-16-2011 11:35 AM
How to generate a .config file based on the current or initial installtion/kernel khaos83 Linux - General 11 01-22-2008 09:53 AM
Using a kernel image from -current? shadin Slackware 4 07-30-2006 07:53 PM
kernel includes at /usr/src/linux/include do not match current kernel. blanny Red Hat 1 03-09-2006 07:53 AM

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

All times are GMT -5. The time now is 04:27 PM.

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