I have a headless computer (TS-7680) with Debian Jessie that I access via Putty command line. The computer does not have any GUI and is only accessed by the command line. It will be put into the field with a program that needs to restart automatically if there is a temporary power outage.

I know how to get the program to run automatically. However, I am having trouble getting past the login. Every time I boot the computer, I am prompted for the root login. I do not have a password on this computer. After the boot-up code, it looks like this:

Debian GNU/Linux 8 ts7680 ttyAMA0

ts7680 login:

At which point, I must type root to get to the command prompt root@ts7680:~#

Does anyone know how to autologin? I have googled all over, but cannot find an answer. I've tried this solution with no luck.

  • 1
    What kind of program is it? it sounds like maybe it is something you should be starting as a daemon process - rather than requiring an unattended interactive root session to be started Jul 21, 2016 at 1:03
  • I suppose you mean that you access via a serial console using Putty. (Putty can also make network connections, and it doesn't matter for the serial port which program you use.)
    – ilkkachu
    Jul 21, 2016 at 14:46
  • @steeldriver You are correct. That is exactly how it should be done and I didn't realize it until your comment. Thank you!
    – Alexa Kirk
    Jul 29, 2016 at 16:39

1 Answer 1


Assuming systemd treats ttyAMA0 as a serial port the same way it would treat ttyS0 on a PC, you need to edit the command started by the serial-getty@ttyAMA0.service.

(You could check if systemctl status serial-getty@ttyAMA0 shows it is active.)

The base version is in /lib/systemd/system/serial-getty@.service and inside it we find the command that starts the getty:

ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM

Create an override file for the service to start the agetty with --autologin root: Create the directory /etc/systemd/system/serial-getty@ttyAMA0.service.d, and a file called override.conf in it with the following content:

ExecStart=-/sbin/agetty --autologin root --keep-baud 115200,38400,9600 %I $TERM

systemctl edit serial-getty@ttyAMA0.service will help with doing this.

Note that the terminal type passed as an argument to agetty needs to match what your serial terminal actually is. This has been the subject of various approaches in systemd over the years. It has variously been hardwired to vt102 and (indirectly) inherited from the kernel/bootstrap loader. The current approach (as of 2020) is rather complex in how it makes its decision.

However, it only eventually picks from the three values linux, vt220, and whatever the kernel/bootstrap loader says for the Linux console. The first is never right for any real terminal, and unlikely to even approximately match a terminal emulator over a serial cable. The second is unlikely to be right, especially when it comes to colour. Neither matches PuTTY, whose correct terminal type is putty (or putty-256color). And the third probably won't be putty, either; unless you've redirected the Linux /dev/console to the serial terminal and PuTTY as well, and properly reconfigured the boot loader with the console terminal type in lockstep.

So for best results you also need to set the TERM environment variable in that override file:


Then reload systemd and we can check that the new configuration is in place:

# systemctl daemon-reload
# systemctl cat serial-getty\@ttyAMA0 | grep Exec

(we should see the new command on the last ExecStart line.)

If you want to only autologin after a key press, add -p or --login-pause to the agetty command line.

The page you linked talks about configuring automatic login on a virtual console: they are configured through getty@.service and the command line used for agetty is a bit different (it seems to be just missing the --keep-baud option). In that case we would use, say /etc/systemd/system/getty@tty1.service.d/override.conf for tty1 instead.

There's an answer in Ask Ubuntu with more details about overriding systemd configuration.

On a system with sysvinit instead of systemd, you need to add/modify the line corresponding to the serial port in /etc/inittab:

T0:23:respawn:/sbin/getty -L ttyAMA0 --autologin root 38400 vt100
  • You lost me at "create an override file to start with --autologin root Where should this file be located and what should it be named? How is this file called? Thank you for your help.
    – Alexa Kirk
    Jul 29, 2016 at 16:43
  • Sorry, I was too brief about the description (and there was a typo). I tried to clean it up now. Even if this might not be the solution you're going to use, I'd suggest you check that it works (i.e. that there isn't some weird problem with your board), since otherwise the answer is not very useful.
    – ilkkachu
    Jul 29, 2016 at 18:36
  • As mentioned at unix.stackexchange.com/a/572658/5132 , the override should really be setting the TERM environment variable as well, because the value that the service will get by default will pretty much always be wrong.
    – JdeBP
    Mar 16, 2020 at 10:26
  • @JdeBP, feel free to edit the post to add that pointer, I don't have time to look into it now
    – ilkkachu
    Mar 16, 2020 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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