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.

Advertisements