I am relatively new to black-screen Os-es (*nix) I was given few commands to run on Linux:

  • remove etc/rc.d/rc0.d remove only logscan, procscan and gpp

I got confused and did:

  1. rm -rf rc.d
  2. rm -rf rc0.d as a result init.d also got deleted.**

Later, I copied the rc.d folder from another server but there are several softlinks and the whole folder structure was lost, no softlinks only files were there.

What is the impact or effects of removing /etc/rc.d and /etc/rc0.d? How is it related to the init.d file? Can we restore these files (rc.d & rc0.d)? Can we perhaps copy them from another server and place them under /etc? Will that help? Does restarting help?

  • Is this a systemd operating system? Your operating system isn't Linux. That is an operating system kernel. Your operating system will be something like (for examples) Arch Linux, or Ubuntu, or Fedora, or OpenSUSE. Without knowing that, answerers cannot know how problematic the situation is, or what the names of the tools for correcting the situation even are. – JdeBP Apr 22 at 23:21
  • Hi @terdon or someone please find the OS details. cat /proc/version 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) ) #1 SMP Wed Oct 26 10:25:23 EDT 2016 Please help me!! – Tech User Apr 23 at 2:03
  • To find the operating system and version, try any of the following commands: cat /etc/*-release hostnamectl lsb_release -a cat /etc/issue. – Nasir Riley Apr 23 at 3:46
  • @NasirRiley I have found the OS Version ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------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) ) #1 SMP Wed Oct 26 10:25:23 EDT 2016 – Tech User Apr 23 at 4:36
  • 1
    Red Hat 4.4.7-17 is just the version of the GCC compiler used to build your RHEL6 standard kernel version 2.6.32-642.11.1.el6.x86_64. The el6 in the kernel version indicates you're using RHEL/CentOS/OEL/ScientificLinux 6.x... and the kernel patch level -642 indicates the patch level of the whole OS is probably about RHEL 6.8 or so. – telcoM Apr 23 at 10:06

In RHEL 6, /etc/rc.d/init.d/ is the actual location of the SysVinit-style startup/shutdown scripts. /etc/init.d is a symbolic link to it.

The /etc/rc.d/rc[0-6].d directories should only contain symbolic links pointing to scripts in /etc/rc.d/init.d/. There is also a set of symbolic links at /etc/rc[0-6].d pointing to the respective directories in /etc/rc.d/.

The best option would be to recover these directories from a backup that was originally taken from the same server, as it ensures that you will have the exact same configuration as before.

But if you have multiple servers configured the same way (= the same RPMs installed, the same services running), then you could have pretty good (but not necessarily perfect) results by copying the directories.

I would definitely suggest copying /etc/rc.d/rc, /etc/rc.d/rc.sysinit from the other server first, as they are likely to be unchanged between servers. Without these scripts, the server will certainly crash to single user mode very early in the boot process, which may make further repairs more inconvenient.

/etc/rc.d/rc.local might or might not be modified by your local administrators; by default it does nothing, but it's better to have it exist. So copy it too, but if it has non-default contents, make sure the content is applicable.

You could then copy the contents of /etc/rc.d/init.d from a server that is configured the same as the damaged system, then use these commands to restore the default symbolic links for the scripts:

cd /etc/rc.d/init.d
for i in *; do chkconfig --add $i; done

This will restore the factory default enabled/disabled configuration of various services; after this, you should run chkconfig --list on both the damaged server and on the other identically-configured server, and use chkconfig <service name> on / chkconfig <service name> off commands to adjust the enabled/disabled state of various services to match what the other identically-configured server actually has (or whatever makes sense regarding the damaged server's purpose, if the other server is not exactly identical).

You can then use rpm -Va | grep /etc/rc.d/init.d to verify that all the scripts for software installed from RPMs are present. It will list any scripts that are missing or modified from their default state as delivered within the RPMs. If some scripts are missing, yum reinstall <package name> might be an easy way to fix them.

If you have some third-party software that is not installed from RPM packages, you will need to review their installation instructions and check if they have start-up scripts that will have to be replaced manually.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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