3

When studying about Linux runlevels I came across something I was unable to explain to myself while trying to change the DEFAULT_RUNLEVEL.

When I boot Mint, it starts in runlevel 5, even though it clearly states that the DEFAULT_RUNLEVEL is 2.

In Linux Mint 18.3 there is no more /etc/inittab by default. Thus, the DEFAULT_RUNLEVEL config comes from /etc/init/rc-sysinit.conf.

This file has a few references to DEFAULT_RUNLEVEL or RUNLEVEL, as can be seen in the below extract from it:

# Default runlevel, this may be overriden on the kernel command-line
# or by faking an old /etc/inittab entry
env DEFAULT_RUNLEVEL=2

Yet, there is no /etc/inittab. Therefore, I keep reading the rc-sysinit.conf file:

for ARG in $(cat /proc/cmdline)
do
case "${ARG}" in
-b|emergency)
    # Emergency shell
    [ -n "${FROM_SINGLE_USER_MODE}" ] || sulogin
    ;;
[0123456sS])
    # Override runlevel
    DEFAULT_RUNLEVEL="${ARG}"
    ;;
-s|single)
    # Single user mode
    [ -n "${FROM_SINGLE_USER_MODE}" ] || DEFAULT_RUNLEVEL=S
    ;;
esac
done

Even though this seems to be the solution to my question, taking a look at /proc/cmdline reveals that it does not fulfill case [0123456sS] because cat /proc/cmdline results in the following output:

BOOT_IMAGE=/boot/vmlinuz-4.10.0-38-generic root=UUID=03a422a0-4301-4153-8c60-1ea912ad732f ro quiet splash vt.handoff=7

Is there any other place that could overwrite the DEFAULT_RUNLEVEL?

Sakk
  • 31
  • 1
    This is some excellent deduction and research by the way. Keep it up thats the right way to learn. I suggest you check what actually is starting your system: ls -la /sbin/init – jdwolf Jan 03 '18 at 06:38
  • 2
    As jdwolf points out, the fact that you have Upstart files installed is confusing you into thinking that your system still uses run levels. Your operating system is based upon Ubuntu 16, which does not use Upstart at system level any more, and you are thus looking at entirely the wrong subsystem. The system that you are using does not have run levels. That concept is gone. Forget about run levels. – JdeBP Jan 03 '18 at 07:54

0 Answers0