[SOLVED] Boot Raspberry Pi 2 Image directly to Terminal Console

Hi There!,

I have attempted to get the Raspberry Pi Image to boot directly to a Terminal Console with no luck.

I have done “systemctl disable graphical” and it didnt work, same with lightdm. I have also tried to use update-rc.d lightdm remove.

I would like to use the desktop environment only if i need to use it. Any ideas?

Normally I would edit /etc/default/grub and then update-grub, but the pi doesn’t use grub. Is there anything else I could try?

For those that care:

systemctl set-default multi-user.target --force
systemctl disable lightdm.service --force
systemctl disable graphical.target --force
systemctl disable plymouth.service --force
1 Like

This worked great, thanks.
In an effort to make it easier to enable/disable the GUI on boot, I put it into a little Bash script, available as a Gist here.

bootgui

#!/bin/bash
# Call with either enable or disable as first parameter
if [[ "$1" == 'enable' || "$1" == 'disable' ]]; then
  sudo systemctl set-default multi-user.target --force
  sudo systemctl $1 lightdm.service --force
  sudo systemctl $1 graphical.target --force
  sudo systemctl $1 plymouth.service --force
else
  echo Call with either "enable" or "disable" as first parameter.
fi

Afterwards execute chmod +x bootgui to make the script executable.
Call with ./bootgui disable or ./bootgui enable

1 Like

Thanks for sharing @AceFace and @cloudbites :smiley:

The proposed solution doesn’t work on Ubuntu MATE 16.04 and the “Welcome” application mentions a non-existent “graphical” command. The following worked for me, just in case someone met the same issue :

#!/bin/bash

if [[ "$1" == 'enable' || "$1" == 'disable' ]]; then
    if [ "$1" == 'disable' ]; then
        systemctl set-default multi-user.target --force
    fi

    systemctl $1 lightdm.service --force
    systemctl $1 graphical.target --force
    systemctl $1 plymouth.service --force
    
    if [ "$1" == 'enable' ]; then
        if [ ! -h /etc/systemd/system/display-manager.service ]; then
            ln -s /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service
        fi

        systemctl set-default graphical.target --force
    fi
else
    echo 'Enables or disables GUI at boot.'
    echo "Usage : $(basename) {enable | disable}"
fi