Gentoo Archives: gentoo-user

From: "Canek Peláez Valdés" <caneko@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] trying to turn numlock automatically in my ttys under systemd
Date: Fri, 20 Jun 2014 17:09:15
Message-Id: CADPrc80iP8n9ze5tTvi=s1wcerGU7xmaQNtdWcPEFVm89feKDw@mail.gmail.com
In Reply to: Re: [gentoo-user] trying to turn numlock automatically in my ttys under systemd by "Jc García"
1 On Fri, Jun 20, 2014 at 11:40 AM, Jc García <jyo.garcia@×××××.com> wrote:
2 > 2014-06-20 9:06 GMT-06:00 Canek Peláez Valdés <caneko@×××××.com>:
3 >> On Fri, Jun 20, 2014 at 4:06 AM, <covici@××××××××××.com> wrote:
4 >>> Hi. I want to turn numlock automatically, but I am using systemd and I
5 >>> am having troubles doing this. At someones suggestion in a previous
6 >>> message (I think Canek's) I created
7 >>> /etc/systemd/system/getty@service.d/numlock.conf with the following
8 >>> contents
9 >>>
10 >>> [Service]
11 >>> ExecStartPost=/usr/bin/setleds -D -num </dev/%I
12 >>>
13 >>>
14 >>> However, setleds dies with the following error:
15 >>> Jun 19 14:24:55 ccs.covici.com setleds[4878]: KDGKBLED: Inappropriate
16 >>> ioctl for device
17 >>> Jun 19 14:24:55 ccs.covici.com setleds[4878]: Error reading current
18 >>> flags setting. Maybe you are not on the console?
19 >>>
20 >>> I tried to fool with chvt to make the console current, but no joy there.
21 >>>
22 >>> Any assistance would be appreciated.
23 >>
24 >
25 > This has called my attention as it would be nice to activate numlock
26 > by default on console(altought not that important for me anyway )
27 >
28 >> Could you post the exact invocation for setleds? It should be on the
29 >> logs. I think the invocation for setleds shuld be:
30 >>
31 >> /usr/bin/setleds -D +num < /dev/%i
32 >>
33 > I have tried this but after skimming trough the manpage
34 > systemd.service(5), I've found this command will not work, as a
35 > parameter for any of ExecStart* since redirection and pipes(these are
36 > mentioned << < | > >> ) are not supported.
37 > I'd like to mention also that not executing setleds as follows, with
38 > '-' before the binary path :
39 >
40 > ExecStartPost=-/usr/bin/setleds -D -num </dev/%i
41 >
42 > breaks the start of the whole getty service, making it unable to login
43 > in into any console
44 > The way to work around this recommended in the manual is instead
45 > invoking a shell and make it run the commands:
46 >
47 > ExecStartPost=-/bin/sh -c 'setleds -D +num < /dev/%i'
48
49 You are completely right; I had forgotten about redirection in Exec* directives.
50
51 Regards.
52 --
53 Canek Peláez Valdés
54 Profesor de asignatura, Facultad de Ciencias
55 Universidad Nacional Autónoma de México