Make serial console auto login with different user

Hi,

nvidia is the default account in my serial console terminal after TX2 boots up. I am trying to make serial console auto login with a different user such as root or ubuntu or a user that I have created, but no success.

These 2 changes don’t make a difference:

  1. $echo -e “[Service]\nExecStart=\nExecStart=-/sbin/agetty -a root --noclear %I $TERM” | sudo SYSTEMD_EDITOR=tee systemctl edit getty@tty1
  2. add “-a root” to “ExecStart=-/sbin/agetty --noclear %I $TERM” in file /lib/systemd/system/getty@.service

Also

Executing “logout” at the prompt logs back in nvidia account.
Executing “sudo login root” and trying to delete nvidia account fails.

It looks as if nvidia account is not to be touched.

Thanks,
Tom

Hi Tom,

Have you tried to modify /etc/systemd/system/serial-getty@ttyS0.service.d/autologin.conf ?

Hi Wayne,

Your answer solves my problem.

Thanks,
Tom

Hi Wayne or Tom,

I’m having this same problem. Could you post the change you made to the autologin.conf file that fixed it for you?

I took out the line below, and it still autologins:

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

Thanks!

Matt

Hi newman.ml.1,

The name is “nvidia” not NVidia

Sorry, that’s a manual copy/paste typo. The line we remove is the default line below. The system still auto logs in as user nvidia:

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

Thanks,

Matt

Have you tried substituting the name “nvidia” with the user you wish to use, e.g., “ubuntu”? Also, if you try to log in as any user than make sure manual login works with that user name as well before trying to automate it (e.g., “root” won’t be allowed on Ubuntu without special steps).

Hi linuxdev,

Yes, I can log in as any other user I create, but only after I log out nvidia, who is logged in automatically each time.

I wish to have no user logged in automatically, so my problem is not exactly what is stated in the first help request

Thanks,

Matt

So is it correct that you want serial console to require a password for which ever user is picked?

If so, then you might try the following experiment (I haven’t tried this)…look for:

/etc/systemd/system/serial-getty@ttyS0.service.d/autologin.conf

First, see what happens if you disable the file simply by using gzip on it and rebooting. If that doesn’t do what you want, gunzip the file, and then try editing the existing line with “–autologin nvidia” to remove that part of the line (and just that part).

Yes, I tried removing the file from the directory, and it still auto logs in as nvidia.

Same thing when I take out the “–autologin nvidia” words from the referenced line in autologin.conf:

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

In both cases, I used the GUI shutdown and re-powered with the PWR button.

I did a bit of research and it seems that once things hand off to Linux (U-Boot has its own mechanism) there is a config in “/etc/init/ttyS0.conf”. This looks like one of the old style init files, so it may be easier to edit than a systemd file.

The final line of this file has:

exec /sbin/getty -a ubuntu -L 115200 ttyS0

Try editing that line to remove the “-a ubuntu”.