2

I have not a clear understanding of runlevels and how they work.

I know runlevels are a digit indicating which processes should be started by init. Pratically speaking: at startup init sees this digit of rcS script and it decides if the script should be started or not?

Busybox doesn't have runlevels: it starts any script present in rcS...is it right?Pratically speaking it doesn't check the script digit?

Last question: why systemd desn't use runlevels? In my computer I see an rcS directory with several scripts and their associated digit (runlevel number).

1

Forget about runlevels.

When run levels were introduced in AT&T Unix System 3 (Yes, /etc/inittab arrived in System 3 not System 5.) there were mutterings in the BSD world, and the BSDs never adopted this system. All of these years later, most parts of the System 5 world have now done away with run levels.

In IBM AIX, the number of run levels used in practice shrunk to 1 back in version 3.1, with the advent of the System Resource Controller. IBM thought that people could forget about runlevels in 1990. Run levels 1 and 3 to 9 were "reserved" from that point onwards.

The systemd people declared runlevels to be "obsolete" in their doco, some two decades later. Like the SRC before it, and like other systems such as Solaris' SMF or Laurent Bercot's s6-rc or Gerrit Pape's runit-init or my nosh system management toolset; systemd does not require them, or the concept that they embody. There are instead better mechanisms, of various kinds, in these systems.

(runit has the concept of switching amongst several scan directories. s6-rc has the concept of switching the "live state". The nosh system-control has the concept of target service bundles that want/ or conflict/ with other service bundles. The Solaris SMF has "milestones" such as milestone/multi-user-server, milestone/self-assembly-complete, and milestone/name-services. And so on.)

BusyBox init has an inittab configuration file, but that is different to the more common one, and contains no notion of run levels.

So:

  • No, init does not look for things in those directories and scripts based upon run-level numbers. Only two init systems ever did, and even in one of them there was the option of an rc that used a data file instead of symbolic links under /etc/rc.d/.
  • No, even on the AT&T Unix System 3 system (and its successor and clones) it was not init that looked at those scripts. It was rc.
  • On systemd operating systems, the /etc/init.d/ scripts are processed by a backwards compatibility mechanism that turns them into native service units. This largely ignores the provided run-level information, in both the scripts themselves and in the /etc/rc.d/ subdirectories, and just hardwires some targets in its code.
  • No, run levels were not digits. S is a run level and not a digit, as are m, h, and AIX's a, b, and c. (I am not going to go into details here of what these were, because this is stuff that you can forget about.)

The one system bucking the trend is TrueOS. Based upon FreeBSD, which still itself uses Mewburn rc and FreeBSD init, neither of which have a run level mechanism, it adopted OpenRC to replace Mewburn rc. Ironically, it is thereby adding System 5 run levels to a BSD at the time when the System 5 side of the universe has finally consigned run levels to the dustbin of history. ☺

Further reading

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.