You are not logged in.
Pages: 1
Thanks for reading this post.
How can I see what happens on tty2 by systemdefaults?
I tried
journalctl -b | grep tty2 | more to see what's happening.
Also, it's not possible to "scroll" in the tty2 with SHIFT + PageUp, is there a way?
I have some messages printed to tty before last login.
Why I mention last login prompt, it's just as a reference, like so:
- tty2 initialisation with ctrl + alt + f2
- Arch Linux 6.0.7-arch-1 (tty2) What's the official name for that?
- login prompt
-in case of successfull login
- something from somewhere ? Where would this be defined?
- last login message
- motd
Something is printed between /etc/passwd and /etc/motd, that's all I understand.
The login program begins a session for the user by setting environment variables and starting the user's shell, based on /etc/passwd. The login program displays the contents of /etc/motd (message of the day) after a successful login, just before it executes the login shell. It is a good place to display your Terms of Service to remind users of your local policies or anything you wish to tell them.
https://wiki.archlinux.org/title/Arch_b … cess#Login
Thank you for reading, don't just have a good day, have a great day.
Last edited by Gill Bates (2022-11-21 17:32:11)
Offline
Maybe start here
Thanks for your reply. Main question is still how can I debug tty2 behaviour? with journalctl ?
I read that archwiki article many times, thanks to it autologin on tty2 is set-up.
Due to a lack of knowledge and maybe it's either not in the wiki or I'm not seeing it, I can't see where those messages printed between
getty@tty2.service.d/skip-username.conf and
Last Login: Sun 16.11.2022 are comming from.
I have autologin configured, working like here https://wiki.archlinux.org/title/Getty#Virtual_console
[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --skip-login --nonewline --noissue --autologin root --noclear %I $TERMThe issue however is something is printed between successful, automatic login and then motd.
I tried to draw it with this, in bold is the issue:
- tty2 initialisation with ctrl + alt + f2
- printed: Arch Linux 6.0.7-arch-1 (tty2)
- printed: login prompt
[autologin]
- printed: something from somewhere (it's a a figlet and a toilet command that I put in some file, but can't remember or figure which of the systemfiles i put it)
- printed: Last login: Sun 16.11.2022
- printed: motd
https://wiki.archlinux.org/title/Arch_b … cess#Login
The login program begins a session for the user by setting environment variables and starting the user's shell, based on /etc/passwd. The login program displays the contents of /etc/motd (message of the day) after a successful login, just before it executes the login shell.
The only issue is, figlet, toilet are displayed before after login but before Last Login Prompt and motd...
This is my /etc/systemd/logind.conf (Just spawning 10 VT's)
# 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.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file, or by creating "drop-ins" in
# the logind.conf.d/ subdirectory. The latter is generally recommended.
# Defaults can be restored by simply deleting this file and all drop-ins.
#
# Use 'systemd-analyze cat-config systemd/logind.conf' to display the full config.
#
# See logind.conf(5) for details.
[Login]
NAutoVTs=10
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#UserStopDelaySec=10
#HandlePowerKey=poweroff
#HandlePowerKeyLongPress=ignore
#HandleRebootKey=reboot
#HandleRebootKeyLongPress=poweroff
#HandleSuspendKey=suspend
#HandleSuspendKeyLongPress=hibernate
#HandleHibernateKey=hibernate
#HandleHibernateKeyLongPress=ignore
#HandleLidSwitch=suspend
#HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#RebootKeyIgnoreInhibited=no
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RuntimeDirectoryInodesMax=
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192Last edited by Gill Bates (2022-11-20 19:02:10)
Offline
What do you mean by "figlet" and "toilet"? What exactly is printed? If you know what the content is, and you believe you added it to a file at some point, then just grep for a relevant part of that content, e.g.:
grep -rl "<content>" /etc/* ~/.config/*
grep -l "<content>" ~/.*"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Also, it's not possible to "scroll" in the tty2 with SHIFT + PageUp, is there a way?
Not on current kernels, no. Apparently the facility was removed.
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
What do you mean by "figlet" and "toilet"?
Probably something like this?
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
[...]messages printed between
getty@tty2.service.d/skip-username.confand
Last Login: Sun 16.11.2022are comming from.
To see what's happening between/after 'tty2.service' initiation and login, try
systemctl status getty@tty2.service
loginctl session-statusIf more questions arise, please post the output of those commands.
Last edited by dogknowsnx (2022-11-20 21:37:08)
Thanks to dogknowsns those are the debug commands I needed, many thanks, thanks to cfr for, those are the figlet, toilet commands indeed, thanks to Trilby, indeed I have to get better with grep but thought it's maybe obvious to some OG's what else happens before the Last Login Prompt.
systemctl status getty@tty2.service | curl -F 'f:1=<-' ix.io
● getty@tty2.service - Getty on tty2
Loaded: loaded (/usr/lib/systemd/system/getty@.service; disabled; preset: enabled)
Drop-In: /etc/systemd/system/getty@tty2.service.d
└─skip-username.conf
Active: active (running) since Mon 2022-11-21 10:59:21 EET; 45s ago
Docs: man:agetty(8)
man:systemd-getty-generator(8)
http://0pointer.de/blog/projects/serial-console.html
Main PID: 11795 (login)
Tasks: 0 (limit: 9339)
Memory: 796.0K
CPU: 15ms
CGroup: /system.slice/system-getty.slice/getty@tty2.service
‣ 11795 "login -- root"
Nov 21 10:59:21 PC systemd[1]: Started Getty on tty2.
Nov 21 10:59:21 PC login[11795]: pam_unix(login:session): session opened for user root(uid=0) by (uid=0)
Nov 21 10:59:21 PC login[11795]: pam_env(login:session): deprecated reading of user environment enabled
Nov 21 10:59:21 PC login[11795]: /etc/login.defs: TTYGROUP contains invalid numerical value: tty
Nov 21 10:59:21 PC login[11795]: ROOT LOGIN ON tty2loginctl session-status | curl -F "f:1=<-" ix.io
20 - root (0)
Since: Mon 2022-11-21 11:09:05 EET; 5s ago
Leader: 12340 (login)
Seat: seat0; vc2
TTY: tty2
Service: login; type tty; class user
State: active
Unit: session-20.scope
├─12340 "login -- root"
├─12343 -bash
├─12346 loginctl session-status
└─12347 curl -F "f:1=<-" ix.io
Nov 21 11:09:05 PC systemd[1]: Started Session 20 of User root.I can only see nothing, still wondering where I put those commands
figlet Welcome | lolcat .
@Trilby, so I could search the entire system with
grep -w "figlet Welcome", is that the smart approach?
Again thanks to dogknowsns & cfr, thanks to sharing your knowledge I can now utilize
systemctl status getty@tty2.service | curl -F 'f:1=<-' ix.io
loginctl session-status | curl -F 'f:1=<-' ix.io Last edited by Gill Bates (2022-11-21 09:24:56)
Offline
What do you mean by "figlet" and "toilet"? What exactly is printed? If you know what the content is, and you believe you added it to a file at some point, then just grep for a relevant part of that content, e.g.:
grep -rl "<content>" /etc/* ~/.config/* grep -l "<content>" ~/.*
grep -w -rl "figlet Welcome" /* /bin/scripts/motd.sh Found it, now the only question remains why the execution of motd.sh is not visible in the commands shared by dogknowsnx.
However thanks to your posts I learned new things, thanks a bunch.
Offline
You probably put your 'figlet' command in your shell's rc file
cat ~/.bashrc
#or, e.g.#
grep figlet ~/.bashrcEDIT: nevermind. See 'man motd' (your file's location is peculiar - be careful when/(try to) avoid using 3rd party sites and their "recommendations")
EDIT2: I hope you created an unprivileged user account, as well (and use it)
Last edited by dogknowsnx (2022-11-21 09:56:51)
Thanks, the question still remains why as the first thing after login, before last login prompt and motd, this
/bin/scripts/motd.sh is executed. See output above of, it's not visible there.
systemctl status getty@tty2.service
loginctl session-status Last edited by Gill Bates (2022-11-21 10:23:26)
Offline
What do
cat /bin/scripts/motd.sh
cat /etc/motdprint?
https://man.archlinux.org/man/motd.5.en
Last edited by dogknowsnx (2022-11-21 12:02:03)
cat /bin/scripts/motd.sh nothing to cat| lolcat cat /etc/motd nothing to catThis is the content of
cat /bin/scripts/motd.sh #!/usr/bin/zsh
#printf '\r'
echo "You see this is executed at first"
printf '%b' '\e]P0110415
\e]P1ED60A9
\e]P2F164F8
\e]P309B2FC
\e]P46697CC
\e]P5EA9DA6
\e]P6ECABCE
\e]P7cee3ea
\e]P8909ea3
\e]P9ED60A9
\e]PAF164F8
\e]PB09B2FC
\e]PC6697CC
\e]PDEA9DA6
\e]PEECABCE
\e]PFcee3ea
\ec'
printf "\x1b[92m\x1b[104m 'c. \x1b[0m\n";
printf "\x1b[92m\x1b[104m ,xNMM. \x1b[0m\n";
printf "\x1b[92m\x1b[104m .OMMMMo \x1b[0m\n";
printf "\x1b[92m\x1b[104m OMMM0, \x1b[0m\n";
printf "\x1b[92m\x1b[104m .;loddo:' loolloddol;. \x1b[0m\n";
printf "\x1b[92m\x1b[104m cKMMMMMMMMMMNWMMMMMMMMMM0: \x1b[0m\n";
printf "\x1b[93m\x1b[105m .KMMMMMMMMMMMMMMMMMMMMMMMWd. \x1b[0m\n";
printf "\x1b[93m\x1b[105m XMMMMMMMMMMMMMMMMMMMMMMMX. \x1b[0m\n";
printf "\x1b[33m\x1b[101m ;MMMMMMMMMMMMMMMMMMMMMMMM: \x1b[0m\n";
printf "\x1b[33m\x1b[101m :MMMMMMMMMMMMMMMMMMMMMMMM: \x1b[0m\n";
printf "\x1b[91m\x1b[103m .MMMMMMMMMMMMMMMMMMMMMMMMX. \x1b[0m\n";
printf "\x1b[91m\x1b[103m kMMMMMMMMMMMMMMMMMMMMMMMMWd. \x1b[0m\n";
printf "\x1b[35m\x1b[103m .XMMMMMMMMMMMMMMMMMMMMMMMMMMk \x1b[0m\n";
printf "\x1b[35m\x1b[103m .XMMMMMMMMMMMMMMMMMMMMMMMMK. \x1b[0m\n";
printf "\x1b[94m\x1b[102m kMMMMMMMMMMMMMMMMMMMMMMMd \x1b[0m\n";
printf "\x1b[94m\x1b[102m ;KMMMMMMMWXXWMMMMMMMMk. \x1b[0m\n";
printf "\x1b[94m\x1b[102m .cooc,. .,coo:. \x1b[0m\n";
echo "Even before Last Login Prompt"
All together with drop-in-file in /etc/systemd/system/getty@tty2.service.d/skip-username.conf =
Last edited by Gill Bates (2022-11-21 12:34:19)
Offline
EDIT:
grep -i motd /etc/login.defs
printenv | grep -i motd?
Last edited by dogknowsnx (2022-11-21 12:37:43)
printenv | grep -i motd
MOTD_SHOWN=pam cat /etc/login.defs | curl -F 'f:1=<-' ix.io
#
# /etc/login.defs - Configuration control definitions for the shadow package.
#
# $Id$
#
# NOTE: This file is adapted for the use on Arch Linux!
# Unsupported options due to the use of util-linux or PAM are removed.
#
# Delay in seconds before being allowed another attempt after a login failure
# Note: When PAM is used, some modules may enforce a minimum delay (e.g.
# pam_unix(8) enforces a 2s delay)
#
FAIL_DELAY 3
#
# Enable display of unknown usernames when login(1) failures are recorded.
#
LOG_UNKFAIL_ENAB no
#
# Limit the highest user ID number for which the lastlog entries should
# be updated.
#
# No LASTLOG_UID_MAX means that there is no user ID limit for writing
# lastlog entries.
#
#LASTLOG_UID_MAX
#
# If defined, ":" delimited list of "message of the day" files to
# be displayed upon login.
#
MOTD_FILE
#MOTD_FILE /etc/motd:/usr/lib/news/news-motd
#
# *REQUIRED*
# Directory where mailboxes reside, _or_ name of file, relative to the
# home directory. If you _do_ define both, MAIL_DIR takes precedence.
#
MAIL_DIR /var/spool/mail
#MAIL_FILE .mail
#
# If defined, file which inhibits all the usual chatter during the login
# sequence. If a full pathname, then hushed mode will be enabled if the
# user's name or shell are found in the file. If not a full pathname, then
# hushed mode will be enabled if the file exists in the user's home directory.
#
HUSHLOGIN_FILE .hushlogin
#HUSHLOGIN_FILE /etc/hushlogins
#
# *REQUIRED* The default PATH settings, for superuser and normal users.
#
# (they are minimal, add the rest in the shell startup files)
ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/bin
ENV_PATH PATH=/usr/local/sbin:/usr/local/bin:/usr/bin
#
# Terminal permissions
#
# TTYGROUP Login tty will be assigned this group ownership.
# TTYPERM Login tty will be set to this permission.
#
# If you have a write(1) program which is "setgid" to a special group
# which owns the terminals, define TTYGROUP as the number of such group
# and TTYPERM as 0620. Otherwise leave TTYGROUP commented out and
# set TTYPERM to either 622 or 600.
#
TTYGROUP tty
TTYPERM 0600
# Default initial "umask" value used by login(1) on non-PAM enabled systems.
# Default "umask" value for pam_umask(8) on PAM enabled systems.
# UMASK is also used by useradd(8) and newusers(8) to set the mode for new
# home directories if HOME_MODE is not set.
# 022 is the default value, but 027, or even 077, could be considered
# for increased privacy. There is no One True Answer here: each sysadmin
# must make up their mind.
UMASK 077
# HOME_MODE is used by useradd(8) and newusers(8) to set the mode for new
# home directories.
# If HOME_MODE is not set, the value of UMASK is used to create the mode.
#HOME_MODE 0700
#
# Password aging controls:
#
# PASS_MAX_DAYS Maximum number of days a password may be used.
# PASS_MIN_DAYS Minimum number of days allowed between password changes.
# PASS_WARN_AGE Number of days warning given before a password expires.
#
PASS_MAX_DAYS 99999
PASS_MIN_DAYS 0
PASS_WARN_AGE 7
#
# Min/max values for automatic uid selection in useradd(8)
#
UID_MIN 1000
UID_MAX 60000
# System accounts
SYS_UID_MIN 500
SYS_UID_MAX 999
# Extra per user uids
SUB_UID_MIN 100000
SUB_UID_MAX 600100000
SUB_UID_COUNT 65536
#
# Min/max values for automatic gid selection in groupadd(8)
#
GID_MIN 1000
GID_MAX 60000
# System accounts
SYS_GID_MIN 500
SYS_GID_MAX 999
# Extra per user group ids
SUB_GID_MIN 100000
SUB_GID_MAX 600100000
SUB_GID_COUNT 65536
#
# Max number of login(1) retries if password is bad
#
LOGIN_RETRIES 5
#
# Max time in seconds for login(1)
#
LOGIN_TIMEOUT 60
#
# Which fields may be changed by regular users using chfn(1) - use
# any combination of letters "frwh" (full name, room number, work
# phone, home phone). If not defined, no changes are allowed.
# For backward compatibility, "yes" = "rwh" and "no" = "frwh".
#
CHFN_RESTRICT rwh
#
# Only works if compiled with ENCRYPTMETHOD_SELECT defined:
# If set to SHA256, SHA256-based algorithm will be used for encrypting password
# If set to SHA512, SHA512-based algorithm will be used for encrypting password
# If set to BCRYPT, BCRYPT-based algorithm will be used for encrypting password
# If set to YESCRYPT, YESCRYPT-based algorithm will be used for encrypting password
# If set to DES, DES-based algorithm will be used for encrypting password (default)
# MD5 and DES should not be used for new hashes, see crypt(5) for recommendations.
#
# Note: If you use PAM, it is recommended to use a value consistent with
# the PAM modules configuration.
#
ENCRYPT_METHOD SHA512
#
# Only works if ENCRYPT_METHOD is set to SHA256 or SHA512.
#
# Define the number of SHA rounds.
# With a lot of rounds, it is more difficult to brute-force the password.
# However, more CPU resources will be needed to authenticate users if
# this value is increased.
#
# If not specified, the libc will choose the default number of rounds (5000),
# which is orders of magnitude too low for modern hardware.
# The values must be within the 1000-999999999 range.
# If only one of the MIN or MAX values is set, then this value will be used.
# If MIN > MAX, the highest value will be used.
#
#SHA_CRYPT_MIN_ROUNDS 5000
#SHA_CRYPT_MAX_ROUNDS 5000
#
# Only works if ENCRYPT_METHOD is set to BCRYPT.
#
# Define the number of BCRYPT rounds.
# With a lot of rounds, it is more difficult to brute-force the password.
# However, more CPU resources will be needed to authenticate users if
# this value is increased.
#
# If not specified, 13 rounds will be attempted.
# If only one of the MIN or MAX values is set, then this value will be used.
# If MIN > MAX, the highest value will be used.
#
#BCRYPT_MIN_ROUNDS 13
#BCRYPT_MAX_ROUNDS 13
#
# Only works if ENCRYPT_METHOD is set to YESCRYPT.
#
# Define the YESCRYPT cost factor.
# With a higher cost factor, it is more difficult to brute-force the password.
# However, more CPU time and more memory will be needed to authenticate users
# if this value is increased.
#
# If not specified, a cost factor of 5 will be used.
# The value must be within the 1-11 range.
#
#YESCRYPT_COST_FACTOR 5
#
# Should login be allowed if we can't cd to the home directory?
# Default is no.
#
DEFAULT_HOME yes
#
# The pwck(8) utility emits a warning for any system account with a home
# directory that does not exist. Some system accounts intentionally do
# not have a home directory. Such accounts may have this string as
# their home directory in /etc/passwd to avoid a spurious warning.
#
NONEXISTENT /nonexistent
#
# If defined, this command is run when removing a user.
# It should remove any at/cron/print jobs etc. owned by
# the user to be removed (passed as the first argument).
#
#USERDEL_CMD /usr/sbin/userdel_local
#
# Enable setting of the umask group bits to be the same as owner bits
# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is
# the same as gid, and username is the same as the primary group name.
#
# This also enables userdel(8) to remove user groups if no members exist.
#
USERGROUPS_ENAB yes
#
# If set to a non-zero number, the shadow utilities will make sure that
# groups never have more than this number of users on one line.
# This permits to support split groups (groups split into multiple lines,
# with the same group ID, to avoid limitation of the line length in the
# group file).
#
# 0 is the default value and disables this feature.
#
#MAX_MEMBERS_PER_GROUP 0
#
# If useradd(8) should create home directories for users by default (non
# system users only).
# This option is overridden with the -M or -m flags on the useradd(8)
# command-line.
#
#CREATE_HOME yes
#
# Force use shadow, even if shadow passwd & shadow group files are
# missing.
#
#FORCE_SHADOW yes
#
# Allow newuidmap and newgidmap when running under an alternative
# primary group.
#
#GRANT_AUX_GROUP_SUBIDS yes
#
# Select the HMAC cryptography algorithm.
# Used in pam_timestamp module to calculate the keyed-hash message
# authentication code.
#
# Note: It is recommended to check hmac(3) to see the possible algorithms
# that are available in your system.
#
#HMAC_CRYPTO_ALGO SHA512Offline
Please refer to
man pam_motdfor other locations to check...
something from somewhere ? Where would this be defined?
Are you looking for a way to print something at this stage or do you get a message you don't understand and want to know the source of the message?
In the latter case: what exactly *is* "something"? The actual text?
Offline
I believe linux has a utility like
systemctl status getty@tty2.service like a list of what's going on in tty2 that you then can save in a file and grep from. Then the reason for the following question would be tracked down with ease:
Why is
/bin/scripts/motd.sh executed even before last login prompt?
All previous questions have been resolved, thanks to you awesome guys.
Last edited by Gill Bates (2022-11-21 13:09:21)
Offline
This is all done by /usr/bin/login
https://man.archlinux.org/man/core/util … login.1.en
touch ~/.hushloginwill prevent printing the last login, if that's what you're looking for.
Offline
No need to "believe" anything here - take a couple of breaths and please do some more reading on basic stuff so as not to stumble and fall over all the bling...
https://wiki.archlinux.org/title/Init
https://wiki.archlinux.org/title/Systemd
https://wiki.archlinux.org/title/Command-line_shell
plus most if not all links posted throughout this topic (including those you posted yourself)
Regarding your "Message of the day" issue I'd suggest checking your shell's history for files you created/edited...
EDIT: To second what @seth posted above, again please refer to 'man motd' as I've already mentioned in a previous post (mind the "SEE ALSO" links in the manpages)...
Last edited by dogknowsnx (2022-11-21 14:07:39)
I appreciate that you reply to my obv stupid posts. While in most cases more reading would be the best advice, I do nothing but read, read, test and more testing before I come here and post.
Sorry for being another dummy asking dumb questions.
In that case, the
/etc/pam.d/system-login is where /etc/scripts/motd.sh is listed, also the standard place where /etc/motd is called form.
According to https://github.com/lfelipe1501/Arch-MOT … tion-Guide
Which seems like a good source for dynamic motd.
If you look at the archwiki https://wiki.archlinux.org/title/Arch_b … cess#Login
IMO, for completion there should be a hyperlink that the login is using
/etc/pam.d/system-login.
See here, https://github.com/lfelipe1501/Arch-MOT … pamd-files
Thanks for all your kind and in-depth replies, I learned a ton, back to reading more Archwiki.
Last edited by Gill Bates (2022-11-21 17:48:40)
Offline
Apart from neither having thought nor implied any of the dum* attributes you mentioned, I agree that the wiki could be improved upon regarding 'motd' usage in Arch Linux, though modifications to '/etc/pam.d/login' as mentioned in 'man pam_motd' *should* work as well.
BTW, everyone can sign up and edit the wiki following these guidelines
Enjoy your reads!
Pages: 1