LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   lircd and systemctl on Debian Buster (https://www.linuxquestions.org/questions/debian-26/lircd-and-systemctl-on-debian-buster-4175699937/)

Quakeboy02 08-30-2021 03:13 PM

lircd and systemctl on Debian Buster
 
I took a 4 year sabbatical on a sailboat. I'm back and I've upgraded to Debian Buster and am trying to get mythtv running again. I have everything working properly except for lirc. I can get it to work if I do the following steps manually after a reboot. (By "get it to work" I mean that /usr/bin/irsend is actually sending the command data instead of waiting for the two services to be in an operational state.)

Code:

/usr/bin/systemctl stop lircd.socket lircd.service
/usr/bin/systemctl start lircd.socket lircd.service

I have a "modinit" section in /etc/lirc/lirc_options.conf as follows to do a fixup on /dev/ttyS0 and create /dev/lirc0:
Code:

[modinit]
code = /usr/bin/setserial /dev/ttyS0 uart none
code1 = /usr/sbin/modprobe lirc_dev
code2 = /usr/sbin/modprobe serial_ir

I've tried putting the two systemctl commands in /etc/lirc/lirc_options.conf as follows:

Code:

[modinit]
code = /usr/bin/setserial /dev/ttyS0 uart none
code1 = /usr/sbin/modprobe lirc_dev
code2 = /usr/sbin/modprobe serial_ir
code3 = /usr/bin/systemctl stop lircd.socket lircd.service
code4 = /usr/bin/systemctl start lircd.socket lircd.service

That doesn't work and I have to remove "code3" and "code4" in order to easily stop and start the lircd stuff. So it appears that I am trying to do this in the wrong place during startup. I can't find anything in the documentation that gives me any help. In fact, it took me several days to even determine that stopping and starting the lircd.socket and lircd.service would get lirc working. It's possible that I've got something else wrong and this is just a symptom, but I can't figure out where to go from here. Anyone have any suggestions?

Bob

ondoho 08-31-2021 12:26 PM

Is the service enabled?
How is it being started?
Anything in the logs?

To answer these questions please post the following output:
Code:

systemctl is-enabled lircd.socket lircd.service
systemctl cat lircd.socket lircd.service
systemctl status -n99 lircd.socket lircd.service


Quakeboy02 08-31-2021 09:27 PM

Please See next post.

(mass deletion)

Quakeboy02 08-31-2021 09:43 PM

As a result of seeing that lircd.socket wasn't enabled (probably a side effect of something I tried today) I enabled it, rebooted, and ran the commands again. It didn't fix the problem.

Code:

bob@musem:~$ systemctl is-enabled lircd.socket lircd.service
enabled
enabled

Code:

bob@musem:~$ systemctl cat lircd.socket lircd.service
# /lib/systemd/system/lircd.socket
[Socket]
ListenStream=/run/lirc/lircd

[Install]
WantedBy=sockets.target
Also=lircd.service


# /lib/systemd/system/lircd.service
[Unit]
Documentation=man:lircd(8)
Documentation=http://lirc.org/html/configure.html
Description=Flexible IR remote input/output application support
Wants=lircd-setup.service
After=network.target lircd-setup.service

[Service]
Type=notify
;ExecStartPre=/usr/bin/setserial /dev/ttyS0 uart none
;ExecStartPre=/usr/sbin/modprobe serial_ir
;ExecStartPre=/usr/sbin/modprobe lirc_dev
ExecStart=/usr/sbin/lircd --nodaemon

Code:

bob@musem:~$ systemctl status -n99 lircd.socket lircd.service
● lircd.socket
  Loaded: loaded (/lib/systemd/system/lircd.socket; enabled; vendor preset: ena
  Active: active (running) since Tue 2021-08-31 21:37:14 CDT; 1min 23s ago
  Listen: /run/lirc/lircd (Stream)
  CGroup: /system.slice/lircd.socket

● lircd.service - Flexible IR remote input/output application support
  Loaded: loaded (/lib/systemd/system/lircd.service; enabled; vendor preset: en
  Active: active (running) since Tue 2021-08-31 21:37:15 CDT; 1min 21s ago
    Docs: man:lircd(8)
          http://lirc.org/html/configure.html
 Main PID: 1564 (lircd)
    Tasks: 2 (limit: 4915)
  Memory: 1.1M
  CGroup: /system.slice/lircd.service
          └─1564 /usr/sbin/lircd --nodaemon


Quakeboy02 09-02-2021 10:49 AM

I've fixed this with a hack, as I just didn't know what else to do. Here's the start section of /etc/init.d/mythv-backend. Note the two lines under "#BOB". I figured this was a good place to put it, since the remote control is needed by mythtv. I'm sure there's a better way, but I can't find it.

Code:

case "$1" in
  start)

#BOB
/usr/bin/systemctl stop lircd.socket lircd.service
/usr/bin/systemctl start lircd.socket lircd.service

        if test -e $RUNDIR/$NAME.pid ; then
                echo "mythbackend already running, use restart instead."
        else
                echo -n "Starting $DESC: $NAME "
                start-stop-daemon --start --pidfile $RUNDIR/$NAME.pid \
                        --chuid $USER --nicelevel $NICE --exec $DAEMON -- $ARGS
                echo "."
        fi
        ;;


ondoho 09-02-2021 11:45 AM

It might help to start lircd.service delayed.
Also perform some troubleshooting on lircd-setup.service.

Quakeboy02 09-02-2021 12:35 PM

Quote:

Originally Posted by ondoho (Post 6280845)
It might help to start lircd.service delayed.
Also perform some troubleshooting on lircd-setup.service.

As I learned more about this over the past few days, I looked to see if systemctl started up mythtv-backend. No such luck, so I did it in the init file. But it's probably just a matter of time till mythtv-backend startup is moved to systemctl and it can be put there, or a "Wants" or something a bit more appropriate.

I did look into lircd-setup, but I couldn't find a way to accomplish what I needed. I'll review it in a few months to see if I can think of anything else.

Thanks for the help.

Bob


All times are GMT -5. The time now is 02:59 AM.