LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 04-29-2006, 05:09 AM   #1
ElectroLinux
Member
 
Registered: Feb 2004
Posts: 74

Rep: Reputation: 15
Question Disabling screensaver on tty1 (virtual console)


I want to be able to boot into level 3 without a keyboard or monitor connected and have the virtual console appear without having to plug in the keyboard. I only want to be able to connect the monitor to see if it is spewing errors or just to take a look at it's hostname. I know i can redirect the spewing errors to a file, but i'd still like to physically only need to connect the monitor to check out the "kernel panic" or "gart errors".

I've tried putting this in rc.local and it didn't work for me on Whitebox 3.0

setterm -blank 0 -powersave off -powerdown 0 > tty1
I've also tried setterm with with only one of the three options


It work fines if your keyboard is already plugged in and you do it at virtual console 1 and unplug your keyboard. It seems like it only works if the keyboard is plugged into the system to begin with.

On that note, how could i make a script or cron that will send the signal of a keyboard plugged in or the signal of the shift key being pressed without actually using a physical keyboard present. It would be a nice little trick.
 
Old 04-29-2006, 12:10 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
Try this in your boot scripts:

echo -n -e "\033[9;0]"

It sends the command directly to the console to disable screen blanking. Also, make sure your BIOS power management is not set to blank the screen after some interval.
 
Old 04-30-2006, 05:10 AM   #3
ElectroLinux
Member
 
Registered: Feb 2004
Posts: 74

Original Poster
Rep: Reputation: 15
I haven't gotten the chance to try it out yet. So you are echoing the ESC character and what is the [9;0] part? How would that disable the screen blanking? I thought setterm -blank 0 does that? Or are you just doing another method to disable the screen? By the the way, thanks for the reply.
 
Old 04-30-2006, 07:21 AM   #4
ioerror
Member
 
Registered: Sep 2005
Location: Old Blighty
Distribution: Slackware, NetBSD
Posts: 536

Rep: Reputation: 30
Have you tried just doing 'setterm -blank 0 -powersave off -powerdown 0' without redirecting to tty1. The problem is that rc.local is run just before switching to runlevel 3, i.e. before the getty's are started, before tty1 is opened, so it would have no effect (I think).
 
Old 04-30-2006, 10:18 AM   #5
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
ioerror is right - if you are booting to runlevel 3, the ttys have not been started at the point that the init scripts are running. What you will have to do is modify /etc/inittab to have the first mingetty autologin a user:

1:2345:respawn:/sbin/mingetty --autologin username tty1

In that 'username's .bash_profile, you can add the setterm command to prevent the screen blanking.
 
Old 04-30-2006, 03:19 PM   #6
ElectroLinux
Member
 
Registered: Feb 2004
Posts: 74

Original Poster
Rep: Reputation: 15
I thought about putting it in the inittab, but i realized I'd have to setterm for a specific user. I think setterm is reset after every respawn or if you logout. I tried doing setterm without directing to tty1 first, and that didn't work.

By using autologin, wouldn't that be less secure? I guess I could create a very limited account, but i'd like to keep it so no user is auto logged in at all.

Does using --autologin still give you a login prompt? I am guessing no and it brings you to a prompt.

Another question, lets say I do setup the autologin, does that mean I cannot log out since i I want my setterm setting to still not blank the screen?

I'd really like to have a way that would not depend on user and just not blank the screen so only a monitor is needed to view the screen output.

Thanks for the input, really appreciate it. I'm trying to set this up on several hundred systems and it gets annoying that (1) gotta plug in the kb (2) if the system crashed, it doesn't respond to kb (3) viewing the last moments before the crash would be great in diagnosing.
 
Old 04-30-2006, 04:06 PM   #7
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
Autologin won't give you a prompt, it will just login the user. You could have a minimal profile that does:

Code:
function Cleanup_And_Exit_On_Interrupt () {
   logout
}
trap Cleanup_And_Exit_On_Interrupt INT
trap Cleanup_And_Exit_On_Interrupt HUP
trap Cleanup_And_Exit_On_Interrupt QUIT
trap Cleanup_And_Exit_On_Interrupt USR1
trap Cleanup_And_Exit_On_Interrupt TERM

setterm -blank 0 -powersave off -powerdown 0
clear
sleep
exit
That should prevent anyone from doing anything at the console.
 
Old 05-01-2006, 05:42 PM   #8
ElectroLinux
Member
 
Registered: Feb 2004
Posts: 74

Original Poster
Rep: Reputation: 15
Using 1:2345:respawn:/sbin/mingetty --autologin username tty1 along with the code above. As soon as the autologin logs in, it exits just as the .bash_profile says and respawns again till it respawns too many times and gets a 5 minute lock out. I guess it's natural for it to respawn since it was told to do so.

I want to still be able to login to the console and have it respawn after loggin out.

My question is since the code you have give me logs me out, doesn't the setterm command reset to defaults...making an autologin account not necessary since it gets reset after log out?
 
Old 05-01-2006, 06:34 PM   #9
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
The .bash_profile doesn't specify that it is to exit, unless interrupted. The problem is that the sleep command is missing a parameter. Set it to whatever you want, for example:

sleep 1d

will sleep for 1 day, then exit. At that point, the shell should respawn.
 
Old 05-01-2006, 07:18 PM   #10
ElectroLinux
Member
 
Registered: Feb 2004
Posts: 74

Original Poster
Rep: Reputation: 15
I decided to try putting the escape sequence you gave me earlier in /etc/issue to see if that will solve it. I'll let you know the results when I am done testing. It looks good so far.
 
Old 05-02-2006, 04:02 AM   #11
ioerror
Member
 
Registered: Sep 2005
Location: Old Blighty
Distribution: Slackware, NetBSD
Posts: 536

Rep: Reputation: 30
You could also try 'once' instead of 'respawn'...

Alternatively, since you can use a serial port as the system console, you could connect a null modem cable to one of your other boxes, then you wouldn't need a monitor at all.
 
Old 05-02-2006, 10:22 PM   #12
ElectroLinux
Member
 
Registered: Feb 2004
Posts: 74

Original Poster
Rep: Reputation: 15
Thanks for the suggestion ioerror. I put ^[[\033[9;0] in the /etc/issue and it seems to work. Thanks all for the help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Virtual Machine Screensaver (as seen on Mepis) username132 Linux - General 0 04-19-2006 06:39 PM
Console Screensaver TomalakBORG Linux - General 0 07-19-2005 12:48 PM
Console screensaver won't disable jev-bird Linux - Software 0 10-13-2004 01:51 PM
Disabling virtual screen mouse scrolling in X? wapcaplet Linux - Software 3 11-06-2003 12:49 PM
Disabling console commands? Kage Linux - Newbie 4 02-09-2002 01:38 PM


All times are GMT -5. The time now is 11:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration