[Pkg-kbd-devel] Bug#771161: kbd: setterm doesn't do its job when called from the kbd init script with systemd

Andreas Henriksson andreas at fatal.se
Thu Dec 10 14:28:14 UTC 2015


Hello Andreas Trottmann.

Sorry for the very late answer on your Debian bug report.
I've recently started looking into the kbd packaging myself
and have some questions I'm hoping you can help me out with.

On Thu, Nov 27, 2014 at 10:02:37AM +0100, Andreas Trottmann wrote:
> Package: kbd
> Version: 1.15.5-2
> Severity: normal
> 
> Dear Maintainer,
> 
> As reported in bug #750631, settings such as BLANK_TIME, BLANK_DPMS
> and POWERDOWN_TIME in /etc/kbd/config or /etc/kbd/config.d/* are not
> being applied if systemd is the current init system.
> 
> Apparently when /etc/init.d/kbd is run under systemd, there are at
> least two differences from other init systems:
> 
>  - the environment variable TERM is not defined

... which setterm utility requires (unless --term is specified).

>  - standard output is not /dev/tty1
> 
> For setterm to do its job, TERM needs to be known and standard output
> needs to be a terminal (to which setterm wants to apply its settings).
> 
> I have worked around the issue by modifying /etc/init.d/kbd to call setterm
> like this:
> 
>         TERM=linux setterm > /dev/tty1 $setterm_args 
> 
> as seen in the modified conffile attached to this e-mail.

(You can also use "--term linux", or even "--term con".)

> 
> On a Linux system, this apparently does what I expect it to do; even
> if I explicitly state /dev/tty1, the settings are valid for all of the
> virtual terminals.

I'd be very interested to know how you manage to get past the
test_console check. For me that check makes the script bail out early
when running under systemd, thanks to the tty check.
The tty program is part of coreutils which is Essential: yes,
so I don't see how .... do you have additional modifications to the
init script which you've not posted here?
Could you please try adding 'set -x' on the second row of
/etc/init.d/kbd and check what 'journalctl -u kbd' says after next
reboot?

> 
> 
> I don't know whether this workaround is fit to be applied in the kbd
> package, or if it should be "safeguarded" by a check for "running under
> a Linux kernel" or "running under systemd", or if the right thing to do
> would be something entirely different.

http://sources.debian.net/src/util-linux/2.27.1-1/term-utils/setterm.c/#L28

... "In this case if the terminal type is "con*", or "linux*" the string
that invokes the specified capabilities on the PC Linux virtual console
driver is output." ...

Not sure how linux-specific the outputted codes are and if they are then
kfreebsd (and hurd?) possibly implements linux compatibility, but
it might be wise to have some check until confirmed it'll work outside
of linux.

Regards,
Andreas Henriksson



More information about the Pkg-kbd-devel mailing list