LS1012A Cannot login automatically as root

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LS1012A Cannot login automatically as root

1,554 Views
lyh20218
Contributor I

Hi!

     I want to login automatically as root after the system boot and no password required! I've tried modify “/lib/systemd/system/getty@.service” content as follows:

annotate "#ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear %I $TERM"

and add "ExecStart=-/sbin/agetty --autologin root --noclear %I $TERM" or "ExecStart=-/sbin/agetty -a root --noclear %I $TERM",but it didn't work!

    Second:modify "/etc/passwd",change "root:x:0:0:root:/root:/bin/bash" to "root::0:0:root:/root:/bin/bash".

    Now I don't need to enter a password,but still need to enter a user name "root".

    Why doesn't it work?

Startup information:

..........

[ OK ] Started Permit User Sessions.
[ OK ] Started vsftpd FTP server.
[ OK ] Started Serial Getty on ttyS0.
Starting Set console scheme...
[ OK ] Started Ubuntu FAN network setup.
[ OK ] Started Set console scheme.
[ OK ] Created slice system-getty.slice.
[ OK ] Started Getty on tty1.
[ OK ] Reached target Login Prompts.
[ OK ] Started LSB: HPA's tftp server.
[ OK ] Started OpenBSD Secure Shell server.
[ OK ] Started LSB: network benchmark.
[ OK ] Started Lighttpd Daemon.
[ OK ] Started LXC network bridge setup.
Starting LXC Container Initialization and Autoboot Code...
[ OK ] Started LXC Container Initialization and Autoboot Code.
[ OK ] Started Samba NMB Daemon.
Starting Samba SMB Daemon...
[ OK ] Started Virtualization daemon.

Ubuntu 18.04.1 LTS localhost ttyS0

localhost login: root
Last login: Sun Jan 28 15:58:27 UTC 2018 on tty1
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.14.47 aarch64)

* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage

root@localhost:~#

Labels (1)
0 Kudos
4 Replies

1,396 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello li yh,

Please edit /etc/init/tty1.conf and replace the exec /sbin/getty ... line with:

exec /sbin/getty -n -l /bin/sh -8 38400 tty1

Thanks,

Yiping

0 Kudos

1,396 Views
lyh20218
Contributor I

Hi!

Thank you for your reply!

But the file "tty1.conf" does not exist in the path "/etc/init/",

Is there any other way to solve this problem?

00.jpg

0 Kudos

1,396 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please edit the file /lib/systemd/system/getty@.service and change the line

ExecStart=-/sbin/agetty --noclear %I $TERM

to

ExecStart=-/sbin/getty/ --noclear -a root %I $TERM

1,396 Views
lyh20218
Contributor I

Hi!

Thank you for your reply!

Now I've found a way to solve this problem:

edit the file /lib/systemd/system/serial-getty@.service and change the line

ExecStart=-/sbin/agetty -o '-p -- \\u' --keep-baud 115200,38400,9600 %I $TERM

to

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

Thanks for your help!

0 Kudos