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