Linux How to recover grub.conf password and remove kernel panic error


Linux How to recover grub.conf password and remove kernel panic error

The Grand Unified Boo tloader (GRUB) is a multiboot boot loader used for Linux With GRUB, users can select operating systems to run from a menu interface displayed when a system boots up. Use arrow keys to move to an entry and press ENTER.
As suggested by the Red Hat exam requirements, for the RHCT exam, you need to know how to use the GRUB menu to boot into different runlevels, and diagnose and correct boot failures arising from boot loader errors. We have covered how to boot system in different run level already in pervious article check that for run level related question.
In this article we will cover two most command booting issue. kernel panic error and grub password

RHCE Exam Questions

You are giving RHCE exam. Examiner gave you the Boot related problem and told to you that make successfully boot the System. While booting system, you saw some error and stop the boot process by displaying some error messages.
Kernel Panic - not syncing: Attempted to kill init!
And no further boot process. What you will do to boot the system.
If you are getting the Kernel panic error, it means it is boot loader related problem. Redhat Enterprise Linux uses the GRUB boot loader. You can pass the kernel parameter from the boot loader as well as you can correct the kernel parameter passing from boot loader from GRUB screen at boot time.

RHEL Linux Kernel panic error

For this practical we will modify grub.conf So you can understand what exactly case the kernel panic error.
always take back up before modifying grub.conf parameter
 #cp /etc/grub.conf /root 
open /etc/grub.conf from vi command 
vi grub.conf
Default grub.conf file look like this We suggest you to cram up this file 
default grub.conf
Now change kernel line as show below [ change forward slash/ to backward slash\ ]
grub.conf
Save file with :wq and reboot the system
On Restart you will get kernel panic error 
kernel

How to remove kernel panic error

Reboot system and press space bar on boot menu and select kernel line 
select kernel line
Now press e for edit and you will see the wrong entry of kernel line in grub.conf 
kernel line with error
Correct the kernel parameter replace backward slash\ to forward slash/ and press enter to save
kernel line without errro
This will correct this error temporary.You will get same error after rebooting the system . As change here will not change the default faulty grub.conf so after booting system don't forget to Correct the kernel parameter replace backward slash \ to forward slash /
 #vi /etc/grub.conf 
default grub.conf

How remove grub.conf password

By booting system in single mode one can easily recovered root password. This could case great security risk. For this every Linux system administrator password protect the grub.conf Two types of password can be set on grub.conf one to edit the parameter in grub.conf during boot process and another to boot operating system. But what if you lost both root and grub.conf password.
For this practical open grub.conf file
 #vi /etc/grub.conf 
Set password for editing just below the hidemenu option and Set password for booting the OS just below the title menu
edititing grub.conf
Now save file with :wq and restart the system
Now press space bar on boot menu and press e to edit It will ask to give the password which you set below thehidemenu
select os menu
After it on boot screen it will ask OS password which you set under the title menu 
booting screen with password
Now assume that you lost all three root, grub.conf and boot loader password. How will you recover these passwords.
Boot system from Linux CD and give linux rescue command on boot screen 
linux rescue
Select language to English 
Select language to English
Select Keyboard layout to US 
Select Keyboard layout to US
Press enter on continue and it will search for linux on hard disk

We don't need networking for this operation so select no 

Rescue mode will mount system image under the/mnt/sysimage folder press ok
now change chroot to/mnt/sysimage and open/etc/grub.conf

Remove both hidemenu and title password and save file 

Now reboot the system and remove Linux CD from CDROM
After reboot there should be no password onOS selection screen 

And on boot screen
We have recovered both boot loader and OS selection menu password now you easily recovered root password by booting system in single mode.

Share this post


No comments:

Post a Comment