17

Avoiding installing anything or rebooting, how can I "wake" the TTY1 display via SSH? None of the suggestions (Stopping Raspberry Pi display sleep) worked on my running Pi.

From what I have read trying to get an answer, these would work if I rebooted, which I am trying to avoid.

2
  • 1
    Why are you trying to avoid a reboot ?
    – Lawrence
    Oct 29, 2013 at 1:19
  • 1
    A wanted the solution available in my mental toolbox, instead of having to set up an install programs/settings in advance.
    – rob
    Oct 29, 2013 at 13:37

5 Answers 5

19

So after a lot of googling I found the codes that setterm should be sending to the tty and these two command unblank the screen every time.

sudo chmod 666 /dev/tty1
echo -ne "\033[9;0]" >/dev/tty1

The only reason I can think of all the other commands (that should have worked) failing was because the Pi is connected via svideo to a tv and not HDMI or a monitor.

4
  • Holy shoot, this also works for my nvidia blank console situation, that seemed impossible to revive
    – lkraav
    Feb 21, 2015 at 20:08
  • didn't work for Raspberry 2 B Raspbian on HDMI
    – mgPePe
    Jan 25, 2016 at 18:14
  • 4
    You do not need to use sudo chmod to change the permissions on the tty device, nor should you do this. The correct code should be: sudo bash -c 'echo -ne "\033[9;0]" > /dev/tty1'
    – Justin
    Jun 5, 2017 at 19:08
  • 1
    Worked for me with old Raspberry Pi B ver. 2 May 23, 2021 at 8:23
5

http://www.winds.org/pub/grdl/ANSI.txt

ESC[9;#] is to set the timeout for screen blanking. If you want to leave the timeout value alone, then use ESC[13] to unblank a screen.

So, depending on your shell (I use tcsh) a simple echo would be

echo -n "\e[13]" > /dev/tty1

Using the above example

echo -ne "\033[13]" > /dev/tty1

I saw no need to chmod 666 /dev/tty1 first. But I run as root (because I trust my abilities).

2

I've probably answered this before, here or somewhere... but no worries...

Try:

setterm -blank poke

should unblank the screen from a login, BUT... usually you need to send the appropriate codes to /dev/tty1, not the /dev/pty/X you're using as an ssh user... thus:

setterm -blank poke | sudo tee /dev/tty1 > /dev/null

This sends setterm's output (magic codes!) to the proper terminal to wake it up as you desire. Since I do this often, and use other options too, I made a little script I call 'tty1'

#!/bin/bash
#
# send 'setterm' commands to /dev/tty1 (physical console)
setterm $* | sudo tee /dev/tty1 > /dev/null

Which I use like this:

tty1 -reset -cursor off

This command resets/clears the screen, returning to text mode and turns off the blinky cursor. handy when I don't want the distraction.

tty1 -blank poke

Would wake up the screen. (Well, should... works for me(tm))

(Do remember that you'll need to either set up nopasswd access to sudo, or be prepared to type the root password when you use this command)

But wait! If you call now! We'll include this gem: How to remove the need to supply a password for sudo usage! Operators are standing by!

Add this line to a file named "no-sudo-passwd-for-pi" (no dots allowed!) in /etc/sudoers.d/

pi ALL=(ALL) NOPASSWD: ALL

This will cause the user 'pi' to not require a password for ANY sudo invocation. BEWARE! This can be considered a security risk. Balance your need for this usage against the potential risks involved. (see man sudoers)

1
  • Unfortunately that did not work even when run with sudo. I wonder if it matters that I am using the svideo out and not hdmi.
    – rob
    Oct 30, 2013 at 20:21
2

To avoid a chmod, you can just use sudo tee to write to the console:

echo -ne "\033[9;0]" | sudo tee /dev/tty1
0

I had this problem after exiting XBMC and going back to console screen: everything stayed black.

I solved this by calling once /usr/bin/xinit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.