2014-06-20 13:52 GMT-06:00 Michael Cook <mc...@mackal.net>: > On 06/20/2014 03:46 PM, cov...@ccs.covici.com wrote: >> >> Jc García <jyo.gar...@gmail.com> wrote: >> >>> 2014-06-20 11:26 GMT-06:00 <cov...@ccs.covici.com>: >>> >>>> I tried your idea of a shell script like this >>>> [Service] >>>> ExecStartPost=/bin/bash -c "setleds -D -num </dev/%I" >>> >>> I tried your line on my system, and rebooted, and didn't see any problem. >>> >>> I have: >>> >>> /etc/systemd/system/getty\@.service.d/numlock.conf: >>> [Service] >>> #ExecStartPost=-/bin/sh -c '/usr/bin/setleds -D -num </dev/%I' >>> ExecStartPost=/bin/bash -c "/usr/bin/setleds -D -num </dev/%I" >>> >>> >>> After reboot I logged in using tty1, here's the output of >>> >>> systemctl status -l getty@tty1.service: >>> ----- >>> ● getty@tty1.service - Getty on tty1 >>> Loaded: loaded >>> >>> (/etc/systemd/system/getty.target.wants/../../../../usr/lib/systemd/system/getty@.service; >>> enabled) >>> Drop-In: /etc/systemd/system/getty@.service.d >>> └─numlock.conf >>> Active: active (running) since vie 2014-06-20 12:04:47 CST; 19min ago >>> Docs: man:agetty(8) >>> man:systemd-getty-generator(8) >>> http://0pointer.de/blog/projects/serial-console.html >>> >>> ----->This line: >>> Process: 625 ExecStartPost=/bin/bash -c /usr/bin/setleds -D -num >>> </dev/%I (code=exited, status=0/SUCCESS) >>> >>> >>> Main PID: 624 (login) >>> CGroup: /system.slice/system-getty.slice/getty@tty1.service >>> ‣ 624 /bin/login -- >>> >>> jun 20 12:05:17 jdesk login[624]: pam_unix(login:session): session >>> opened for user jc by LOGIN(uid=0) >>> ----- >>> >>>> But it did not work, it kept restarting and systemd eventually refused >>>> to start. When I commented out the line, it started OK. >>>> >>> >>> Post the actual output you get from systemd when is trying to start a >>> getty@ service, to see what's going on in your machine. >> >> OK, here is what I get when I enable the ExecStartPost line: >> >> >> bash[28875]: KDGKBLED: Inappropriate ioctl for device >> bash[28875]: Error reading current flags setting. Maybe you are not on >> the console? >> bash[28879]: KDGKBLED: Inappropriate ioctl for device >> bash[28879]: Error reading current flags setting. Maybe you are not on >> the console? >> bash[28883]: KDGKBLED: Inappropriate ioctl for device >> bash[28883]: Error reading current flags setting. Maybe you are not on >> the console?
>> bash[28887]: KDGKBLED: Inappropriate ioctl for device >> bash[28887]: Error reading current flags setting. Maybe you are not on >> the console? After I tried to switch back to setleds +num, in numlock.conf , without rebooting, I got into errors too. >> > % cat /etc/systemd/system/getty@.service.d/activate-numlock.conf > [Service] > ExecStartPre=/bin/sh -c 'setleds +num < /dev/%I' But this ^ solved it, thanks for posting it Michael. > > > That works here to turn numlock on (source ArchLinux wiki) >