3

Hi i'm trying to set up an old laptop as a 'server' for testing purposes.

As such, I don't want the screen on all day, however i do want the cpu running 24x7.

Can the 'lid close' switch be configured somehow to simply turn off the screen but otherwise the laptop is running as normal?

FYI: I'm running coreos, but i'm willing to switch to another docker container OS if it makes life easier.

migrated from serverfault.com Dec 8 '15 at 1:24

This question came from our site for system and network administrators.

7

I'm not sure how you missed it in the docs, because when I looked it was plainly there.

Place this in logind.conf:

HandleLidSwitch=ignore
  • 2
    Ah yes but I'd like the screen to still turn off – Chris Dec 6 '15 at 12:00
  • 1
    Did it not turn off? – Michael Hampton Dec 6 '15 at 12:08
  • You're right! Thanks so much. Sorry for wasting your time. – Chris Dec 6 '15 at 12:19
  • 3
    I've done this, but my screen is on while the lid is closed :( – Hubro Sep 18 '17 at 21:07
  • 1
    I've done this, too, but my screen is still on while the lid is closed. – Limited Atonement Jun 10 '18 at 0:46
1

According to the documentation at this url, the HandleLidSwitch can be set to lock which locks your session and normally causes the screen to turn off either immediately of a few seconds later. This works well on my Ubuntu-Gnome 17.10. The only downside is you'll have to input your password again when you reopen the lid.

Just add the following line in your /etc/systemd/logind.conf

HandleLidSwitch=lock

Note that there is also a HandleLidSwitchExternalPower if you want different behavior when plugged.

The full set of possible values for HandleLidSwitch and HandleLidSwitchExternalPower is:ignore, poweroff, reboot, halt, kexec, suspend, hibernate, hybrid-sleep, suspend-then-hibernate, and lock

  • Welcome to posting on U&L! A Core OS server doesn't run X (graphics), unless you're very determined to do so. So for the original asker there won't be any graphical session to lock. Since you bumped this, I've suggested an alternative answer :). If you're writing your answer because it solved a related but different problem which you had, it might be worth writing your problem as a question. You are allowed and indeed encouraged to specify your own answer when you write a question :). I'm not saying this post is a big problem, but if the thread did get too cluttered it might be off-topic – sourcejedi Jul 7 '18 at 18:10
  • (If you wanted to post a separate question, you could always include a link, saying "similar to this other question, but I have Ubuntu Gnome installed and using =ignore leaves my screen on, is there some other approach that lets me trigger the normal screen lock?" or whatever). – sourcejedi Jul 7 '18 at 18:15
1

Several people have commented that they can stop their laptop from suspending when closed, but the screen stays on. Maybe this is due to differences in firmware? There is an alternative feature that might work.

At one point, the Linux kernel text console had a default setting that blanked itself after a period of inactivity. An equivalent to the screensaver in your favourite graphical environment :).

Some people like to set the blank time using the kernel boot option consoleblank=, which takes a value in seconds. However, the documentation I find does not say this is sufficient to achieve full power saving, or any real level of power saving. Maybe it does what they want it to on their system! Or maybe it doesn't. The documentation is unhelpful on this point.

Remember the original function of a screensaver, was to avoid burning-in a permanent ghost image on your CRT display. It does not necessarily save power. When full power saving was introduced, it was used after a longer delay. Bringing the display back up and running could take a few seconds, which would be much more annoying to the user.


http://man7.org/linux/man-pages/man1/setterm.1.html

Apparently it is possible to enable console blanking at runtime, using setterm --consoleblank [1-60]. And then setterm has another option --powerdown [1-60], to eventually enable "powerdown mode" after a timeout.

If I'm reading it correctly, there's a sequence. First the console blank timeout applies. Then after one powerdown timeout, it applies "vsync suspend mode". Finally after a second powerdown timeout, it applies "powerdown mode". These timeouts are all specified in minutes, not seconds.

So I think you can use a command like this:

 /bin/setterm -term linux -blank 10 -powerdown 5 </dev/tty1 >/dev/tty1

I'm not sure whether CoreOS lets you add arbitrary commands to the boot process (as in rc.local on other distributions, for example). I imagine you can always use a privileged container :).


setterm --blank says that blanking uses APM if available. Narrator voice: APM is not available on modern hardware. I don't know if blanking will use any modern power saving scheme.

"powerdown" mentions "VESA" display power saving. "VESA" power saving is still a thing. I don't know if "powerdown" is necessary or even sufficient to work for modern stuff.

setterm does not say what the default "powerdown" settings are. If I had to guess, I would say it is not enabled by default.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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