7

I have configured the lines in /etc/inittab as follows:

# The default runlevel.
id:2:initdefault:

But after logging in the output of runlevel is as follows:

N 5

So why am I in runlevel 5 instaed of 2?


Note: As an additionaly info here is uname -a output for my system

Linux d3bi4n 3.16.0-4-amd64 #1 SMP Debian 3.16.7-2 (2014-11-06) x86_64 GNU/Linux

and the output of dpkg -S /sbin/init is

systemd-sysv: /sbin/init
Matthias
  • 993
  • 1
  • 11
  • 22

5 Answers5

10
$ dpkg -S /sbin/init
systemd-sysv: /sbin/init

Your init system is Systemd, not SysVinit. /etc/inittab is a configuration file of SysVinit, it is not used by Systemd. I presume you have this file because this is a jessie system which was upgraded from an earlier jessie or from wheezy with SysVinit.

Systemd doesn't exactly have a concept of runlevels, though it approximates them for compatibility with SysVinit. Systemd has “target units” instead. You can choose the boot-time target unit by setting the symbolic link /etc/systemd/system/default.target. See the Systemd FAQ for more information.

If you don't want to use Systemd, install the sysvinit-core package, which provides a traditional SysVinit (formerly in the sysvinit package, which in jessie is now a front for systemd). As of jessie, Debian defaults to Systemd but still supports SysVinit.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
  • Your figured it out. I upgraded from wheezy and was not aware of jessie using systemd. I switched back to sysvinit (for now) and it works fine. Thanks! – Matthias Dec 01 '14 at 16:10
2

Source: https://unix.stackexchange.com/a/164028/120177 , http://www.freedesktop.org/software/systemd/man/systemctl.html

Open a terminal and (as root) run:

systemctl set-default multi-user.target

or with --force

systemctl set-default -f multi-user.target

to overwrite any existing conflicting symlinks1.

Double-check with:

systemctl get-default

Another way is to add the following parameter to your kernel boot line:

systemd.unit=multi-user.target
deppfx
  • 256
  • 2
  • 9
1

You'll probably have runlevel 5 set in the kernel command line or arguments (look at your grub configuration):

You may override the default runlevel with kernel parameter. When the boot menu is displayed, select the edit option. Then locate the kernel line and append space and the desired runlevel number. E.g. "kernel /boot/vmlinuz-2.6.30 root=/dev/sda2 ro 3" would boot to runlevel 3. 

Jorge Nerín
  • 940
  • 5
  • 5
0

I looking how to run under Debian 8 similar like use with inittab system:

1:2345:respawn:/sbin/getty 38400 tty1

2:23:respawn:/sbin/getty 38400 tty2

3:23:respawn:/sbin/getty 38400 tty3

BPQ:2345:respawn:/home/bpq32/runbpq >/dev/tty4

where I have redirect output run program runbpq to /dev/tty4

but how to do this under Debian 8 with systemd ??

Best regards

sam
  • 22,265
  • 4
  • 22
  • 30
-1

From: https://wiki.debian.org/RunLevel

Default Debian installation does not make any difference between runlevels 2-5.

Sepahrad Salour
  • 2,629
  • 3
  • 20
  • 27
  • @matthias Your understanding is correct. By default, Debian configures exactly the same services to run in runlevels 2, 3, 4 and 5. Nonetheless, the runlevel number is tracked; the `inittab` line should make runlevel 2 the default. – Gilles 'SO- stop being evil' Nov 29 '14 at 21:59