5

I've uninstall the GUI, and I also want to disable automatic login at the command line. I've read that you should use the raspi-config utility to do this. I select the first option and reboot, and it has no effect.

How does one "do this manually"?

3 Answers 3

8

Autologin is performed as part of systemd's getty target:

root@raspberrypi:/etc/systemd/system/getty.target.wants# ls -l
total 0
lrwxrwxrwx 1 root root 38 Sep 24 18:14 [email protected] -> /etc/systemd/system/[email protected]

The raspi-config simply manipulates this symlink. To switch to manual login, execute (as root):

ln -fs /lib/systemd/system/[email protected] \
 /etc/systemd/system/getty.target.wants/[email protected]

To switch back to automatic login, do:

ln -fs /etc/systemd/system/[email protected] \
 /etc/systemd/system/getty.target.wants/[email protected]

I wanted a system with no console prompt on tty1, so I removed this symlink altogether.

1
  • 3
    If you have removed the default user "pi", you must also update "/etc/systemd/system/[email protected]". Update the username in the line ExecStart=-/sbin/agetty --autologin USERNAME --noclear %I $TERM.
    – skibulk
    Feb 1, 2016 at 13:59
2

I solved this by looking at exactly what raspi-config does.

sudo systemctl set-default multi-user.target
sudo ln -fs /lib/systemd/system/[email protected] /etc/systemd/system/getty.target.wants/[email protected]
sudo rm /etc/systemd/system/[email protected]/autologin.conf

This is B1 Console in raspi-config. For other alternatives go to do_boot_behaviour in raspi-config source file. To find source file, use:

which raspi-config
0

The autologin process is controlled by [email protected]. And the config file autologin.conf under the folder /etc/systemd/system/[email protected]/ is a drop-in file. You can just change the file name to autologin.conf.bak then the username and password prompt will show up on the next boot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.