I have accidentally deleted /etc/rc.d and /etc/rc0.d folders which resulted deletion of init.d and other related folders.

1.What is the use of /etc/rc.d, rc, rc.d, rc0.d, rc1.d, rc2.d.......rc6.d and other files inside /etc/rc.d?

2.If we accidentally delete them how to recover?

3.If we have the same files in other server can we copy and get the situation to normal?

4.Suggest any possible way to minimize the impact or totally resolve this situation.



Linux version 2.6.32-642.11.1.el6.x86_64 (mockbuild@x86-027.build.eng.bos.redhat.com) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) ) SMP Wed Oct 26 10:25:23 EDT 2016

  • 4
    You should start by changing the root password and giving it only to those persons you can trust not to have accidents like that. Only sure way to resolve is to restore these folders from your backup. Apr 23, 2020 at 7:49
  • question 1. I don't know if EL6 uses systemd, if not, without the rc.d folders none of the services on your system will be started on reboot. Before you reboot, make a list of all services running, so that you can reinstall them if necessary. Apr 23, 2020 at 7:55
  • Check all plugins properly, you might have issues with them Apr 23, 2020 at 11:38

1 Answer 1

  1. /etc/rcX.d (where X is the runlevel) contains symbolic (a.k.a. soft) links to init scripts in /etc/init.d that are to be executed by /sbin/init (on boot). It is explained for Red Hat Enterprise Linux 6 with pretty much detail here: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/installation_guide/s2-boot-init-shutdown-init

  2. The best thing would be to recover them from a recent backup (as already mentioned by Gerard H. Pille in his comment above). Should you lack such a backup you could try to recover them using /sbin/chkconfig or /usr/sbin/ntsysv which provides a ncurses user interface. I have no experience with it, but you can find a manual here: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/s2-services-ntsysv

  3. If the other server has been set up in the exact same way (e.g. with ansible or some setup script) this might be a viable solution. In any case the structure of the other server could be helpful when using /usr/sbin/ntsysv

  4. Try not to reboot the server until you have restored the /etc/rc.d folders and symlinks. Good luck!

According to the comment by Gerard below you could also try to install the yum-verify plugin:

yum install yum-plugin-verify

and make sure that you have


in /etc/yum.conf. Then execute

yum verify-all

and it should check all installed packages and report missing configuration files. Re-installing misconfigured packages should solve the problem, but again, I never had to do this myself.

Update You should re-create the symbolic links for each and any service that is runninf on the identical other server with

chkconfig service_name on

where service_name is the name of the init.d script you want to start on boot. Using this command should make sure that the links are created within the appropriate runlevel folder.

You can check your progress with

chkconfig --list

and compare the output with the output on the other server.

You can find a chkconfig manual here: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/s2-services-chkconfig

  • Thanks @digijay Let me try this!
    – Tech User
    Apr 23, 2020 at 8:14
  • @TechUser You're running Enterprise Linux on multiple servers. Can't you get assistance from someone with basic Linux knowledge? Apr 23, 2020 at 10:17
  • Digijay, would yum allow him to check missing files for the installed packages? Apr 23, 2020 at 10:17
  • Thanks Gerard, I've added this to my answer. BTW I have only limited knowledge of RH because I'm a Debian guy … and often RH/CentOS/Suse feels really annoying to me ;-) With Debian/ubuntu I would just use rcconf to fix this.
    – digijay
    Apr 23, 2020 at 10:38
  • 1
    Thanks, digijay, Debian myself until I switched to Devuan. Still, rcconf was new to me, knew it had to exist but never needed it. And some extra knowledge about Redhat won't hurt. Apr 23, 2020 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.