Discussion:
Where can I 'setterm -blank 5 -powerdown 6' as part of the boot process/systemd startup?
(too old to reply)
David C. Rankin
2018-05-26 02:41:06 UTC
Permalink
All,

/sys/module/kernel/parameters/consoleblank is set to 0 by default in a
change that occurred a while back. Since then, the normal text console will no
longer blank or powerdown leaving your monitor on 24/7. This affects a couple
of Arch servers I have. Since then I have just been turning the monitors off.

Where in the boot/systemd startup can I call setterm to re-enable to normal
console blank and powerdown? Remotely I can call:

# TERM=linux setterm -blank 5 -powerdown 6 >/dev/tty0 </dev/tty0

to enable blank and powerdown post-boot, but I simply want to set this to be
the default. Where best to set this?

(passing the kernel parameter 'consoleblank=300' does not enable powerdown, so
both must be set)
--
David C. Rankin, J.D.,P.E.
Celti Burroughs via arch-general
2018-05-26 08:30:28 UTC
Permalink
On Fri, 25 May 2018 21:41:06 -0500
Post by David C. Rankin
Where in the boot/systemd startup can I call setterm to re-enable
to normal console blank and powerdown?
Put this into /etc/systemd/system/enable-console-blanking.service...

```
[Unit]
Description=Enable virtual console blanking and poweroff

[Service]
Type=oneshot
Environment=TERM=linux
StandardOutput=tty
TTYPath=/dev/console
ExecStart=/usr/bin/setterm -blank 5 -powerdown 6

[Install]
WantedBy=multi-user.target
```

...then do `systemctl enable enable-console-blanking.service`.

~Celti
David C. Rankin
2018-05-31 19:39:24 UTC
Permalink
Post by Celti Burroughs via arch-general
[Unit]
Description=Enable virtual console blanking and poweroff
[Service]
Type=oneshot
Environment=TERM=linux
StandardOutput=tty
TTYPath=/dev/console
ExecStart=/usr/bin/setterm -blank 5 -powerdown 6
[Install]
WantedBy=multi-user.target
Thank you Celti!

I'll give it a try. I installed the service file in /usr/lib/systemd/system
and then enabled it. (I guess I should create a package for it)

Is this the reason console blanking quit working? The default was removed from
/sys/module/kernel/parameters/consoleblank to turn it over to systemd, but no
one ever implemented the service for systemd?

I don't get why for 15 years console blanking worked perfectly and then it
just quit working. Now we need to create a new service file just to get the
default behavior back? Seems kind of crazy.

Oh well, I'll let you know if it works (I just installed 4.16.12, and enabled
the service before reboot -- time will tell. If it does, is there any interest
in creating a "console-blanking" package to install the service? Seems like it
should be there and be set to 600 by default.

Thanks again.
--
David C. Rankin, J.D.,P.E.
David C. Rankin
2018-05-31 19:43:10 UTC
Permalink
Post by David C. Rankin
Post by Celti Burroughs via arch-general
[Unit]
Description=Enable virtual console blanking and poweroff
[Service]
Type=oneshot
Environment=TERM=linux
StandardOutput=tty
TTYPath=/dev/console
ExecStart=/usr/bin/setterm -blank 5 -powerdown 6
[Install]
WantedBy=multi-user.target
Thank you Celti!
It works!

After reboot,

$ cat /sys/module/kernel/parameters/consoleblank
300

Awesome...
--
David C. Rankin, J.D.,P.E.
Guus Snijders via arch-general
2018-06-01 07:03:11 UTC
Permalink
Op do 31 mei 2018 21:39 schreef David C. Rankin <
Post by David C. Rankin
Post by Celti Burroughs via arch-general
[Unit]
Description=Enable virtual console blanking and poweroff
[...]
I'll give it a try. I installed the service file in /usr/lib/systemd/system
and then enabled it. (I guess I should create a package for it)
Indeed, either a package or place it in /etc. /usr/lib is managed by
pacman, so custom files there will cause confusion.
Also, systemd has an hierarchy in /etc for exactly this reason...


Mvg, Guus Snijders
Loading...