Category: Linux

In one of my earlier posts, we discuss about password protecting single user mode which can enhance the security of your system. But there is also a different aspect of this security patching that if you forget  the root password, you can’t even login to single user mode to change the password or to perform any other maintenance related task. So today we’ll deal with this critical situation where you can change your password even if your single user mode is password protected.

The process is quite simple. At the time of booting press any key to edit the grub menu. Select the operating system and press e. Now go to the kernel line and press e again. It’s time to change some kernel parameters. So write init=/bin/bash and press enter to come out of this. Now press b to boot.So what we have actually done is to tell kernel that instead of starting normal inittab file just give me a simple bash shell.Now you’ll get a bash shell.
hacking password protected single user mode in Linux The process from this point of time is as following where we need to issue some commands-

  • First of mount the / partition in read-write mode. So issue mount -o remount, rw / command.
  • Now change the password using passwd command.
  • Again remount the / partition in read only mode by using mount -o remount, ro / command.

Now just restart the machine and you’ve successfully changed your root account password. I think that you’ll love this small hack. Enjoy!!!


Welcome back to the troubleshooting tutorials series we are sharing through this blog. For the past 4 days I am dealing with troubleshooting of different configuration files under /etc and /boot and whatever I learn from that experience is presented here so that more and more people can acquire the basic troubleshooting skills in Linux. Today we’ll see what to do in case your inittab file is deleted.

First of all let’s understand what is the importance of inittab file. You  may know that init is the first process running under Linux and this file is used to start init process. This file also start the runlevels and if this file is deleted you won’t be able to boot. You can’t use even single user mode to fix the problem.

Recover from deleted /etc/inittab file in RHEL

The situation may seem complex to you but the solution is quite easy for that kind of problem. Here we’ll have to enter into rescue mode and if you are following this tutorial series then you must recall that I have told you how to enter into rescue mode. If you have missed the show then that’s not a problem as you can get it from this link.

Now when you’ve entered into rescue mode then it’s time to enter into root environment using chroot /mnt/sysimage command.Now you’ll have to mount he CD or iso file in case you are using RHEL under VMWare. To mount it issue mount /dev/hdc /mnt command. Do remember that on your system the path to CD or iso may be different from mine. So you must know the right path and for this you can use df -h command.

Once you have mounted the CD or iso all you need to do is to install initscripts rpm file stored under Server folder of the CD or iso. So issue rpm -Uvh –force /mnt/Server/init and hit tab to auto-complete the full name of the initscripts rpm file.Once the installation is complete you’ll get your inittab file back.

But there is a small glitch.When you’ll reboot your machine then it will boot into runlevel 3. You can change the default runlevel to 5 and next time it will boot in graphical mode.

That’s done for today.Let’s see what’s next.

Missing initrd File In RHEL

Back again with another troubleshooting tutorial. This time we’ll deal with the initrd image file. This is the file needed during the booting to initialize the kernel. As I told you earlier that I am using scripts contained in Trouble-Maker tool. Last time it blow my network off and this time it’s playing with my initrd image. After running that script I got following screen-

Missing initrd image file in RHEL

As you can see that it’s showing file not found error. I even tried to boot into single user mode but that didn’t work because the same message appeared there too. Now the last option is to boot into rescue mode and try to recover from the shit.

I am using RHEL on Vmware and I select the booting device to CD to enter into rescue mode..You can also boot from RHEL CD if you are using RHEL as a stand-alone installation.  At the start of booting you’ll be prompt with the following screen. Type linux rescue to enter into rescue mode.

Booting into Linux Rescue Mode

Once you boot into rescue mode you’re system will be mounted on /mnt/sysimage. To enter into root environment you’ll have to issue chroot /mnt/sysimage command. So type this command.

We know that initrd file is defined at /boot/grub/grub.conf file. So I opened this file using vi /boot/grub/grub.conf command.You can’t use vim here. But here everything was ok.

Missing initrd file in RHELNow I got stuck at this point because grub.conf file was correct. Then I listed /boot to see the contents of the directory and-voila! The problem was here. The script I executed didn’t alter my grub file but it changed the name of the initrd file.

Recovering from missing initrd file in RHEL

It appended .missing to the name of initrd file and thus making it inaccessible for grub. To recover from that problem I just renamed it to its original name using mv /boot/initrd-2.6.18-128.el5.img.missing /boot/initrd-2.6.18-128.el5.img command.Now just save it quit the rescue mode using ctrl+d.Now the system started normally. So another problem is solved successfully.Let’s see next is what.