Bug 1234155 - lircmd starts from command line but not from systemd
Summary: lircmd starts from command line but not from systemd
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: lirc
Version: 22
Hardware: x86_64
OS: Linux
high
unspecified
Target Milestone: ---
Assignee: Alec Leamas
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-06-21 18:46 UTC by Mark Mayfield
Modified: 2015-06-30 13:47 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-06-28 16:30:13 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Mark Mayfield 2015-06-21 18:46:59 UTC
Description of problem:

lircd starts, lircmd works and is configured properly
enabled lircmd via systemd - systemctl enable lircmd.service
lircd starts at boot
lircmd fails at boot
starting with systemctl start lircmd.service fails - no error but lircmd not running
starting from command prompt with lircmd -u - works fine


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Using driver usbx and /dev/ttyUSB0
2. Configure lircd and lircmd
3. Attempt to use lircmd with systemd fails

Actual results:

Failure

Expected results:

Works

Additional info:

Using oddball of IR device. Uses ftdi_sio kernel driver and usbx lirc driver
Had problems in past with lircd that were SELINUX related but I have tried with SELINUX in permissive. No avc's in audit log

Again it works fine launched from command prompt. Does not work at all from systemd. Opened bug under systemd which was autoclosed as not a systemd problem.

Bug 1231503

Comment 1 Alec Leamas 2015-06-23 12:22:25 UTC
Hm... odd, as they say.

We need better understand what the problem is. What does "journalctl -b 0 /usr/sbin/lircmd" say?

Comment 2 Mark Mayfield 2015-06-24 02:45:07 UTC
when started from cli lots of 

Jun 23 20:00:06 localhost.localdomain lircd-0.9.2a[31363]: "lircmd.c":395: Bad file descriptor
Jun 23 20:00:06 localhost.localdomain lircd-0.9.2a[31363]: "lircmd.c":395: Bad file descriptor
Jun 23 20:00:06 localhost.localdomain lircd-0.9.2a[31363]: "lircmd.c":395: Bad file descriptor
Jun 23 20:00:06 localhost.localdomain lircd-0.9.2a[31363]: "lircmd.c":395: Bad file descriptor
Jun 23 20:00:06 localhost.localdomain lircd-0.9.2a[31363]: "lircmd.c":395: Bad file descriptor

after trying to start with systemd

No additional ouput

Comment 3 Alec Leamas 2015-06-24 07:16:58 UTC
There should be more in the logs... What about the "systemctl status -l lircmd.service" output after starting lircmd.service?

Comment 4 Alec Leamas 2015-06-24 07:38:13 UTC
Looking at the lircmd code I filed https://sourceforge.net/p/lirc/tickets/104.

Comment 5 Mark Mayfield 2015-06-27 04:53:48 UTC
after starting with service disabled

● lircmd.service - LIRC Infrared Mouse Event Signal Decoder
   Loaded: loaded (/usr/lib/systemd/system/lircmd.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

Jun 26 23:51:46 localhost.localdomain systemd[1]: Started LIRC Infrared Mouse Event Signal Decoder.

after starting with service enabled


● lircmd.service - LIRC Infrared Mouse Event Signal Decoder
   Loaded: loaded (/usr/lib/systemd/system/lircmd.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Fri 2015-06-26 23:52:29 CDT; 2s ago
  Process: 21817 ExecStart=/usr/sbin/lircmd -u (code=exited, status=0/SUCCESS)
 Main PID: 21817 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/lircmd.service

Jun 26 23:52:29 localhost.localdomain systemd[1]: Started LIRC Infrared Mouse Event Signal Decoder.

Comment 6 Alec Leamas 2015-06-27 06:55:23 UTC
You have modified the lircmd.service file, right? Either by editing /lib/systemd/system/lircmd.service (bad way) or adding a /etc/systemd/system/lircmd.service file (the good way)?

The problem seems to be that lircmd misses the --nodaemon argument. This is present in the original lircmd.service file, but seems absent in the options used by systemd here. It's needed, because lircmd runs as a "Type=simple" kind of service which is not supposed to fork. However, without --nodaemon lircmd forks a child and exits. 

Not really sure what systemd does with the child process in this situation. But overall, this seems like a systemd configuration error (?)

If you cannot get things running using this input, please post the lircmd.service file used.

Comment 7 Mark Mayfield 2015-06-27 13:01:08 UTC
I edited sudo vim /etc/systemd/system/multi-user.target.wants/lircmd.service 
when the service was enabled. But only because the service was not working. I had removed the nodaemon trying to get it running. I changed back and --nodaemon is the only option passed to lircmd. This works from the command line with sudo lircmd --nodaemon, but the service still doesn't work through systemd.

These are the contents of my current lircmd.service file

[Unit]
Description=LIRC Infrared Mouse Event Signal Decoder
After=network.target

[Service]
Type=simple
ExecStart=/usr/sbin/lircmd --nodaemon

[Install]
WantedBy=multi-user.target

The output of sudo systemctl status -l lircmd.service after systemctl start lircmd.service


● lircmd.service - LIRC Infrared Mouse Event Signal Decoder
   Loaded: loaded (/usr/lib/systemd/system/lircmd.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Sat 2015-06-27 07:56:04 CDT; 1min 1s ago
  Process: 27758 ExecStart=/usr/sbin/lircmd --nodaemon (code=exited, status=0/SUCCESS)
 Main PID: 27758 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/lircmd.service

Jun 27 07:56:04 localhost.localdomain systemd[1]: Started LIRC Infrared Mouse Event Signal Decoder.

Comment 8 Mark Mayfield 2015-06-27 13:17:57 UTC
Spotted another change I made trying to make it work. I recreated the service file from a fresh lirc install on another system. Contents:

[Unit]
Description=LIRC Infrared Mouse Event Signal Decoder
Wants=lircd.socket

[Service]
Type=simple
ExecStart=/usr/sbin/lircmd  --nodaemon

[Install]
WantedBy=multi-user.target



issue persists

Comment 9 Alec Leamas 2015-06-27 13:41:50 UTC
found it. It's a bug in the option parsing code around line 783 in lircmd.cpp. It sets the "lircd:nodaemon" insread of "lircmd:nodaemon" and so on. Most likely a copy-paste error. Stay tuned, a patch is under way (although it can take some time).

Comment 10 Alec Leamas 2015-06-28 16:30:13 UTC
Fixed upstream in https://sourceforge.net/p/lirc/git/ci/5e494bf49825177c.

Can you rebuild lirc using the instructions in CONTRIBUTE.md? I'm about to have summer holidays, not sure if I can land new rpms before that.

Comment 11 Alec Leamas 2015-06-30 13:47:17 UTC
hm... I have managed to make a provisionary upstream release 0.9.3pre1. There are test rpms available at https://copr.fedoraproject.org/coprs/leamas/lirc-0.9.3preview. Using these, your problem should be fixed.

If problem persists, please report upstream at https://sourceforge.net/projects/lirc/


Note You need to log in before you can comment on or make changes to this bug.