Unicorn HAT no longer working after Raspbian upgrade


I have a Unicorn HAT for my Pi 2 which has been working great until today.

I did an apt-get upgrade to get the system up to date, and now every time I try to import unicornhat on Python, I get the following:

pi@unicornpi ~ $ sudo python
Python 2.7.3 (default, Mar 18 2014, 05:13:23) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import unicornhat
Cant open device file /tmp/mailbox-2755: No such device or address
Cant open device file /tmp/mailbox-2755: No such device or address
Cant open device file /tmp/mailbox-2755: No such device or address
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/unicornhat.py", line 13, in <module>
  File "/usr/local/lib/python2.7/dist-packages/neopixel.py", line 107, in begin
    raise RuntimeError('ws2811_init failed with code {0}'.format(resp))
RuntimeError: ws2811_init failed with code -1

Does anyone have any insights into what might be causing this? I’m assuming the upgrade it the issue, however I’ve also tried using a USB audio device recently but I don’t see why that would cause problems.


Edit: To clarify, I upgraded using sudo apt-get update and sudo apt-get upgrade

Looks like there may be some changes in the latest update that breaks the way Unicorn HAT works, I’ll have to look into this tomorrow.

Mostly for my reference, possibly related issues:


Thank you. I didn’t have a great deal set up on that installation so I’m wiping the SD card and doing a clean install of Raspbian 2015-05-05, so that should bring it back to life at least as a temporary solution, though no doubt it’ll break again the second I run update/upgrade.

Hopefully you can find something :)

I’d be interested to know if it does break again the second you update it, although that’s the first thing I’ll be testing. Good luck!

Okay, I’ve verified that this is a problem with the latest Kernel, but it’s a little beyond my expertise so I’ve raised an issue upstream and will monitor how similar libraries cope with this problem. I made a few attempts to fix it, but didn’t get anywhere.


Joan on the Raspberry Pi forums has suggested a potential fix ( https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=117547&p=806826#p806826 ), and it certainly gets Unicorn HAT up and running for me. I’ll have to regression test it against older versions of the Kernel before releasing it, if anyone’s prepared to try it out you can build from source: https://github.com/pimoroni/unicorn-hat

Clone the Unicorn HAT repo, then cd unicorn-hat/python/rpi-ws281x and sudo ./setup.py install

The Unicorn HAT library itself remains the same, only the rpi-ws281x driver has changed.

Hi, thanks for looking into this! I did a fresh install without upgrading as a temporary solution. I’ll try out that method when I get some time to mess around with it again. Hopefully it’s all good.

Hi gadgetoid. Faced the same issue after upgrade Raspberry kernel to 4.1.6-v7. You fix is working. Now i can enjoy my unicorn hat disco lights again. Many thanks!

1 Like

Thanks for the feedback! I’ll have to get the fix promoted to pip- it seems okay!

Just tried the fix and worked for me too. Thanks!

Thanks for the fix; brought my UnicornHat back to life…