Hi all
I have a hp thinclient t620 with OS15.4 installed. It runs nicely and does what it is supposed to do: after logging in, it automatically starts mocp, starts playing the first file from a playlist. I’d like to be able to start the t620 through wol and do the same with autologin in text mode.
mkdir -p /etc/systemd/system/getty@tty3.service.d
{create a file with the service contents}
vi /etc/systemd/system/getty@tty3.service.d/autologin.conf
[Service]
ExecStart=
ExecStart=-/sbin/agetty -o '-p -f -- \\u' --noclear --autologin <username> %I $TERM
I tested this on ALP, so used tty3, then switched with ctl+alt+F3 and I’m logged in.
I do not know how to do this, but looking into /etc/inittab is a dead alley. It is not used anymore, regardless if you create it or not. Better look into systemd.
First, based on Henks comment, I undid all my above stated changes
I created the file “/etc/systemd/system/getty@tty3.service.d/autologin.conf” as mentioned, replacing <username> with the user’s name.
then I did:
systemctl enable getty@tty3
Created symlink /etc/systemd/system/getty.target.wants/getty@tty3.service → /usr/lib/systemd/system/getty@.service.
systemctl start getty@tty3
systemctl status getty@tty3
getty@tty3.service - Getty on tty3
Loaded: loaded (/usr/lib/systemd/system/getty@.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2022-10-10 18:17:14 CEST; 42s ago
Docs: man:agetty(8)
man:systemd-getty-generator(8)
http://0pointer.de/blog/projects/serial-console.html
Main PID: 1535 (agetty)
Tasks: 1 (limit: 4915)systemctl enable getty@tty3
CGroup: /system.slice/system-getty.slice/getty@tty3.service
└─ 1633 /sbin/agetty -o "-p -- \\u" --noclear tty3 linux
reboot
No joy. Must still be missing something. What puzzles me is, that “1633 /sbin/agetty -o “-p – \u” --noclear tty3 linux” does not state the username and “–autologin” is also omitted.
Looking at, I fould the options :
**-a, **–autologin **username
-o, --login-options ‘-h darkstar – \u’**So, I ask myself, is “-o ‘-p -f – \u’ --noclear --autologin <username>” correct? Shouldn’t it be
“-o ‘-p -f <username> \u’ --noclear”?
Hi
No enabling needed (roll that change back), just add and boot, then switch to the tty3, like I indicated I’m on ALP with my test system, which worked. Try tty1 or tty2 (rename the directory).
[FONT=monospace]journalctl -b | grep -Ei "agetty|tty|login|<username>"
Okt 10 19:42:06 T620B kernel: printk: console **tty**0] enabled
Okt 10 19:42:13 T620B systemd[1]: Created slice Slice /system/ge**tty**.
Okt 10 19:42:15 T620B systemd[1]: Starting Generate issue file for **login** session...
Okt 10 19:42:16 T620B systemd[1]: Starting User **Login** Management...
Okt 10 19:42:16 T620B systemd[1]: Finished Generate issue file for **login** session.
Okt 10 19:42:16 T620B systemd-**login**d[925]: New seat seat0.
Okt 10 19:42:16 T620B systemd-**login**d[925]: Watching system buttons on /dev/input/event8 (Power Button)
Okt 10 19:42:16 T620B systemd-**login**d[925]: Watching system buttons on /dev/input/event7 (Power Button)
Okt 10 19:42:16 T620B systemd[1]: Started User **Login** Management.
Okt 10 19:42:17 T620B systemd-**login**d[925]: Watching system buttons on /dev/input/event0 (ASIX Electronics AX68004)
Okt 10 19:42:17 T620B systemd-**login**d[925]: Watching system buttons on /dev/input/event2 (ASIX Electronics AX68004 System Control)
Okt 10 19:42:17 T620B systemd-**login**d[925]: Watching system buttons on /dev/input/event3 (ASIX Electronics AX68004 Consumer Control)
Okt 10 19:42:18 T620B systemd-**login**d[925]: Watching system buttons on /dev/input/event5 (Logitech MX Master)
Okt 10 19:42:18 T620B systemd-**login**d[925]: Watching system buttons on /dev/input/event6 (Logitech K800)
Okt 10 19:42:26 T620B systemd[1]: Starting **Login** and scanning of iSCSI devices...
Okt 10 19:42:26 T620B systemd[1]: Finished **Login** and scanning of iSCSI devices.
Okt 10 19:42:28 T620B systemd[1]: Started Ge**tty** on **tty**1.
Okt 10 19:42:28 T620B systemd[1]: Reached target **Login** Prompts.
Okt 10 19:44:23 T620B systemd-**login**d[925]: New session 1 of user root.
[/FONT]
The file is *huge", thus I grepped for what I thought was relevant. I waded through the whole file, too. But imho, there is nothing showing that “getty@tty3” gets called.
I put an echo command into “/etc/systemd/system/getty@tty3.service.d/autologin.conf”:
cat autologin.conf
[Service]
#ExecStart=
ExecStart=-/sbin/agetty -o '-p -f -- \\u' --noclear --autologin stim %I $TERM
echo "getty@tty3 $date was run" >> /tmp/gettytty3.log
reboot
[FONT=monospace]LANG=C ls /tmp/gett*
ls: cannot access '/tmp/gett*': No such file or directory
[FONT=monospace]systemctl status getty@tty3
**●** getty@tty3.service - Getty on tty3
Loaded: loaded (/usr/lib/systemd/system/getty@.service; disabled; vendor preset: enabled)
Active: **active (running)** since Mon 2022-10-10 20:03:30 CEST; 4min 15s ago
Docs: man:agetty(8)
man:systemd-getty-generator(8)
http://0pointer.de/blog/projects/serial-console.html
Main PID: 1554 (agetty)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/system-getty.slice/getty@tty3.service
└─ 1554 /sbin/agetty -o "-p -- \\u" --noclear tty3 linux
[/FONT][/FONT]
replace <yourusername> with the username of the user you want to autologin
cat /etc/systemd/system/getty@tty1.service
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Getty on %I
Documentation=man:agetty(8) man:systemd-getty-generator(8)
Documentation=http://0pointer.de/blog/projects/serial-console.html
After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
After=rc-local.service
# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though
# getty.target didn't actually pull it in.
Before=getty.target
IgnoreOnIsolate=yes
# IgnoreOnIsolate causes issues with sulogin, if someone isolates
# rescue.target or starts rescue.service from multi-user.target or
# graphical.target.
Conflicts=rescue.service
Before=rescue.service
# On systems without virtual consoles, don't start any getty. Note
# that serial gettys are covered by serial-getty@.service, not this
# unit.
ConditionPathExists=/dev/tty0
[Service]
# the VT is cleared by TTYVTDisallocate
# The '-o' option value tells agetty to replace 'login' arguments with an
# option to preserve environment (-p), followed by '--' for safety, and then
# the entered username.
ExecStart=-/sbin/agetty -o '-p -f -- \\u' --noclear --autologin ***<yourusername>*** %I $TERM
Type=idle
Restart=always
RestartSec=0
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
IgnoreSIGPIPE=no
SendSIGHUP=yes
# Unset locale for the console getty since the console has problems
# displaying some internationalized messages.
UnsetEnvironment=LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION
[Install]
WantedBy=getty.target
DefaultInstance=tty1