I just got a Raspberry Pi and I've been trying to set it up as a VPN server. I've been stuck on the step which requires you to establish a (pseudo) static public IP in order to configure DDclient correctly. I chose NoIP and have been trying to get the script running (outlined in NoIP's readme file) that automatically starts NoIP when the pi boots, but the instructions say to "place the following script in your startup directory. (/etc/init.d/rcX.d or /sbin/init.d/rcX.d)". It indicates that the way to determine the X is by running

grep initdefault /etc/inittab | awk -F: '{print $2}'

The problem is that there doesn't appear to be any such directory on my version of Raspbian (the default version that comes with the model B--uname -a says Linux raspberrypi 4.1.7+ #817.

Could somebody help me figure out what this grep command is searching for and where I should actually place this script?

(Sorry in advance for the formatting mishaps, doesn't really look right based on what I've seen on this site but it's my first time posting a question).


  • 1
    How about calling that script in rc.local. As by the time rc.local is executed, all most every other services including networking and all are up. Oct 19, 2015 at 8:33
  • @dastaan right now rc.local has a comment that says "by default this script does nothing", and it also seems to print the IP address. Would doing this be as simple as pasting the script given in the readme of NoIP into rc.local instead of (what I'm guessing is) just a filler IP address printer? Oct 20, 2015 at 0:47
  • 1
    It says "does nothing" because there's nothing in it to do (it's all yours). But don't paste the whole script in, because whatever happens there should exit ASAP -- generally by forking to create a new background process (which can run as long as it likes). The shell operator for this is &, e.g. /path/to/whatever & will start whatever in the background.
    – goldilocks
    Oct 20, 2015 at 1:33
  • I think I understand. So even though the script's only function is to start NoIP upon system startup, if you don't fork the NoIP process, when the script finishes running the NoIP process would be killed? Oct 20, 2015 at 1:56
  • @noodlesandnoodles: It's more a legacy thing. There's nothing it it because all the logic has moved to systemd files. And if you don't fork the NoIP thing, the boot process would have to wait (this is annoying, not harmful).
    – MSalters
    Oct 20, 2015 at 8:39

1 Answer 1


Quick Background

The current version of Raspbian is 8, aka. jessie. Raspbian is Debian compiled for the Pi,1 with some configuration tweaks and an appropriately customized kernel.

The current version of Debian is also 8, and a major difference between it and previous versions (Debian has been around for several decades) is that the init system, formerly a spin on the venerable SysV init (which is older than Debian itself) was replaced with systemd. GNU/Linux, like other unix derived operating systems such as Mac OS X, relies on an init system of one form or another. Systemd is a fairly new one first adopted by Fedora a number of years ago, and since then it has been gradually picked up by other distros (winning favor over Canonical/Ubuntu's upstart).

The problem is that there doesn't appear to be any such directory

Inittab wasn't a directory, it was a file. Part of what it did was determine the default runlevel, which corresponds to the "X" in /etc/rcX.d. Systemd does not use runlevels, the equivalent would be targets (primarily, "graphical" or plain "multi-user").

Fortunately, Debian has left in some backward compatible functionality and the rcX.d directories are still there and the stuff in them is still run. Running something from them was never really as simple as just placing a script there -- possibly you are paraphrasing -- but in any case, you can use them exactly the same way as before (if "they" say it worked, it still should). The runlevel you want to use is probably 2, or possibly 3. However, there is no harm in doing whatever it is you are supposed to do with the script for levels 2, 3, 4, and 5. Only one of them is actually used, so it is common practice to target those 4 (hence if you look, they are almost identical).

Another possibility, as dastaan points out, is to simply invoke the script from rc.local, which also still works. Make sure you use the full path and fork it by placing an & after that.

BTW, I don't think systemd is any harder to learn than SysV, and although there is much griping from people having to learn new things "when the old one was fine", if you haven't learned much of either one yet, you might as well start with systemd and ignore SysV, because SysV is pretty much dead, at least in the GNU/Linux world.

1. Hence the first version of Raspbian was 7, not 1.

  • Thanks for your thorough reply. I'm still very new to Linux and have never done any bash scripting so I appreciate the help. I will dig into systemd and try to get that script running properly. Oct 19, 2015 at 19:47
  • systemd is in fact an important improvement especially for devices like the Pi, precisely because it boots faster and more controlled. In particular, it has a more fine-grained control when each initialization task can start. That appears quite relevant here, as it means you can start the NoIP stuff after the network comes up, and the DDclient thing when NoIP is done. But that's really a question of its own.
    – MSalters
    Oct 20, 2015 at 8:36

Your Answer

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

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