Gentoo Archives: gentoo-user

From: covici@××××××××××.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:26:25
Message-Id: 10309.1403285176@ccs.covici.com
In Reply to: Re: [gentoo-user] trying to turn numlock automatically in my ttys under systemd by "Jc García"
1 Jc García <jyo.garcia@×××××.com> wrote:
2
3 > 2014-06-20 10:53 GMT-06:00 <covici@××××××××××.com>:
4 > > Canek Peláez Valdés <caneko@×××××.com> wrote:
5 > >
6 > >> On Fri, Jun 20, 2014 at 4:06 AM, <covici@××××××××××.com> wrote:
7 > >> > Hi. I want to turn numlock automatically, but I am using systemd and I
8 > >> > am having troubles doing this. At someones suggestion in a previous
9 > >> > message (I think Canek's) I created
10 > >> > /etc/systemd/system/getty@service.d/numlock.conf with the following
11 > >> > contents
12 > >> >
13 > >> > [Service]
14 > >> > ExecStartPost=/usr/bin/setleds -D -num </dev/%I
15 > >> >
16 > >> >
17 > >> > However, setleds dies with the following error:
18 > >> > Jun 19 14:24:55 ccs.covici.com setleds[4878]: KDGKBLED: Inappropriate
19 > >> > ioctl for device
20 > >> > Jun 19 14:24:55 ccs.covici.com setleds[4878]: Error reading current
21 > >> > flags setting. Maybe you are not on the console?
22 > >> >
23 > >> > I tried to fool with chvt to make the console current, but no joy there.
24 > >> >
25 > >> > Any assistance would be appreciated.
26 > >>
27 > >> Could you post the exact invocation for setleds? It should be on the
28 > >> logs. I think the invocation for setleds shuld be:
29 > >>
30 > >> /usr/bin/setleds -D +num < /dev/%i
31 > >>
32 > >> The difference between %I (capital "i") and %i is only that %i escapes
33 > >> special symbols, but since it's only the string tty[1-N], I don't
34 > >> think it matters much.
35 > >>
36 > >> The exact invocation of setleds matters, so we can see if the template
37 > >> unit is generating the correct one.
38 > >
39 > > Thanks for your response, First of all I want -num and not +num, but
40 > > that does not make any difference. I am using your unit from
41 > > /usr/lib/systemd/system/getty@.service and add the following in the
42 > > .conf file
43 > > [Service]
44 > > ExecStartPost=/usr/bin/setleds -D -num </dev/%I
45 >
46 > Check my post above, I found the issue with running this command , I
47 > wanted '+num' so thats the only diference.
48 >
49 > > The invocation is not in the logs, all I get is the following:
50 > > Jun 19 14:26:26 ccs.covici.com systemd[1]: Started Getty on tty8.
51 > > Jun 19 14:26:26 ccs.covici.com setleds[5100]: KDGKBLED: Inappropriate
52 > > ioctl for device
53 > > Jun 19 14:26:26 ccs.covici.com setleds[5100]: Error reading current
54 > > flags setting. Maybe you are not on the console?
55 > > Jun 19 14:26:26 ccs.covici.com systemd[1]: getty@××××.service: control
56 > > process exited, code=exited status=1
57 > > Jun 19 14:26:26 ccs.covici.com systemd[1]: Unit getty@××××.service
58 > > entered failed state.
59 > >
60 > > But I know that %I is tty8 or whatever the device is. I checked with a
61 > > shell script to make sure.
62
63 I tried your idea of a shell script like this
64 [Service]
65 ExecStartPost=/bin/bash -c "setleds -D -num </dev/%I"
66 But it did not work, it kept restarting and systemd eventually refused
67 to start. When I commented out the line, it started OK.
68
69
70 --
71 Your life is like a penny. You're going to lose it. The question is:
72 How do
73 you spend it?
74
75 John Covici
76 covici@××××××××××.com

Replies

Subject Author
Re: [gentoo-user] trying to turn numlock automatically in my ttys under systemd "Jc García" <jyo.garcia@×××××.com>