yaccri
Posts: 10
Joined: Mon Nov 11, 2013 8:10 am

How to clear screen on startup?

Mon Nov 11, 2013 3:24 pm

I want to have a blank screen immediately after startup (clear > /dev/tty1).
No user login or interaction is required.
The boot is to the command line (not the graphic interface).

How do I clear the screen without showing the login prompt?
Also, is it possible to hide all the messages that come up when the system starts?

Thanks

User avatar
DougieLawson
Posts: 40821
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to clear screen on startup?

Mon Nov 11, 2013 11:52 pm

Try this:
sudo cp /etc/issue /etc/issue~ # take a backup in case we want to return to normal
sudo clear > /etc/issue # write the clear screen codes to /etc/issue
reboot

To return to normal
sudo mv /etc/issue~ /etc/issue
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

HerSo
Posts: 29
Joined: Wed Jan 02, 2013 6:18 am
Location: Spain
Contact: Website

Re: How to clear screen on startup?

Tue Nov 12, 2013 12:01 am

yaccri wrote:I want to have a blank screen immediately after startup (clear > /dev/tty1).
No user login or interaction is required.
The boot is to the command line (not the graphic interface).
for automated login:
In Terminal:

sudo nano /etc/inittab
Scroll down to:

1:2345:respawn:/sbin/getty 115200 tty1
and change to

#1:2345:respawn:/sbin/getty 115200 tty1
Under that line add:

1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1
yaccri wrote:How do I clear the screen without showing the login prompt?
Also, is it possible to hide all the messages that come up when the system starts?
to clear screen:
modify or create /home/pi/.bash_profile and put in:
clear
And save archive and reboot.
Thanks

yaccri
Posts: 10
Joined: Mon Nov 11, 2013 8:10 am

Re: How to clear screen on startup?

Tue Nov 12, 2013 8:46 am

DougieLawson wrote:Try this:
sudo cp /etc/issue /etc/issue~ # take a backup in case we want to return to normal
sudo clear > /etc/issue # write the clear screen codes to /etc/issue
reboot

To return to normal
sudo mv /etc/issue~ /etc/issue
Thanks.
There's still 'raspberry pi login:' displayed on the screen. Is it possible to clear the screen completely without showing that prompt?

In addition, is it possible not to display all the startup log (or display just dots or something similar as the startup progresses)?

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: How to clear screen on startup?

Tue Nov 12, 2013 11:38 am

It would be helpful if you'd tell us what problem you're actually trying to solve. What's the real goal here?

These apparently disconnected "Is it possible to ...?" questions are a little frustrating.

Now, granted, it is more or less within the realm of possibility to sort of guess what your goals are, but it is better that we would not have to guess.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

yaccri
Posts: 10
Joined: Mon Nov 11, 2013 8:10 am

Re: How to clear screen on startup?

Tue Nov 12, 2013 12:19 pm

The goal is to use the rpi as a media player.
It will be connected to a projector. When receiving IR command it will play a movie.
I don't want to display anything before the movie starts, or after it finishes.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: How to clear screen on startup?

Tue Nov 12, 2013 2:54 pm

Why not?
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

yaccri
Posts: 10
Joined: Mon Nov 11, 2013 8:10 am

Re: How to clear screen on startup?

Tue Nov 12, 2013 3:16 pm

Because that's how I want it.

Can we concentrate on the issues?
I look for 2 things:
1. Automaticaly clear the screen after startup, without seeing any prompt. I don't want to see a 'raspberrypi login:' message.
2. If possible, avoid showing the startup messages

I appreciate your help.
Thank you.

grmn
Posts: 26
Joined: Thu Jul 19, 2012 3:01 pm

Re: How to clear screen on startup?

Tue Nov 12, 2013 4:03 pm

I also use the rpi as a media player, controlling it via 'ssh'
to clear the screen at startup I run

Code: Select all

clear > /dev/tty1
setterm -cursor off > /dev/tty1
on my system 'raspbian' they need to be run as root
this also clears rpi logo.
not sure about startup messages,

hope this helps

yaccri
Posts: 10
Joined: Mon Nov 11, 2013 8:10 am

Re: How to clear screen on startup?

Tue Nov 12, 2013 4:39 pm

That's great, but how do I make it run *automatically* at startup?

grmn
Posts: 26
Joined: Thu Jul 19, 2012 3:01 pm

Re: How to clear screen on startup?

Tue Nov 12, 2013 4:50 pm

Is there an autostart.sh that this could be added to?

yaccri
Posts: 10
Joined: Mon Nov 11, 2013 8:10 am

Re: How to clear screen on startup?

Tue Nov 12, 2013 4:59 pm

No, at least not in /etc/init.d.

grmn
Posts: 26
Joined: Thu Jul 19, 2012 3:01 pm

Re: How to clear screen on startup?

Tue Nov 12, 2013 5:10 pm

try taking a look here http://www.akeric.com/blog/?p=1976

User avatar
DougieLawson
Posts: 40821
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to clear screen on startup?

Tue Nov 12, 2013 9:11 pm

yaccri wrote:
DougieLawson wrote:Try this:
sudo cp /etc/issue /etc/issue~ # take a backup in case we want to return to normal
sudo clear > /etc/issue # write the clear screen codes to /etc/issue
reboot

To return to normal
sudo mv /etc/issue~ /etc/issue
Thanks.
There's still 'raspberry pi login:' displayed on the screen. Is it possible to clear the screen completely without showing that prompt?

In addition, is it possible not to display all the startup log (or display just dots or something similar as the startup progresses)?
If you want to completely disable the login prompt follow http://www.raspberrypi.org/phpBB3/viewt ... 02#p452302 but add
1:2345:respawn:/bin/true -f pi tty1 </dev/tty1 >/dev/tty1 2>&1
And that really is an ugly hack.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

yaccri
Posts: 10
Joined: Mon Nov 11, 2013 8:10 am

Re: How to clear screen on startup?

Wed Nov 13, 2013 4:56 am

This throws the message: 'INIT: Id "1" respawning too fast: disabled for 5 minutes'.
After 5 minuter, the message repeats.

yaccri
Posts: 10
Joined: Mon Nov 11, 2013 8:10 am

Re: How to clear screen on startup?

Wed Nov 13, 2013 6:07 am

This simple solution at http://ananddrs.com/2013/09/18/rpi-hide-boot-msg/ worked for me. It hides all boot messages.
I still need to get rid of the login prompt.

User avatar
mrpi64
Posts: 931
Joined: Sat Feb 16, 2013 5:13 pm

Re: How to clear screen on startup?

Wed Nov 13, 2013 8:39 am

Run 'sudo raspi-config', and make sure that the 'Boot to desktop' option is selected yes. It may be in advanced settings.
I'm happy to help.
https://www.raspberrypi.org/forums/viewtopic.php?f=78&t=51794 - List of games that work on the Pi.

yaccri
Posts: 10
Joined: Mon Nov 11, 2013 8:10 am

Re: How to clear screen on startup?

Wed Nov 13, 2013 8:56 am

Doesn't boot to desktop mean boot to the graphical UI?
I don't want to use startX. Only a blank screen is required.

x422man
Posts: 1
Joined: Sun Jan 12, 2014 5:32 pm

Re: How to clear screen on startup?

Sun Jan 12, 2014 6:06 pm

did you ever get this working? I am also working on a system where i need to have completely clean output during boot. i have manged to get very near to my final goal by rediecting all mesages to TTY3 during boot by editing /boot/cmdline.txt and changing/adding the following

Code: Select all

console=tty3 vt.global_cursor_default=0 quiet
i dont actually need to login to tty1, so i also comment it out in /etc/inittab and make tty3 my main console for messeages and so use --noclear to keep boot messages from the kernel. i can swap to using it ALT-F3 if i need to, but mainly i administer using SSH

Code: Select all

#1:2345:respawn:/sbin/getty --noclear 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
3:2345:respawn:/sbin/getty --noclear 38400 tty3
this seems to work ok so far. I would still like to find a way to completely clear tty1 from another console or SSH if i need to though.

User avatar
DeanC
Posts: 136
Joined: Thu Sep 26, 2013 4:07 pm
Location: Vancouver, Canada

Re: How to clear screen on startup?

Sun Jan 12, 2014 7:28 pm

Don't know if this helps...

I have an elderly friend who likes to watch movies but doesn't know about computers at all. I set her up with a RPi with an 2GB SD card with a minimal raspbian image on it. The image automatically logs into tty1, blanks the screen, and places the cursor right in the middle of the screen without a prompt. Then it mounts the usb key (which is where the movie is stored) and plays the movie file with omxplayer (only one movie is allowed on the flash key at a time). So basically she makes sure her TV is on the proper source, and turns on the RPi (which is plugged into a power bar so she can just flip the power switch). The movie is them played for her.

The mount and running the movie isn't important, but I will post the code for blanking the screen on login if people are interested. It is written in PERL (natch).

First, make sure auto login to a command line is enabled. Edit the inittab file with this command:
sudo nano /etc/inittab

Find this line (assuming you haven't changed it before):
1:2345:respawn:/sbin/getty --noclear 38400 tty1

and add a # to the start:
#1:2345:respawn:/sbin/getty --noclear 38400 tty1

Then paste the following below that line:
1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1

Save the file. Now we need to add a script to run once we log in. So we are going to edit the profile file:
sudo nano /etc/profile

Add the following line to the end of the file and save it:
/home/pi/o1

Then we must create the script:
nano /home/pi/o1

Paste the following code into the file and save it:

Code: Select all

#!/usr/bin/perl

use utf8;
use 5.010;
use strict;
#use autodie;
use warnings;
#use diagnostics;

print "\033[2J"; #clear the screen
print "\033[20;50H"; #jump to middle of TV screen

# This line is here to stop the command prompt, until the ENTER key is hit.
my $temp = <STDIN>;

exit 0;
Then issue this command to make it executable:
chmod 755 /home/pi/o1

That's it, just reboot and give it a try. Hope this helps. This doesn't work for ssh (although, it might be possible?!?).
We 'idiot proofed' the world, and now it's full of idiots!

Vesuri
Posts: 1
Joined: Mon Jan 13, 2014 12:47 am

Re: How to clear screen on startup?

Mon Jan 13, 2014 12:52 am

Create an issue file which disables the blinking cursor and sets the text color to black:

Code: Select all

echo -e '\033[?17;0;0c\033[0;30m' > /etc/issue.tty1
Modify /etc/inittab so that the issue file generated above is used on tty1:

Code: Select all

1:2345:respawn:/sbin/getty -f /etc/issue.tty1 38400 tty1
Take the new init configuration into use:

Code: Select all

init q
killall getty

beatfreq
Posts: 1
Joined: Sun Apr 06, 2014 5:47 pm

Re: How to clear screen on startup?

Mon Apr 07, 2014 3:39 pm

Thanks DeanC and Vesuri, these two solutions work for me and give me options (blinking cursor or complete blank screen, depending on my current project needs.)

BlankMan
Posts: 4
Joined: Sat Nov 30, 2019 12:44 am

Re: How to clear screen on startup?

Tue Dec 31, 2019 6:41 am

I may be late to this party but I had the same need as the OP and came across this thread. It helped me come up with a solution which I will share because things have changed since this thread was started, For one thing there is no inittab anymore in Raspbian Buster. There wasn't in Stretch either.

The need, for those that think they need to know why, is... I run Kodi on boot on a Pi 3 with their 7" touchscreen. The Pi boots to CLI no autologin. As such the status/remnants of the boot processes are on the TS along with the enter username/password prompt.

Then Kodi starts. All is fine because Kodi covers that all up. Until... And, if Kodi is using a "Dim" screensaver. Then when Kodi Dims you see all the boot stuff and login stuff more so then the dimmed out Kodi. That. Looks. Bad. Period.

So what I did was this. In /etc/rc.local I added this just before the exit 0:

Code: Select all

/usr/bin/clear > /dev/tty1
/usr/bin/setterm -cursor off > /dev/tty1
/usr/local/bin/ClearScreen &
The script /usr/local/bin/ClearScreen contains this:

Code: Select all

#!/bin/bash

/bin/sleep 10

/usr/bin/clear > /dev/tty1
/usr/bin/setterm -cursor off > /dev/tty1

exit 0
Set the permissions to 700 and owner root:staff on /usr/local/bin/ClearScreen.

So, the screen is cleared by the lines in rc.local but after rc.local is executed and has completed more boot status lines appear and then the login request appears. The /usr/local/bin/ClearScreen script is spawned from rc.local allowing rc.local to complete then 10 seconds later the screen is cleared again.

This works. YMMV Once Kodi starts if Kodi's screensaver dims you see nothing from/in the background. If you exit Kodi you get a blank screen that on the TS even touching it does not cause anything to appear. I haven't tested that extensively because, well, I don't need anything to show up.

This Pi has no keyboard/mouse associated with it because it's purpose in life is to be a media client, nothing more. If I need to access it I SSH in. It's networking is set up static for wired and DHCP for wireless allowing two ways to access it if needed.

I posted this in case others need to do this and discover this thread like I did.

Return to “General discussion”