1 |
On 06/20/2014 03:46 PM, covici@××××××××××.com wrote: |
2 |
> Jc García <jyo.garcia@×××××.com> wrote: |
3 |
> |
4 |
>> 2014-06-20 11:26 GMT-06:00 <covici@××××××××××.com>: |
5 |
>> |
6 |
>>> I tried your idea of a shell script like this |
7 |
>>> [Service] |
8 |
>>> ExecStartPost=/bin/bash -c "setleds -D -num </dev/%I" |
9 |
>> I tried your line on my system, and rebooted, and didn't see any problem. |
10 |
>> |
11 |
>> I have: |
12 |
>> |
13 |
>> /etc/systemd/system/getty\@.service.d/numlock.conf: |
14 |
>> [Service] |
15 |
>> #ExecStartPost=-/bin/sh -c '/usr/bin/setleds -D -num </dev/%I' |
16 |
>> ExecStartPost=/bin/bash -c "/usr/bin/setleds -D -num </dev/%I" |
17 |
>> |
18 |
>> |
19 |
>> After reboot I logged in using tty1, here's the output of |
20 |
>> |
21 |
>> systemctl status -l getty@××××.service: |
22 |
>> ----- |
23 |
>> ● getty@××××.service - Getty on tty1 |
24 |
>> Loaded: loaded |
25 |
>> (/etc/systemd/system/getty.target.wants/../../../../usr/lib/systemd/system/getty@.service; |
26 |
>> enabled) |
27 |
>> Drop-In: /etc/systemd/system/getty@.service.d |
28 |
>> └─numlock.conf |
29 |
>> Active: active (running) since vie 2014-06-20 12:04:47 CST; 19min ago |
30 |
>> Docs: man:agetty(8) |
31 |
>> man:systemd-getty-generator(8) |
32 |
>> http://0pointer.de/blog/projects/serial-console.html |
33 |
>> |
34 |
>> ----->This line: |
35 |
>> Process: 625 ExecStartPost=/bin/bash -c /usr/bin/setleds -D -num |
36 |
>> </dev/%I (code=exited, status=0/SUCCESS) |
37 |
>> |
38 |
>> |
39 |
>> Main PID: 624 (login) |
40 |
>> CGroup: /system.slice/system-getty.slice/getty@××××.service |
41 |
>> ‣ 624 /bin/login -- |
42 |
>> |
43 |
>> jun 20 12:05:17 jdesk login[624]: pam_unix(login:session): session |
44 |
>> opened for user jc by LOGIN(uid=0) |
45 |
>> ----- |
46 |
>> |
47 |
>>> But it did not work, it kept restarting and systemd eventually refused |
48 |
>>> to start. When I commented out the line, it started OK. |
49 |
>>> |
50 |
>> |
51 |
>> Post the actual output you get from systemd when is trying to start a |
52 |
>> getty@ service, to see what's going on in your machine. |
53 |
> OK, here is what I get when I enable the ExecStartPost line: |
54 |
> |
55 |
> |
56 |
> bash[28875]: KDGKBLED: Inappropriate ioctl for device |
57 |
> bash[28875]: Error reading current flags setting. Maybe you are not on |
58 |
> the console? |
59 |
> bash[28879]: KDGKBLED: Inappropriate ioctl for device |
60 |
> bash[28879]: Error reading current flags setting. Maybe you are not on |
61 |
> the console? |
62 |
> bash[28883]: KDGKBLED: Inappropriate ioctl for device |
63 |
> bash[28883]: Error reading current flags setting. Maybe you are not on |
64 |
> the console? |
65 |
> bash[28887]: KDGKBLED: Inappropriate ioctl for device |
66 |
> bash[28887]: Error reading current flags setting. Maybe you are not on |
67 |
> the console? |
68 |
> |
69 |
% cat /etc/systemd/system/getty@.service.d/activate-numlock.conf |
70 |
[Service] |
71 |
ExecStartPre=/bin/sh -c 'setleds +num < /dev/%I' |
72 |
|
73 |
|
74 |
That works here to turn numlock on (source ArchLinux wiki) |