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
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