Make LIRC work in Ubuntu 18.04, so that you can use your infrared remote in Kodi

remote.png

(This article has been slightly edited as of August 2020, to add additional comments regarding Ubuntu 20.04)

If you are a Kodi user and have recently tried to upgrade your system to Ubuntu 18.04, and then tried to install and use LIRC to make your infrared remote control work the way it should, you may have discovered that it doesn’t work. For one thing, you don’t get the configuration menu during the install process, so you can’t select your make and model of remote. Even the old standby of using sudo dpkg-reconfigure lirc to bring up the configuration menu doesn’t work anymore.

Chances are you searched the web for an answer, but perhaps you never found anything that would make your remote work as smoothly as it used to in past versions of Ubuntu. Even if you got the remote to work in Kodi, you probably got double button presses or a lack of response to button presses on some buttons at random times, and maybe certain buttons would not work at all. We have heard of Kodi users giving up and going back to Ubuntu 16.04 because of this issue!

It turns out that the issue may not be with Ubuntu OR Kodi.  It appears the problem is that the Ubuntu 18.04 and later repositories contain a newer version of LIRC, that just doesn’t work properly.  We found that going back to an old version, specifically LIRC 0.9.0, is the answer – install that, and you do get a version of LIRC that works in Ubuntu 18.04 and that makes your remote work smooth as silk in Kodi.  Well, at least it did for ours, which is a standard Windows MCE compatible remote similar to the one pictured above.

So how do you do that?  Well, as the title of this blog implies, we are two “sort of” tech guys, and one thing we are not is Linux experts.  So, we took an approach that is relatively easy and that works, even if it may not be the “most correct” way to do it.  Here’s the procedure we used:

First, remove any existing installs of ir-keytable and/or lirc – from Linux command line do:

sudo apt purge ir-keytable lirc

Also, if you have added any other software in an attempt to get the remote to work, you probably should remove that as well.

Next, we’re going to temporarily edit /etc/apt/sources.list – we will use nano, but feel free to use vi or vim if that’s your thing:

sudo nano /etc/apt/sources.list

Add this line at the bottom of the /etc/apt/sources.list file:

deb http://ca.archive.ubuntu.com/ubuntu/ xenial universe

Use Ctrl-X to exit nano; be sure to save the file (unless you made a mistake, then just exit without saving and start over).

Then, from the Linux command line:

sudo apt update
sudo apt install lirc/xenial

You should see it install lirc and a few dependencies.  Somewhere in the process you should see “Setting up lirc (0.9.0-0ubuntu6) …” and also you should get the configuration screen, from which you can pick the type of infrared remote you use (such as “Windows Media Center Transceivers/Remotes (all)”, which is down near the bottom of the list).

lirc configuration screenClick on the image to enlarge

Note that if you are using a more recent version of Ubuntu such as 20.04 you may see an error message during this process that looks similar to this:

ls: cannot access ‘/lib/modules/5.4.0-42-generic/kernel/drivers/staging/media/lirc’: No such file or directory

But, that does not necessarily mean the installation has failed. If you get to the configuration screen, you are probably okay.

After that is finished, do this so Ubuntu won’t try to upgrade lirc to the newer bad version:

sudo apt-mark hold lirc

Now that lirc is installed, you need to go back and remove the line you just added to /etc/apt/sources.list:

sudo nano /etc/apt/sources.list

Scroll down to the bottom of the file and put the cursor at the start of this line and press Ctrl-K to delete it:

deb http://ca.archive.ubuntu.com/ubuntu/ xenial universe

As before use Ctrl-X to exit nano, and be sure to save the file.

Now from the command line you should immediately do this so that your system doesn’t inadvertently try to get any other packages from the xenial universe repository:

sudo apt update

And that’s it!  What we have done here is to temporarily enable the Ubuntu 16.04 (xenial) universe repository, where a copy of lirc 0.9.0 is available, and then we installed it using the apt command.

If lirc does not appear to be working, first try rebooting the system, and if that doesn’t work make sure that your system doesn’t have more than one infrared receiver. For example, if you are using a USB connected IR receiver, and your computer also has an IR receiver built in or even just has the circuitry for such a receiver, that can stop lirc from working because it may be trying to get input from the wrong device. You may need to disable the built in one in the system’s BIOS settings, or you may need to blacklist it in the /etc/modprobe.d/blacklist.conf file.  We had to add the line

blacklist ite_cir

to the /etc/modprobe.d/blacklist.conf file on one system to make lirc work correctly.  You may be able to find out if there is more than one IR receiver by running this command:

cat /proc/bus/input/devices

Note that this will show more than just the IR receivers, and may or may not show the driver name to blacklist.  If you do have a built in IR receiver that you can’t disable in the BIOS, there’s a good chance that blacklisting the ite_cir driver will work, but if not you may have to do a little online searching to find the correct driver name to use in the blacklist line.

If you plan to use lirc to control anything other than Kodi that requires the use of a .lircrc file in your home directory, don’t forget to create that file (or move it from a backup of your previous installation if you are upgrading, along with any scripts that are referenced within .lircrc) and also don’t forget that you need to run irexec -d before the .lircrc file will be recognized. If you want irexec to launch when Ubuntu is booted up, you can go to the Startup Applications app and then click the Add button, and fill in the three text fields like this:

Name: irexec
Command: irexec -d
Comment: (whatever you like, or leave blank)

We do realize that there may be alternative ways to install this particular version of lirc, such as downloading the lirc package from the xenial repository (the amd64 version is here) and then installing it using dpkg, but we’d be a little concerned that doing it that way either might not bring in the necessary dependencies, or might not show the configuration menu.  But, feel free to try doing it that way if you’re much more conversant with Linux than we are.

We hope this helps others who have struggled to get their infrared remote working with Kodi in Ubuntu 18.04! We’ve also now tested this with one installation of Ubuntu 20.04, and at least as of August 2020 it worked for us. We hope it works for you as well.

If you liked this article, you may also want to read our followup article: Extending the remote control capabilities of LIRC.

29 thoughts on “Make LIRC work in Ubuntu 18.04, so that you can use your infrared remote in Kodi

  1. mike stikkelorum

    time to leave a message!

    can’t thank you enough, this issue has plagued me for months, fiddling with Lirc and ir-keytable, creating custom buttons for my harmony-one, drove me crazy…

    Life sucks without a proper working remote 😛

    i salute you

    MikeY

    Like

  2. Roland

    Thank you guys!!

    i fiddled nearly a month around with this Problem! now just fixed and everything work as well as with 16.04!
    Thank you so much!

    Like

  3. FMc

    I upgraded my PC from 16.04.1 LTS to 18.04.1 LTS running Kodi. My MCE Remote Control stopped working and this article solved the problem immediately. Thanks!

    Like

  4. Дмитрий Седьмой

    I have not configuration dialog during installation process, so I doing it later via
    dpkg-reconfigure lirc
    And running at this time Kodi don’t work with remote, so I simply reboot the PC and it works!
    Good post, thank you!

    Liked by 1 person

  5. Cam

    Saved my bacon guys. I installed LMDE 3 and was tearing my hair out after a week of internet forums before finding your amazing article. The ubuntu package installed perfectly on a fresh un-updated install of lmde 3 and now my house has shared media again.
    Thank You for taking the time to write this down for others.

    Like

  6. Lawrence

    I can’t thank you enough for making my day!!!! Thanks!

    I have spent weeks looking for a solution and tried several “tutorials” on how to make my mce remote work with Kodi on Linux Mint 19. And your instructions simply worked! Thank you!!!!

    Like

  7. JF

    Again, your solution worked for another person. me!

    Thanks a lot. Also learned a bit more about features of apt and specific versions installations along the way.

    Like

  8. tomonoak

    Thank you, thank you! I could never get LIRC to work after upgrading to 18.04, even compiling from source rather than installing from the repository. I can confirm this fix works on 18.10. I wonder what will happen with 19.04?

    Like

  9. defec

    Thanks for the writeup. I can’t get my serial blaster to work with it. I need my box to transmit. Maybe due to not being to install the modules for it. If anyone else had any like please let us know how you did it.

    Like

  10. szafiro

    They have change driver module name from Lirc_serial to serial_ir.

    If you don’t have /dev/lirc0 you need to change hardware.conf file

    from
    REMOTE_MODULES=”lirc_dev lirc_serial”

    to
    REMOTE_MODULES =”lirc_dev serial_ir”

    Like

  11. mubin

    sudo apt install lirc/xenial
    This didn’t work for me I wrote sudo apt install lirc/oldstable and it was able to install old version of lirc. However I can not run configuration window. How?

    Like

  12. eddictnl

    anyone get this working with 20.04 LTS ?

    the the configuration screen did not show up after “sudo apt install lirc/xenial” command so manually executed “sudo dpkg-reconfigure lirc”. then selecting “Windows Media Center Transceivers/Remotes (all)” and “None” i get below error:

    ls: cannot access ‘/lib/modules/5.4.0-28-generic/kernel/drivers/staging/media/lirc’: No such file or directory

    Like

    1. Just out of curiosity, did you make sure there were no other versions of LIRC on the system? We looked on our 18.04 LTS installs and that file or directory doesn’t exist there either.

      We’ve been afraid this method might not work in 20.04; but since neither of us are true penguin heads we really can’t say what needs to be done to make it work. We’ve seen some posts where users have said that this method does still work for them with 20.04, so can’t say why some are having success and others aren’t. It may be that it uses one or more dependencies that need to be installed. Still, the error you got is kind of a weird one and other than it possibly coming from a different version of LIRC, we don’t know why you’re seeing it.

      (If there are any true penguin heads reading this, please feel free to jump in and give us a hand with this. But please keep in mind that the reason some of us really want LIRC to work is because it lets you control several different programs and even do system tasks if you set up a proper configuration file. Many of the more recent “solutions” offered to Kodi users ONLY work inside Kodi; you can’t even use them to launch Kodi from the desktop.)

      Like

      1. eddictnl

        sorry for the late reply.
        no i cannot imagine another lirc version, cause it tried this on a fresh 20.04 install.
        just curious, have you tried it yourself by now already on 20.04?
        (btw, i am fine if it only works inside Kodi, that’s all i need)
        Eddict

        Like

      2. Yes, we have tried it in 20.04 and it works for us. Maybe you need to do a clean reinstall of Ubuntu 20.04 and Kodi and start from scratch. If you have tried that then we have no idea why you are still having problems.

        Like

  13. kleinbottle

    Finally got LIRC to work to Linux Mint 20

    My setup: MCE usb remote using the devinput driver

    Lirc in Mint 20 is almost completely configured to work out of the box without you having to do anything.You only need to alter one thing and that is move your .lircrc file (a dot file traditionally located in your home directory) to it’s now new default location in the /.config folder BUT REMOVING THE DOT (i.e:it’s absolute filename now becomes /.config/lircrc

    Some other observations:

    1.When you run irw the driver will be shown as devinput-32 rather than devinput but that’s of no consequence.

    (The irw utility allows you to see a mapping of the keycode (in hex form) to the button’s lirc name,e.g 000000008001006c 00 KEY_DOWN devinput-32.The KEY_DOWN here is the lirc name defined in devinput.lircd.conf as mapped from it’s numerical keycode)

    2.The default configuration file for ircat is now /.config/lircrc rather than /.lircrc
    If you don’t remember to put your lircrc file in the now location at /.config you will just see a blank output when you use ircat.

    3.If you want to see what rc-keymap table has been loaded by the kernel run “sudo ir-keytable -r” (without quotes) It displays the mapping of the IR scancodes to the linux input layer keycodes (both in their human and numerical forms in hex) e.g scancode 0x800f041f = KEY_DOWN (0x6c).The keymap is located in the /lib/udev/rc_keymaps folder.The Linux keycodes are themselves defined in /usr/include/linux/input-event-codes
    Top

    Like

  14. Dan

    This has helped me a great deal. I used your instructions successfully when I installed 18.04, and when i upgraded today to 20.04 I found LIRC broken once again! . Back to your site, and back to LIRC 0.9.0 from Xenial and I’m up and running with MythTV again.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.