How to boot Debian headless (without GUI)

8,081

Since systemd, the OS always boots into a so-called "target". On GUI systems, the default boot target is graphical.target, whereas on systems without any DE or graphical environment, it is called multi-user.target.

The proper way to make the machine boot only into tty, without any GUI, is to switch the default target:

systemctl set-default multi-user.target

To check what is the current default target:

systemctl get-default

And I do not know about the term headless, I've never seen it being used for such a case, and that's probably the reason why you couldn't find any information.

And to actually answer your questions:

Is this the right command for what I want

No, it is not. This command only disables the specific desktop manager. It doesn't actually disable the GUI, and the system will still boot and startup most GUI services and processes - therefore it will still use more resources. I've shown you the proper way on a systemd-based distro.

If there is a way to revert this, should I ever need it

Just enable it. A warning is a warning, it is there because many problems can occur at random - we cannot predict them. If by chance a problem really occurs when the time to enable it back on comes - just post another question.

And if you use systemd to make the system boot into multi-user.target, you can just revert it by switching back to graphical.target:

systemctl set-default graphical.target
Share:
8,081

Related videos on Youtube

Merion
Author by

Merion

Geoinformation professional and lover of fantastic maps.

Updated on September 18, 2022

Comments

  • Merion
    Merion over 1 year

    I configured a web mapping service on a debian system in VirtualBox and used to GUI to make it easier for me as a linux newbie. But now the system is done and working and shall be moved to a VM on our cloud service for customer use. There the GUI is obviously not needed and will only consume unnecessary resources.

    I tried to find out, which config file to edit or which command to issue to make Debian start headless. But my search results are surprisingly bare - I either find instructions for headless installtion or for way more specific cases than mine.

    What I found was this:

    systemctl disable lightdm
    

    But it came with warnings, that I might not be able to re-enable it, if needed.

    So I came here to ask more experienced users if
    a) this is the right command for what I want and
    b) if there is a way to revert this, should I ever need it

    Any help for a linux starter would be very appreciated!

  • Merion
    Merion almost 5 years
    Wow, thank you! Exactly what I was looking for and I even learned more about systemd, very cool! I think I will also look up the term headless, see why I thought this to be the correct term.
  • Merion
    Merion almost 5 years
    Update Appearently the term headless is used for hardware, so basically the server system itself, not the software on it: en.wikipedia.org/wiki/Headless_computer
  • MadPhysicist
    MadPhysicist about 2 years
    If I have a debian installed, will going this way be the same as installing a headless Debian? What is the way to make a regular installation headless without reinstalling?
  • Fanatique
    Fanatique about 2 years
    @MadPhysicist it will work as one, with the difference of having installed graphical drivers, window managers, desktop managers, etc. You will be able to switch between headless and graphical Debian with ease. But if you want to strictly go to headless, you would need to remove the packages as well. sudo apt purge libx11-6 libwayland-client0 should be enough for that. See unix.stackexchange.com/questions/424969/…