public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] trying to turn numlock automatically in my ttys under systemd
@ 2014-06-20  9:06 covici
  2014-06-20 15:06 ` Canek Peláez Valdés
  0 siblings, 1 reply; 11+ messages in thread
From: covici @ 2014-06-20  9:06 UTC (permalink / raw
  To: gentoo-user

Hi.  I want to turn numlock automatically, but I am using systemd and I
am having troubles doing this.  At someones suggestion in a previous
message (I think Canek's) I created
/etc/systemd/system/getty@service.d/numlock.conf with the following
contents

[Service]
ExecStartPost=/usr/bin/setleds -D -num </dev/%I


However, setleds dies with the following error:
Jun 19 14:24:55 ccs.covici.com setleds[4878]: KDGKBLED: Inappropriate
ioctl for device
Jun 19 14:24:55 ccs.covici.com setleds[4878]: Error reading current
flags setting. Maybe you are not on the console?

I tried to fool with chvt to make the console current, but no joy there.

Any assistance would be appreciated.

-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

         John Covici
         covici@ccs.covici.com


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-user] trying to turn numlock automatically in my ttys under systemd
  2014-06-20  9:06 [gentoo-user] trying to turn numlock automatically in my ttys under systemd covici
@ 2014-06-20 15:06 ` Canek Peláez Valdés
  2014-06-20 16:40   ` Jc García
  2014-06-20 16:53   ` covici
  0 siblings, 2 replies; 11+ messages in thread
From: Canek Peláez Valdés @ 2014-06-20 15:06 UTC (permalink / raw
  To: gentoo-user

On Fri, Jun 20, 2014 at 4:06 AM,  <covici@ccs.covici.com> wrote:
> Hi.  I want to turn numlock automatically, but I am using systemd and I
> am having troubles doing this.  At someones suggestion in a previous
> message (I think Canek's) I created
> /etc/systemd/system/getty@service.d/numlock.conf with the following
> contents
>
> [Service]
> ExecStartPost=/usr/bin/setleds -D -num </dev/%I
>
>
> However, setleds dies with the following error:
> Jun 19 14:24:55 ccs.covici.com setleds[4878]: KDGKBLED: Inappropriate
> ioctl for device
> Jun 19 14:24:55 ccs.covici.com setleds[4878]: Error reading current
> flags setting. Maybe you are not on the console?
>
> I tried to fool with chvt to make the console current, but no joy there.
>
> Any assistance would be appreciated.

Could you post the exact invocation for setleds? It should be on the
logs. I think the invocation for setleds shuld be:

/usr/bin/setleds -D +num < /dev/%i

The difference between %I (capital "i") and %i is only that %i escapes
special symbols, but since it's only the string tty[1-N], I don't
think it matters much.

The exact invocation of setleds matters, so we can see if the template
unit is generating the correct one.

Regards.
-- 
Canek Peláez Valdés
Profesor de asignatura, Facultad de Ciencias
Universidad Nacional Autónoma de México


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-user] trying to turn numlock automatically in my ttys under systemd
  2014-06-20 15:06 ` Canek Peláez Valdés
@ 2014-06-20 16:40   ` Jc García
  2014-06-20 17:08     ` Canek Peláez Valdés
  2014-06-20 16:53   ` covici
  1 sibling, 1 reply; 11+ messages in thread
From: Jc García @ 2014-06-20 16:40 UTC (permalink / raw
  To: gentoo-user

2014-06-20 9:06 GMT-06:00 Canek Peláez Valdés <caneko@gmail.com>:
> On Fri, Jun 20, 2014 at 4:06 AM,  <covici@ccs.covici.com> wrote:
>> Hi.  I want to turn numlock automatically, but I am using systemd and I
>> am having troubles doing this.  At someones suggestion in a previous
>> message (I think Canek's) I created
>> /etc/systemd/system/getty@service.d/numlock.conf with the following
>> contents
>>
>> [Service]
>> ExecStartPost=/usr/bin/setleds -D -num </dev/%I
>>
>>
>> However, setleds dies with the following error:
>> Jun 19 14:24:55 ccs.covici.com setleds[4878]: KDGKBLED: Inappropriate
>> ioctl for device
>> Jun 19 14:24:55 ccs.covici.com setleds[4878]: Error reading current
>> flags setting. Maybe you are not on the console?
>>
>> I tried to fool with chvt to make the console current, but no joy there.
>>
>> Any assistance would be appreciated.
>

This has called my attention as it would be nice to activate numlock
by default on console(altought not that important for me anyway )

> Could you post the exact invocation for setleds? It should be on the
> logs. I think the invocation for setleds shuld be:
>
> /usr/bin/setleds -D +num < /dev/%i
>
I have tried this but after skimming trough the manpage
systemd.service(5), I've found this command will not work, as a
parameter for any of ExecStart* since redirection and pipes(these are
mentioned << < | > >> ) are not supported.
 I'd like to mention also that not executing setleds as follows, with
'-' before the binary path :

ExecStartPost=-/usr/bin/setleds -D -num </dev/%i

breaks the start of the whole getty service, making it unable to login
in into any console
The way to work around this recommended in the manual is instead
invoking a shell and make it run the commands:

ExecStartPost=-/bin/sh -c 'setleds -D +num < /dev/%i'

This worked pretty well and can be tested without reboot, on tty8 for example :
- edit files
- run  sudo systemctl daemon-reload
- run systemctl start getty\@tty8.service
Ctrl+Alt+F8 and see what happened .

> The difference between %I (capital "i") and %i is only that %i escapes
> special symbols, but since it's only the string tty[1-N], I don't
> think it matters much.
>
> The exact invocation of setleds matters, so we can see if the template
> unit is generating the correct one.
>
I leave my 'systemctl stauts -l getty@tty1.service' output just for
completness of reference of what errors where shown:

● 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 10:11:57 CST; 8s ago
     Docs: man:agetty(8)
           man:systemd-getty-generator(8)
           http://0pointer.de/blog/projects/serial-console.html
  Process: 6384 ExecStartPost=/usr/bin/setleds -D +num < /dev/%i
(code=exited, status=1/FAILURE)
 Main PID: 6383 (agetty)
   CGroup: /system.slice/system-getty.slice/getty@tty1.service
           └─6383 /sbin/agetty --noclear tty1 linux

jun 20 10:11:57 jdesk systemd[1]: Started Getty on tty1.
jun 20 10:11:57 jdesk setleds[6384]: KDGKBLED: Inappropriate ioctl for device
jun 20 10:11:57 jdesk setleds[6384]: Error reading current flags
setting. Maybe you are not on the console?


> Regards.
> --
> Canek Peláez Valdés
> Profesor de asignatura, Facultad de Ciencias
> Universidad Nacional Autónoma de México
>

I hope this would help, have a nice day.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-user] trying to turn numlock automatically in my ttys under systemd
  2014-06-20 15:06 ` Canek Peláez Valdés
  2014-06-20 16:40   ` Jc García
@ 2014-06-20 16:53   ` covici
  2014-06-20 17:01     ` Jc García
  1 sibling, 1 reply; 11+ messages in thread
From: covici @ 2014-06-20 16:53 UTC (permalink / raw
  To: gentoo-user

Canek Peláez Valdés <caneko@gmail.com> wrote:

> On Fri, Jun 20, 2014 at 4:06 AM,  <covici@ccs.covici.com> wrote:
> > Hi.  I want to turn numlock automatically, but I am using systemd and I
> > am having troubles doing this.  At someones suggestion in a previous
> > message (I think Canek's) I created
> > /etc/systemd/system/getty@service.d/numlock.conf with the following
> > contents
> >
> > [Service]
> > ExecStartPost=/usr/bin/setleds -D -num </dev/%I
> >
> >
> > However, setleds dies with the following error:
> > Jun 19 14:24:55 ccs.covici.com setleds[4878]: KDGKBLED: Inappropriate
> > ioctl for device
> > Jun 19 14:24:55 ccs.covici.com setleds[4878]: Error reading current
> > flags setting. Maybe you are not on the console?
> >
> > I tried to fool with chvt to make the console current, but no joy there.
> >
> > Any assistance would be appreciated.
> 
> Could you post the exact invocation for setleds? It should be on the
> logs. I think the invocation for setleds shuld be:
> 
> /usr/bin/setleds -D +num < /dev/%i
> 
> The difference between %I (capital "i") and %i is only that %i escapes
> special symbols, but since it's only the string tty[1-N], I don't
> think it matters much.
> 
> The exact invocation of setleds matters, so we can see if the template
> unit is generating the correct one.

Thanks for your response,  First of all I want -num and not +num, but
that does not make any difference.  I am using your unit from
/usr/lib/systemd/system/getty@.service and add the following in the
.conf file
[Service]
ExecStartPost=/usr/bin/setleds -D -num </dev/%I
The invocation is not in the logs, all I get is the following:
Jun 19 14:26:26 ccs.covici.com systemd[1]: Started Getty on tty8.
Jun 19 14:26:26 ccs.covici.com setleds[5100]: KDGKBLED: Inappropriate
ioctl for device
Jun 19 14:26:26 ccs.covici.com setleds[5100]: Error reading current
flags setting. Maybe you are not on the console?
Jun 19 14:26:26 ccs.covici.com systemd[1]: getty@tty8.service: control
process exited, code=exited status=1
Jun 19 14:26:26 ccs.covici.com systemd[1]: Unit getty@tty8.service
entered failed state.

But I know that %I is tty8 or whatever the device is.  I checked with a
shell script to make sure.



-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

         John Covici
         covici@ccs.covici.com


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-user] trying to turn numlock automatically in my ttys under systemd
  2014-06-20 16:53   ` covici
@ 2014-06-20 17:01     ` Jc García
  2014-06-20 17:26       ` covici
  0 siblings, 1 reply; 11+ messages in thread
From: Jc García @ 2014-06-20 17:01 UTC (permalink / raw
  To: gentoo-user

2014-06-20 10:53 GMT-06:00  <covici@ccs.covici.com>:
> Canek Peláez Valdés <caneko@gmail.com> wrote:
>
>> On Fri, Jun 20, 2014 at 4:06 AM,  <covici@ccs.covici.com> wrote:
>> > Hi.  I want to turn numlock automatically, but I am using systemd and I
>> > am having troubles doing this.  At someones suggestion in a previous
>> > message (I think Canek's) I created
>> > /etc/systemd/system/getty@service.d/numlock.conf with the following
>> > contents
>> >
>> > [Service]
>> > ExecStartPost=/usr/bin/setleds -D -num </dev/%I
>> >
>> >
>> > However, setleds dies with the following error:
>> > Jun 19 14:24:55 ccs.covici.com setleds[4878]: KDGKBLED: Inappropriate
>> > ioctl for device
>> > Jun 19 14:24:55 ccs.covici.com setleds[4878]: Error reading current
>> > flags setting. Maybe you are not on the console?
>> >
>> > I tried to fool with chvt to make the console current, but no joy there.
>> >
>> > Any assistance would be appreciated.
>>
>> Could you post the exact invocation for setleds? It should be on the
>> logs. I think the invocation for setleds shuld be:
>>
>> /usr/bin/setleds -D +num < /dev/%i
>>
>> The difference between %I (capital "i") and %i is only that %i escapes
>> special symbols, but since it's only the string tty[1-N], I don't
>> think it matters much.
>>
>> The exact invocation of setleds matters, so we can see if the template
>> unit is generating the correct one.
>
> Thanks for your response,  First of all I want -num and not +num, but
> that does not make any difference.  I am using your unit from
> /usr/lib/systemd/system/getty@.service and add the following in the
> .conf file
> [Service]
> ExecStartPost=/usr/bin/setleds -D -num </dev/%I

Check my post above, I found the issue with running this  command , I
wanted '+num' so thats the only diference.

> The invocation is not in the logs, all I get is the following:
> Jun 19 14:26:26 ccs.covici.com systemd[1]: Started Getty on tty8.
> Jun 19 14:26:26 ccs.covici.com setleds[5100]: KDGKBLED: Inappropriate
> ioctl for device
> Jun 19 14:26:26 ccs.covici.com setleds[5100]: Error reading current
> flags setting. Maybe you are not on the console?
> Jun 19 14:26:26 ccs.covici.com systemd[1]: getty@tty8.service: control
> process exited, code=exited status=1
> Jun 19 14:26:26 ccs.covici.com systemd[1]: Unit getty@tty8.service
> entered failed state.
>
> But I know that %I is tty8 or whatever the device is.  I checked with a
> shell script to make sure.
>
>
>
> --
> Your life is like a penny.  You're going to lose it.  The question is:
> How do
> you spend it?
>
>          John Covici
>          covici@ccs.covici.com
>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-user] trying to turn numlock automatically in my ttys under systemd
  2014-06-20 16:40   ` Jc García
@ 2014-06-20 17:08     ` Canek Peláez Valdés
  0 siblings, 0 replies; 11+ messages in thread
From: Canek Peláez Valdés @ 2014-06-20 17:08 UTC (permalink / raw
  To: gentoo-user

On Fri, Jun 20, 2014 at 11:40 AM, Jc García <jyo.garcia@gmail.com> wrote:
> 2014-06-20 9:06 GMT-06:00 Canek Peláez Valdés <caneko@gmail.com>:
>> On Fri, Jun 20, 2014 at 4:06 AM,  <covici@ccs.covici.com> wrote:
>>> Hi.  I want to turn numlock automatically, but I am using systemd and I
>>> am having troubles doing this.  At someones suggestion in a previous
>>> message (I think Canek's) I created
>>> /etc/systemd/system/getty@service.d/numlock.conf with the following
>>> contents
>>>
>>> [Service]
>>> ExecStartPost=/usr/bin/setleds -D -num </dev/%I
>>>
>>>
>>> However, setleds dies with the following error:
>>> Jun 19 14:24:55 ccs.covici.com setleds[4878]: KDGKBLED: Inappropriate
>>> ioctl for device
>>> Jun 19 14:24:55 ccs.covici.com setleds[4878]: Error reading current
>>> flags setting. Maybe you are not on the console?
>>>
>>> I tried to fool with chvt to make the console current, but no joy there.
>>>
>>> Any assistance would be appreciated.
>>
>
> This has called my attention as it would be nice to activate numlock
> by default on console(altought not that important for me anyway )
>
>> Could you post the exact invocation for setleds? It should be on the
>> logs. I think the invocation for setleds shuld be:
>>
>> /usr/bin/setleds -D +num < /dev/%i
>>
> I have tried this but after skimming trough the manpage
> systemd.service(5), I've found this command will not work, as a
> parameter for any of ExecStart* since redirection and pipes(these are
> mentioned << < | > >> ) are not supported.
>  I'd like to mention also that not executing setleds as follows, with
> '-' before the binary path :
>
> ExecStartPost=-/usr/bin/setleds -D -num </dev/%i
>
> breaks the start of the whole getty service, making it unable to login
> in into any console
> The way to work around this recommended in the manual is instead
> invoking a shell and make it run the commands:
>
> ExecStartPost=-/bin/sh -c 'setleds -D +num < /dev/%i'

You are completely right; I had forgotten about redirection in Exec* directives.

Regards.
-- 
Canek Peláez Valdés
Profesor de asignatura, Facultad de Ciencias
Universidad Nacional Autónoma de México


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-user] trying to turn numlock automatically in my ttys under systemd
  2014-06-20 17:01     ` Jc García
@ 2014-06-20 17:26       ` covici
  2014-06-20 18:43         ` Jc García
  0 siblings, 1 reply; 11+ messages in thread
From: covici @ 2014-06-20 17:26 UTC (permalink / raw
  To: gentoo-user

Jc García <jyo.garcia@gmail.com> wrote:

> 2014-06-20 10:53 GMT-06:00  <covici@ccs.covici.com>:
> > Canek Peláez Valdés <caneko@gmail.com> wrote:
> >
> >> On Fri, Jun 20, 2014 at 4:06 AM,  <covici@ccs.covici.com> wrote:
> >> > Hi.  I want to turn numlock automatically, but I am using systemd and I
> >> > am having troubles doing this.  At someones suggestion in a previous
> >> > message (I think Canek's) I created
> >> > /etc/systemd/system/getty@service.d/numlock.conf with the following
> >> > contents
> >> >
> >> > [Service]
> >> > ExecStartPost=/usr/bin/setleds -D -num </dev/%I
> >> >
> >> >
> >> > However, setleds dies with the following error:
> >> > Jun 19 14:24:55 ccs.covici.com setleds[4878]: KDGKBLED: Inappropriate
> >> > ioctl for device
> >> > Jun 19 14:24:55 ccs.covici.com setleds[4878]: Error reading current
> >> > flags setting. Maybe you are not on the console?
> >> >
> >> > I tried to fool with chvt to make the console current, but no joy there.
> >> >
> >> > Any assistance would be appreciated.
> >>
> >> Could you post the exact invocation for setleds? It should be on the
> >> logs. I think the invocation for setleds shuld be:
> >>
> >> /usr/bin/setleds -D +num < /dev/%i
> >>
> >> The difference between %I (capital "i") and %i is only that %i escapes
> >> special symbols, but since it's only the string tty[1-N], I don't
> >> think it matters much.
> >>
> >> The exact invocation of setleds matters, so we can see if the template
> >> unit is generating the correct one.
> >
> > Thanks for your response,  First of all I want -num and not +num, but
> > that does not make any difference.  I am using your unit from
> > /usr/lib/systemd/system/getty@.service and add the following in the
> > .conf file
> > [Service]
> > ExecStartPost=/usr/bin/setleds -D -num </dev/%I
> 
> Check my post above, I found the issue with running this  command , I
> wanted '+num' so thats the only diference.
> 
> > The invocation is not in the logs, all I get is the following:
> > Jun 19 14:26:26 ccs.covici.com systemd[1]: Started Getty on tty8.
> > Jun 19 14:26:26 ccs.covici.com setleds[5100]: KDGKBLED: Inappropriate
> > ioctl for device
> > Jun 19 14:26:26 ccs.covici.com setleds[5100]: Error reading current
> > flags setting. Maybe you are not on the console?
> > Jun 19 14:26:26 ccs.covici.com systemd[1]: getty@tty8.service: control
> > process exited, code=exited status=1
> > Jun 19 14:26:26 ccs.covici.com systemd[1]: Unit getty@tty8.service
> > entered failed state.
> >
> > But I know that %I is tty8 or whatever the device is.  I checked with a
> > shell script to make sure.

I tried your idea of a shell script like this 
[Service]
ExecStartPost=/bin/bash -c "setleds -D -num </dev/%I"
But it did not work, it kept restarting and systemd eventually refused
to start.  When I commented out the line, it started OK.


-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

         John Covici
         covici@ccs.covici.com


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-user] trying to turn numlock automatically in my ttys under systemd
  2014-06-20 17:26       ` covici
@ 2014-06-20 18:43         ` Jc García
  2014-06-20 19:46           ` covici
  0 siblings, 1 reply; 11+ messages in thread
From: Jc García @ 2014-06-20 18:43 UTC (permalink / raw
  To: gentoo-user

2014-06-20 11:26 GMT-06:00  <covici@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.

>
> --
> Your life is like a penny.  You're going to lose it.  The question is:
> How do
> you spend it?
>
>          John Covici
>          covici@ccs.covici.com
>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-user] trying to turn numlock automatically in my ttys under systemd
  2014-06-20 18:43         ` Jc García
@ 2014-06-20 19:46           ` covici
  2014-06-20 19:52             ` Michael Cook
  0 siblings, 1 reply; 11+ messages in thread
From: covici @ 2014-06-20 19:46 UTC (permalink / raw
  To: gentoo-user

Jc García <jyo.garcia@gmail.com> wrote:

> 2014-06-20 11:26 GMT-06:00  <covici@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?

-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

         John Covici
         covici@ccs.covici.com


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-user] trying to turn numlock automatically in my ttys under systemd
  2014-06-20 19:46           ` covici
@ 2014-06-20 19:52             ` Michael Cook
  2014-06-20 20:04               ` Jc García
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Cook @ 2014-06-20 19:52 UTC (permalink / raw
  To: gentoo-user

On 06/20/2014 03:46 PM, covici@ccs.covici.com wrote:
> Jc García <jyo.garcia@gmail.com> wrote:
>
>> 2014-06-20 11:26 GMT-06:00  <covici@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?
>
% cat /etc/systemd/system/getty@.service.d/activate-numlock.conf
[Service]
ExecStartPre=/bin/sh -c 'setleds +num < /dev/%I'


That works here to turn numlock on (source ArchLinux wiki)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-user] trying to turn numlock automatically in my ttys under systemd
  2014-06-20 19:52             ` Michael Cook
@ 2014-06-20 20:04               ` Jc García
  0 siblings, 0 replies; 11+ messages in thread
From: Jc García @ 2014-06-20 20:04 UTC (permalink / raw
  To: gentoo-user

2014-06-20 13:52 GMT-06:00 Michael Cook <mcook@mackal.net>:
> On 06/20/2014 03:46 PM, covici@ccs.covici.com wrote:
>>
>> Jc García <jyo.garcia@gmail.com> wrote:
>>
>>> 2014-06-20 11:26 GMT-06:00  <covici@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)
>


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-06-20 20:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-20  9:06 [gentoo-user] trying to turn numlock automatically in my ttys under systemd covici
2014-06-20 15:06 ` Canek Peláez Valdés
2014-06-20 16:40   ` Jc García
2014-06-20 17:08     ` Canek Peláez Valdés
2014-06-20 16:53   ` covici
2014-06-20 17:01     ` Jc García
2014-06-20 17:26       ` covici
2014-06-20 18:43         ` Jc García
2014-06-20 19:46           ` covici
2014-06-20 19:52             ` Michael Cook
2014-06-20 20:04               ` Jc García

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox