I've seen, on two occasions, where Ubuntu 16.04.5 has completely ruined laptop monitors by never turning them off. These were laptops my Uncle owned, where he left them on all the time.

I'm now experiencing the same issue in Ubuntu 16.04.5 on a laptop with an expensive 4K monitor. Upon timeout, it initially turns off all monitors, but upon screen-lock my laptop's built-in 4K monitor comes back on and stays on forever (yet the two external 4K monitors remain off as desired).

I desperately need a work-around for this bug that Ubuntu deems fixed, but it is not fixed for me and I cannot seem to get them to open it back up. I found this question, which is the same issue I'm having, but even there, they say it is fixed (not so for me).

Here's a work-around that I'm attempting without success:

I can manually turn off all 3 monitor with this command:

/usr/bin/xset dpms force off

And, I've attempted to set this command to run every 10 minutes via this cron job:

*/10 * * * * /usr/bin/xset dpms force off

I first tried setting this cron job by editing the root cron:

sudo crontab -e

Later, I tried doing it via user-level cron:

crontab -e

Neither method had an effect.

Why does this command work great when I type it into the terminal, but not work via cron? How can I make it work via cron?

  • 1
    I'm assuming you're getting an email from the cron daemon with the error message xset: unable to open display ""? You're using it without -display in an environment where DISPLAY will not have been set. – Kusalananda Mar 10 at 15:53
  • Close. I'm getting: "info (No MTA installed, discarding output)". I suspect your reasons are correct. I must figure out how to specified this display. – Lonniebiz Mar 10 at 15:56
  • 1
    Probably the same value as echo "$DISPLAY" would show in a terminal. While you're at it, install exim or some MTA. Cron relies on a MTA to deliver output and errors from cronjobs, and maintenance jobs would probably want to be able to send output from these to root as well... – Kusalananda Mar 10 at 15:58
  • 1
    MTA="Mail Transfer Agent". It's the software that makes sure that local mail is handled on the system. I'm not a Linux user, so I don't dare give you an authoritative suggestion, but something like sudo apt-get install exim maybe? Look this up first. See e.g. How can I setup a Mail Transfer Agent? – Kusalananda Mar 10 at 16:05
  • 1
    You could use something that monitors gdbus monitor --session --dest org.gnome.ScreenSaver and when it shows as locked it runs the command. It's very weird that the actual turnning off doesn't happen though. This is managed by gnome-settings-daemon when the presency is unset – Treviño Mar 11 at 11:23

Your Answer

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

Browse other questions tagged or ask your own question.