how can I remove the clear screen before login
On ubuntu server, how can I avoid the screen being cleared just before the login screen pops?
I'm trying to read an error message on one of the services and I get this annoying clear screen and I cannot scroll up with shift-pageUp.
Solution 1:
for systemd set TTYVTDisallocate
to no.
to achieve this, run systemctl edit getty@tty1
and enter the code below
[Service]
TTYVTDisallocate=no
Solution 2:
Viewing the last screen of messages that appeared during boot
When Ubuntu Server boots, the messages you see are typically written to tty7 (the seventh virtual console). When booting completes, you are switched to tty1, where you are prompted to log on. Thus, the boot messages are not actually cleared; you are simply switched to a different console from the one that contains them.
To view them again, you can switch to tty7 by pressing Alt+F7. You can switch back to tty1 with Alt+F1 (and to the second with Alt+F2, and so forth). This does not (and should not) apply on most Ubuntu Server systems, but when a GUI is running, Ctrl+Alt+F1 must be used to switch to tty1 (and Ctrl+Alt+F2 for tty2, and so forth).
Preventing the screen from being cleared after a user logs out, so the text from their session is visible in the subsequent session
In your home directory there is a file called .bash_logout which contains something like:
if [ "$SHLVL" = 1 ]; then
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi
That is what causes the screen to be cleared on logout. To stop that from happening, comment out all those lines, so it looks like:
#if [ "$SHLVL" = 1 ]; then
# [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
#fi
Solution 3:
After hours of googling, I found the solution in this thread and this question.
First, add console=tty1
to your GRUB_CMDLINE_LINUX
(I also suggest to add noplymouth
to inhibit plymouth
and its useless splashscreen).
#> sudo vi /etc/default/grub
GRUB_CMDLINE_LINUX="console=tty1 noplymouth"
This forces the kernel log to be printed on tty1
instead of tty7
and avoid the tty
switch before the login prompt.
Then just go into /etc/init
and edit one or more of tty1.conf
, tty2.conf
, tty3.conf
, tty4.conf
, tty5.conf
, tty6.conf
or console.conf
. I edited them all adding --noclear
option to the getty
command. For example, editing tty1.conf
:
#> sudo vi /etc/init/tty1.conf
you'll have to replace:
respawn
exec /sbin/getty -8 38400 tty1
with:
respawn
exec /sbin/getty -8 38400 --noclear tty1
That's all, run sudo update-grub
and now your system should boot in a single tty
without clearing it.