You are not logged in.

#1 2022-04-23 14:37:08

Daemonjax
Member
Registered: 2009-07-02
Posts: 48

Can't figure out how to automatically setterm --blank=1 before login

For the life of me I can't figure this out...

I just installed archlinux on an ancient laptop (thinkpad t420).

How do I run setterm --blank=1 just before the login?  I'm not using X or Wayland... just a standard console login.

I want it to run once after a reboot, and before anyone actually logs in -- it's a laptop that's basically a headless server.

Pretty sure the kernel used to do this back in the day automatically...

I tried writing a service unit to run a script that runs the command, but it doesn't work and systemctl reports it as failed for some reason.  I tried a bunch of variations (oneshots, setting restarts, running a script that runs setterm, delaying the script until after networking...) for the .service, but here's the simplest one:

[Unit]
Description=My Power Management

[Service]
ExecStart=/usr/bin/setterm --blank=1
CPUSchedulingPolicy=idle

[Install]
WantedBy=multi-user.target

It even doesn't actually work even if I try to start the service after logging in as root (although it seemingly starts then without error, at least none immediately reported).  It seemingly does nothing.  But if I just type out the command, it works fine.

Last edited by Daemonjax (2022-04-23 14:49:23)

Offline

#2 2022-04-23 14:50:41

dogknowsnx
Guest

Re: Can't figure out how to automatically setterm --blank=1 before login

Please anyone correct me if I'm wrong - I would suggest putting a script in '/etc/profile.d/' without '#!/bin/shellofyourchoice'.

Last edited by dogknowsnx (2022-04-23 14:51:11)

#3 2022-04-23 15:05:13

Daemonjax
Member
Registered: 2009-07-02
Posts: 48

Re: Can't figure out how to automatically setterm --blank=1 before login

dogknowsnx wrote:

Please anyone correct me if I'm wrong - I would suggest putting a script in '/etc/profile.d/' without '#!/bin/shellofyourchoice'.

All scripts there run after login.

Offline

#4 2022-04-23 15:19:05

dogknowsnx
Guest

Re: Can't figure out how to automatically setterm --blank=1 before login

Daemonjax wrote:
dogknowsnx wrote:

Please anyone correct me if I'm wrong - I would suggest putting a script in '/etc/profile.d/' without '#!/bin/shellofyourchoice'.

All scripts there run after login.

True. How about setting the

consoleblank=1

kernel parameter?

Last edited by dogknowsnx (2022-04-23 15:20:41)

#5 2022-04-23 15:39:05

Daemonjax
Member
Registered: 2009-07-02
Posts: 48

Re: Can't figure out how to automatically setterm --blank=1 before login

dogknowsnx wrote:
consoleblank=1

kernel parameter?

That worked!  Nice.  It's in seconds there, so consoleblank=60 should do it.

Offline

Board footer

Powered by FluxBB