I created a startup script to start/restart/stop a group of applications. I used the lib /etc/init.d/functions in my script. It is working well on my system, but it not working for my client; he is getting the error:

No such file or directory /etc/init.d/functions

Right now I don't know which linux distro my client uses. Is the init.d/functions file different for different Linux distros? If so, how can I find it?

  • Note that this error can also be caused by Windows line endings. Aug 4, 2013 at 18:47

6 Answers 6


It's specific to whatever distribution you're running. Debian and Ubuntu have /lib/lsb/init-functions; SuSE has /etc/rc.status; none of them are compatible with the others. In fact, some distributions don't use /etc/init.d at all, or use it in an incompatible way (Slackware and Arch occur to me off the top of my head; there are others).

  • can i know which is the file and where is it located for Redhat 5.5?
    – tecman
    Mar 15, 2011 at 20:52
  • Also, how can i find those file name and path? is there any way to do that or is it that we can only find it from the documentation?
    – tecman
    Mar 15, 2011 at 20:54
  • I did it by looking, as I have both of those available; I don't have a Red Hat install. But you may have missed the importance of what I said in bold above: the functions in your /etc/init.d/functions don't exist on other distributions. Every distribution has its own rules for /etc/init.d, and its function library (if any) is oriented around those rules; for example, SuSE's rc_status -s. There are some LSB "standard" functions, which are supposed to be found in /lib/lsb/init-functions, but your client may not be running a distribution which has been updated to provide it.
    – geekosaur
    Mar 15, 2011 at 21:04

In CentOS 7 Docker image I had to simply install the package initscripts in order for this script to be installed:

yum install -y initscripts

(Thanks to this issue on docker-library which made me look at this commit)

  • This fixed my issue using Jenkins on Fedora 24 in a Docker container. (just used dnf instead of yum of course). Thanks! Apr 12, 2017 at 19:04
  • This also works when installing MarkLogic 9 into a Centos7 docker container. The installation docs only mention needing lib.so.6 and lsb-core-amd64, but I'm guessing since they're talking about installing on a full CentOS 7 install, they would overlook that you'd need the initscripts package.
    – alc6379
    May 8, 2017 at 22:50
  • This fixed my issue on Docker Centos 7
    – LahiruTM
    Dec 11, 2020 at 3:31
  • This is still current for RockyLinux 9. dnf install -y initscripts Aug 16, 2022 at 17:32
  • this + chkconfig still allows even fedora 34 to function with old installers like ossec-hids. Oct 6, 2022 at 14:00

That is absolutely distribution dependent. You're really going to need to find out the distro in order to write a properly-matching init script.

You can also follow the LSB (Linux Standard Base) specification and hope that the distro in question did too. The current specification dictates that the standard init script functions be available as /lib/lsb/init-functions (see docs here). On Fedora and other Red Hat related distros, that's provided by the redhat-lsb package, which is optional.

So, you really have to figure out what you're targeting. Sorry.


Adding a recent answer

As noted in another answer, Linux Standard Base (LSB) specs provide a way to write platform independent init.d based startup scripts, using the LSB defined init functions as listed here

All LSB compliant distributions (all the big ones) provide the file /lib/lsb/init-functions (which defines the listed functions) in the meta-package lsb-core-noarch which can be installed using the distribution's package manager $PKGMAN $INSTOPT lsb-core-noarch (yum,dnf,apt,...).

An example of such an init script is this.

However, given how systemd is now the de-facto system and service manager for most distributions, it's better to write a systemd service unit instead of writing out an initscript.


I missed those functions when I moved to Ubuntu, so I created a library that recreates their functionality: efunctions.


I too got the same error while I run my docker container. It was fixed by adding below line in my Dockerfile

RUN yum install -y initscripts

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .