Changing the default Run target in Linux

How to Change Default Run Target on Linux

Estimated reading time: 3 minutes

Run targets, also known as runlevels or systemd targets, define the system’s state during different stages of operation. In traditional SysVinit systems, runlevels ranged from 0 to 6, each representing a different operational state. However, modern Linux distributions using systemd use targets for similar functionality. This blog post explains how to change the Default Run Target on Linux.

SysV vs systemd

SysV (System V init): An older init system that uses runlevels to define different modes of system operation. Each runlevel is a state that defines what system services are operating.

systemd: A modern init system and service manager that uses targets instead of runlevels. Targets provide more flexibility and parallelization in booting processes.

Changing the Default Startup Target

Changing the default run target on most modern Linux distributions using systemd is straightforward. Here’s how you can do it:

Check the Current Default Target

This command will show the current default target, such as graphical.target or multi-user.target.

List Available Targets

This command lists all available targets on your system.

Set the Default Target

To change the default target, use:

For example, to set the default target to multi-user (non-graphical), you would run:

Reboot the System

After rebooting, the system will start with the new default target.

Switching Default Startup Targets Temporarily

If you need to switch targets temporarily without changing the default, you can do so with:

This is useful for tasks like troubleshooting or maintenance.

Important Run / systemd targets

default.target

This is the target that is booted by default. This is a symbolic link to another target, like graphical.target.

emergency.target

Starts an emergency shell on the console. You can find it in your GRUB 2 menu or enter it at the boot prompt as systemd.unit=emergency.target.

graphical.target

Starts a system with networking, multiuser support, and a display manager.

halt.target

Shuts down the system.

multi-user.target

Starts a multiuser system with networking and no graphical environment.

reboot.target

Reboots the system.

rescue.target

Starts a single-user system without networking.

Conclusion

In this blog post, we explained how to change the systemd default run target for your Linux system. Have you tried changing run targets on your Linux system? Share your experiences or questions in the comments below!

Further reading

Leave a Reply

Your email address will not be published. Required fields are marked *