Irexec does not work on October 2020 build

I use this on both RPI3 and Vero 4k and it doesn’t work on either. Not sure where to begin with this one as it has always been something of a mystery to me. Anybody else using irexec?

It looks like the daemon is not being started. It looks like the default socket is no longer /var/run/lirc/lircd. I created a variable to define this. Now it starts, but I still can’t get it to do anything. If I push a button that is supposed to trigger it, it creates a new instance of it, but doesn’t do anything. I tried to set the debug log, but it doesn’t write anything to it. It did create an empty file though.

I don’t know where to go from here.

Irexec has not been tested with lirc 0.9.4c as none of the devs have a system with an IR blaster to test with so it is probably not working.

/var/run/lirc/lircd is probably not correct though as that is the output of eventlircd. The output of lircd is /var/run/lirc/lircd-lirc0

These lirc socket paths have not changed.

irexec is not a IR blaster tool. It is a tool to execute an arbitrary command based on an IR input. I use it to execute scripts based on a remote key press.

Fair enough, although using irexec to trigger irsend is a very common use of irexec.

irexec is supposed to connect directly to the lirc socket of lircd.

On OSMC this is /var/run/lirc/lircd-lirc0 but you say you are using /var/run/lirc/lircd. Have you tried using the first one ?

Also, try running irw /var/run/lirc/lircd-lirc0 to make sure that lirc events are being generated for the buttons you’re pressing and that they match your irexec config.

By the way there is nothing in OSMC to automatically start irexec - so I’m not sure what you mean when you say it is no longer starting automatically - you would have had to create your own service in the first place to run it automatically.

By “starting automatically” I mean starting as a daemon at boot by adding the line" ```
/usr/bin/irexec -d /etc/lirc/lircrc" to rc.local. This isn’t working anymore. When I try to do this from the command line, it errors out saying “no such file or directory” I think this means the socket that it is looking at. According to the documentation, this is supposed to be “/var/run/lirrc/lircd”. This may have changed since when I explicitly tell it to look there through setting an environment variable, it will start. It seems to be getting signals from there in that it starts a new instance of irexec, but it stalls there. The action is not executed and the new irexec process never ends. So, if I push a bunch of buttons, it will start a bunch of new instances of irexec that never end.

So, if no one else is using this, I will have to do a lot more work to figure it out. Right now, I don’t have the time, so I am switching back to the 2020-June build. I was hoping that somebody a lot smarter than I am was using this and could help.

Thank you for your explanations. This may help me figure this out eventually.

Had the same issue, after setting socket path to
export LIRC_SOCKET_PATH=/var/run/lirc/lircd
noticed that irexec was running but when action was attempted on receipt of IR signal it failed with something linke “execvp failed”.
Some googling turn up this solution, seems irxec uses /usr/bin/sh to execute scripts, however, when there is no /usr/bin/sh (as on my Rpi) it fails.
This fixes/works around that:
ln -s /bin/bash /usr/bin/sh
Now my irexec is functioning again.

I can build a potential fix for this, if you’re willing to test.

No need for a special build. I can add this to my install instructions. This worked for me.

Unless, of course, you want to build this in. If so, I am happy to test for you.

Hi

Hopefully the issue is now addressed with the following commit:

I’d appreciate it if you could test this and provide feedback before we potentially release this as an update to other users. To test this update:

  1. Login via the command line
  2. Edit the file /etc/apt/sources.list
  3. Add the following line: deb http://apt.osmc.tv buster-devel main
  4. Run the following commands to update: sudo apt-get update && sudo apt-get dist-upgrade && reboot
  5. Your system should have have received the update.

Please see if the issue is resolved.

I also recommend you edit /etc/apt/sources.list again and remove the line that you added after updating. This will return you to the normal update channel.

Yes, this build takes care of that one problem. I still have to explicitly tell irexec what socket to use by using the command:

  • export LIRC_SOCKET_PATH=/var/run/lirc/lircd

Sorry, missed that.

I think for that we might need to add an lirc_options.conf, but I’m worried about making any changes that could break generic receiving functionality.

Do you know which one is used by default?
This might give me some clues in tracking the problem down

Cheers

Sam

The documentation says that /var/run/lirc/lircd is the default, but it doesn’t seem to be working. We have had to explicitly direct irexec to that path by defining the environment variable with:

  • export LIRC_SOCKET_PATH=/var/run/lirc/lircd

I added this line to rc.local just before launching the daemon (also done in rc.local). The daemon launch looks like this:

  • /usr/bin/irexec -d /home/osmc/.kodi/userdata/lircrc

So, what we have done should be the default.

I understand that it is not the default.
Can you let me know what path is being used instead?

Thanks

Sam

I don’t think that you do understand. It is the default (according to the docs). We have to manually point to it anyway.

  • export LIRC_SOCKET_PATH=/var/run/lirc/lircd

OK Maybe I didn’t understand your comment. If it is using another path by default, it is unknown to me. All I know is that it is not looking in the right place.

Okay, I’ll trace the path it’s using tomorrow. I do understand that you are saying that it is not using the expected default path. I had just wondered if you knew which path it happened to be using instead.

osmc@osmc:~$ sudo strace /usr/bin/irexec 2>&1|grep -i lirc
openat(AT_FDCWD, "/lib/liblirc.so.0", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/liblirc_client.so.0", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/usr/var/run/lirc/lircd"}, 110) = -1 ENOENT (No such file or directory)

As you can see, it’s looking for /usr/var/run/lirc/lircd.

The problem with irexec is indeed solved with the following command (still necessary in the current version of osmc):

cd /usr/var/run/lirc/ && sudo ln -s /var/run/lirc/lircd

@sam_nazarko: Maybe you could fix this by simply adding this symbolic link in the next major release ?

And thx a lot for your work !

I’ve kept an eye on this for some time.

But still not sure on the exact solution yet