How to modify system identification message

Modify system identification message that is printed before the login prompt.

Modify system identification message

Default pre-login message looks like this.

Debian GNU/Linux buster/sid buster tty1

buster login:

It is defined in /etc/issue file.

$ cat /etc/issue
Debian GNU/Linux buster/sid \n \l
                                                                                                                                                                                  

Modify it using available escape codes.

$ cat /etc/issue
\e{red}\S{NAME}\e{reset} \r \n \m \l (\v)                                                                                                                                           
Date: \d \t (\U)                                                                                                                                                                  
IPv4 address: \4{eth0} IPv6 address: \6{eth0}

Send HUP signal to agetty processes.

$ sudo pkill -SIGHUP agetty

Inspect local terminal.

$ sudo cat /dev/vcs1 | fold --width 100 | sed -e 's/ *$//g' | sed -e '/^$/N;/\n$/d' | sed -e '${G}'

Debian GNU/Linux 4.19.0-4-amd64 buster x86_64 tty1 (#1 SMP Debian 4.19.28-2 (2019-03-15))
Date: Sun Sep 1  2019 21:03:15 (2 users)
IPv4 address: 10.0.2.15 IPv6 address: fe80::c00:72ff:fed8:c04d

buster login:

Please read how to print contents of virtual console terminal for more information.

Disable system identification message

Alter [email protected]..[email protected], console-getty services to include --noissue parameter.

$ sudo systemctl edit --full [email protected]
# /etc/systemd/system/[email protected]
#  SPDX-License-Identifier: LGPL-2.1+
#
#  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 [email protected], 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 -- \\u' --noissue --noclear %I $TERM
Type=idle
Restart=always
RestartSec=0
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
KillMode=process
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

Restart service to apply changes.

$ sudo systemctl restart [email protected]

Verify service status.

$ sudo systemctl status  [email protected][email protected] - Getty on tty1
   Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-09-01 21:53:12 GMT; 1s ago
     Docs: man:agetty(8)
           man:systemd-getty-generator(8)
           http://0pointer.de/blog/projects/serial-console.html
 Main PID: 1612 (agetty)
    Tasks: 1 (limit: 394)
   Memory: 236.0K
   CGroup: /system.slice/system-getty.slice/[email protected]
           └─1612 /sbin/agetty -o -p -- \u --noissue --noclear tty1 linux

Sep 01 21:53:12 buster systemd[1]: Started Getty on tty1.

Inspect local terminal.

$ sudo cat /dev/vcs1  | fold --width 100 | sed -e 's/ *$//g' | sed -e '/^$/N;/\n$/d' | sed -e '${G}'

buster login:

References

Inspect agetty manual page for more information about escape codes, /etc/issue.d configuration and additional parameters.