So I have also been searching a lot for an answer to this question and been wondering why it have been so difficult to find a CLI based solution to this task.
I am using the “Raspberry Pi Imager” tool (on Window$) to prepare a USB stick (or SD card) and hereafter configure everything via SSH.
I know I could just use RDP or VNC to access and thus make this change via a GUI. But that’s to annoying, hence my need for a CLI based solution
Finally I found it in this thread (thank you @evroom !)
So this is just to help others with the same search that this [1] still works on the current latest RPI OS bullseye:
pi@magicmirror:~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
Without this [1] change the screen goes black after 600s (10m)
Which can also be identified by the “timeout value” returned by this command.
pi@magicmirror:~ $ DISPLAY=:0 xset q
...
Screen Saver:
prefer blanking: yes allow exposures: yes
timeout: 600 cycle: 600
...
After fixing it the value gets set to ‘0’
Right now I still see the screen after 16m (and counting…)
How to
The config change can be applied in many ways (vi, nano etc) but I prefer this method (as it can be copy-pasted or be made part of a config-script).
[1] I “just” add the three required lines to the config file:
printf "@xset -dpms\n@xset s off\n@xset s noblank" | sudo tee -a /etc/xdg/lxsession/LXDE-pi/autostart
PS.: Before I found this I also tried these solutions (which all failed to solve the problem
A. in /etc/lightdm/lightdm.conf:
xserver-command=X -s 0 dpms
B. Enable VNC as a workaround for mutter
I found (but did not try)
C. install xscreensaver and configure it to not kick in
HTH (my first post here :-)