[info] How to bring back the runlevel 3 a.k.a "terminal mode"

rado84

Well-Known Member
Joined
Feb 25, 2019
Messages
1,083
Reaction score
921
Credits
8,303
In the past year or so Arch Linux, among many othe distros, for unknown reasons disabled or completely removed the runlevels from the linux kernel and now this can only be achieved by using a systemd target. So if your system is using systemd, that will work 100% for your system. If your distro is running on something else that isn't systemd, you should probably check their way of entering runlevel 3 equivalent.

I won't explain what the terminal mode is for - I'm assuming that if you're reading this subforum, you're already aware what it is used for, so straight to the point.

Until recently the runlevel 3 was enabled by adding the number 3 at the end of the linux line in grub.cfg. But since that doesn't work anymore and the kernel simply ignores that number 3, now there's another way: you have to replace that "3" with

Code:
systemd.unit=multi-user.target

This is what the linux line in my grub.cfg looks like (I have a separate menu entry for runlevel 3):

Code:
linux    /boot/vmlinuz-linux root=UUID=[number] rw  acpi=force acpi_enforce_resources=lax intel_pstate=disable systemd.unit=multi-user.target

The only difference between that and the traditional runlevel 3 is that the systemd method doesn't automatically log you in as root and you have to do it yourself. But the important thing is that it works!

IMG_20241227_224152.jpg
 


Until recently the runlevel 3 was enabled by adding the number 3 at the end of the linux line in grub.cfg. But since that doesn't work anymore and the kernel simply ignores that number 3, now there's another way: you have to replace that "3" with
Fortunately, in debian machines here, the kernel option 3 is still recognised by the kernel which will bring up the text prompt for runlevel 3 where the network is up and the machine runs as expected from the terminal.

It's also the case here that if a machine has a DE installed, but is configured to start up to a text prompt, that entering a number 5 as an option on the kernel line, the machine will boot into the DE GUI login screen which is the traditional runlevel 5 state.

The runlevel manpage states that:
systemd provides a compatibility layer that maps runlevels to targets, and associated binaries like runlevel
which I guess explains why runlevels still work on the machines here with systemd .

It also advises that:
Runlevels should not be used in new code, and are mostly useful as a shorthand way to refer the matching systemd targets in kernel boot parameters.

rado84 wrote:
The only difference between that and the traditional runlevel 3 is that the systemd method doesn't automatically log you in as root and you have to do it yourself.
I'm not aware that runlevel 3 logged in a user at all, but rather presented a login prompt for a user, either a non-root user or root user, to log in. In the case of entering the runlevel number 1, the machines here will boot to "single user" or "rescue" mode where the kernel asks for the root password and then logs the user in as root if the correct password is provided. It used to be the case with many distros in the past that using the runlevel 1 facility would directly log in the user to a root shell, but recently one evidently may need to supply the root password which is likely a systemd addition since it's happening on machines running systemd. I don't have any sysVinit distros running at present to check that out.
 
Last edited:
I'm not aware that runlevel 3 logged in a user at all
In older versions of the Arch kernel, it did that. Starting at runlevel 3 used to autologin you as root. I had enabled autologin with the desktop but only for my user, not for root. That might have been a bug but it was a useful bug bc it used to save me the trouble to login as root myself.
 


Follow Linux.org

Members online


Top