16.04 Boot to Command Line and Autologin

I am using an Odroid C2 Board and I would like to boot to the command line and then automatically login.

I have used the following script to disable the GUI and boot to command line:

#!/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

However, I cannot enable the GUI now it is disabled.

To auto-login I added an argument in /etc/init/tty1.conf, which was --autologin odroid but that didn’t work.

I’d be really grateful for any suggestions.

I think you need to drop the "odroid" part of the command and replace it with username?.

Can you boot into recovery mode and drop to root then edit the file from there?. :confused:

Hi james

I have not tried using systemctl this way, with systemd in play there are new options.

Does an Odroid device use the standard grub boot?

In the past I have disabled the desktop by editing grub to include the “text” option.

http://ubuntuhandbook.org/index.php/2014/01/boot-into-text-console-ubuntu-linux-14-04/

And I would add auto-boot by creating an ~/.xinitrc.

https://wiki.archlinux.org/index.php/xinitrc

Like I said, with systemd there are new options.

1 Like