Setting up Sigrok/Pulseview on Ubuntu

Sigrok is open-source software that can be used with various hardware, such as logic analyzers and oscilloscopes, to ingest and grok signals. It can be a powerful tool if you are interested in better understanding the inner workings of devices and circuits. Still, before you can use it in your projects, you need to get it installed and set up correctly, a process which was not as easy as I hoped it would be, but is also not too difficult if you are equipped with the necessary information, which I was not, but you can be.

The device I am using is a cheap, generic 8ch 24Mhz Logic Analyzer, presumably a Saleae clone, although the lack of branding on the exterior doesn’t give you much to go on.

The logic analyzer

This is a Sparkfun product, and as such, they have a good guide on how to use it with Sigrok, though this guide is made for Windows, and I am running Ubuntu, so there are some key differences. I am not sure what the experience is like on macOS, but this blog post will focus on the gotchas I ran into while getting it up and running on Linux.

The AppImage

The first challenge was getting the program to start at all. As with most software that I’ve installed recently, if there isn’t a Flatpak of it, my second preference is AppImage. Luckily there are Appimage releases of Sigrok and its GUI, Pulseview. Unfortunately, these didn’t work for me. When I would try to launch them, nothing would happen. Executing them from the terminal yielded an error message indicating an issue with libgio2.0. Cursory googling suggested that you could resolve this by extracting the Appimage, deleting the offending library, and then repackaging it, but this sounded like a lot of effort that was tangential to what I was trying to do, so instead, I installed Pulseview from apt like so:

sudo apt install pulseview

This worked, and I was able to open Pulseview.

the software working

Next, following along with the Sparkfun tutorial, I went to the “Connect a Device” screen, searched for my device, and there it was!

the device selector

Clicking “Ok”, I was greeted with a somewhat vague and entirely unhelpful error message:

the error

Next, after reading through some of the official documentation, I realized I had missed a key step. On Linux, for Sigrok to work correctly, you need to install the udev rules for it.

The Udev Rules

The official site indicates that you need to install two separate files - 60-libsigrok.rules and either 61-libsigrok-uaccess.rules or 61-libsigrok-plugdev.rules, with the site noting the following:

The 61-libsigrok-uaccess.rules is typically used on a system using the systemd/logind mechanism to grant access to plugged in devices to the currently active user. 61-libsigrok-plugdev.rules grants access to all users in the plugdev group. The latter may also serve as a template for creating a local, system specific access rule.

The Pulseview documentation makes a note that you need to do this if “... you don’t install the PulseView distro packages (as is the case when using the AppImage or building from source)”, so it is entirely possible that I didn’t need to do this step, and you may not either. Spoiler Alert, this didn’t fix the issue for me, though I didn’t know that then, and I am including it for posterity. You will need to do this if you are using an AppImage or building from source, though, so if that is the case, you can install them as follows:

sudo bash
cd /etc/udev/rules.d/
wget -O 60-libsigrok.rules ";a=blob_plain;f=contrib/60-libsigrok.rules"
wget -O 61-libsigrok-uaccess.rules ";a=blob_plain;f=contrib/61-libsigrok-uaccess.rules"
# use this one instead if appropriate
# wget -O 61-libsigrok-plugdev.rules ";a=blob_plain;f=contrib/61-libsigrok-plugdev.rules"

sudo udevadm control --reload-rules

The Firmware

After this, I rebooted for good measure and tried again. No luck; I was still facing the same error. At this point, I did what I probably should have done to start with and ran pulseview from the terminal so that I could see its stdout and stderr streams. Doing so, I was faced with this error at the time of failure:

sr: resource: Failed to open resource’ fx2lafw-saleae-logic.fw’ (use loglevel 5/spew for details).
sr: fx2lafw: Firmware upload failed for device 3.2 (logical), name fx2lafw-saleae-logic.fw.
sr: fx2lafw: Unable to get version info: LIBUSB_ERROR_TIMEOUT.
sr: fx2lafw: Failed to get firmware version.
sr: fx2lafw: Unable to open device.

With this Logic Analyzer and similar models, Sigrok tries to load some custom open-source firmware onto the device before interfacing with it. The problem is I hadn’t downloaded this firmware, so it was failing to do so. I’m not sure where this is covered in the documentation, but after some cursory searching, I came across this thread where the reporter of the issue helpfully outlined exactly what the problem was. Using the information from that thread, I downloaded the latest firmware and extracted it to /usr/local/share/sigrok-firmware. After this, I restarted Pulseview, and to my delight, it did not immediately crash, and I was able to read data from the Logic Analyzer.

the software now working


If you are using Linux and are having a rough time getting Sigrok or Pulseview working, here is what I would try, knowing what I now know:

  • If the AppImage isn’t working for you, install it from apt, or your distro’s equivalent
  • If you built from source, or are using an AppImage, install the udev rules as described above
  • If you are using a device that requires custom firmware to work with Sigrok, such as those using the Cypress - FX2 chip, download the firmware, and extract it to /usr/local/share/sigrok-firmware

With that, it should be working as intended, and you can get back to grokking signals, as nature intended.