3

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 – steeldriver Jul 21 '16 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 '16 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 '16 at 16:39
3

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:

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

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 '16 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 '16 at 18:36

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.