Why is my Debian jessie always in runlevel 5?
Solution 1
$ 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.
Solution 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
Solution 3
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.
Related videos on Youtube
Matthias
BY DAY: Software developer; BY NIGHT: Iron Man, or at least trying to be him.
Updated on September 18, 2022Comments
-
Matthias over 1 year
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 systemLinux 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
issystemd-sysv: /sbin/init
-
Admin over 9 yearsYou are using SysVinit, right? What is the output of
dpkg -S /sbin/init
? -
Admin over 9 yearsIt's
systemd-sysv: /sbin/init
-
-
Gilles 'SO- stop being evil' over 9 years@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. -
Matthias over 9 yearsYour 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!
-
Evgeny Vereshchagin over 8 yearsthis is the same answer as unix.stackexchange.com/a/164028/120177 . But you forgot about link to freedesktop.org/software/systemd/man/systemctl.html
-
deppfx over 8 yearsDone. Added the sources.