Linux AppImage udev command needs sudo on Ubuntu 22.04

The pop-up to install udev rules on Linux needs sudo on Ubuntu 22.04.

cat /tmp/.mount_Logic-Q2LjHH/resources/linux-x64/99-SaleaeLogic.rules | sudo tee /etc/udev/rules.d/99-SaleaeLogic.rules > /dev/null && echo "finished installing /etc/udev/rules.d/99-SaleaeLogic.rules"
cat: /tmp/.mount_Logic-Q2LjHH/resources/linux-x64/99-SaleaeLogic.rules: Permission denied
finished installing /etc/udev/rules.d/99-SaleaeLogic.rules

Will write an empty file because of the permission error.

1 Like

@lucasrangit Thanks for the heads up! I’ll send this feedback over to our software team.

2 Likes

@timreyes dont users normally login or install the SW as Root or via SUDO themselves vice having the package install do it?

@b.hughes1 The Linux version of the software is in an AppImage executable format that is executed directly rather than being installed. The udev rules file is installed separately.

1 Like

A few quick notes on the udev rules install script.

The install command looks like this:

cat /tmp/.mount_Logic-onX696/resources/linux-x64/99-SaleaeLogic.rules | sudo tee /etc/udev/rules.d/99-SaleaeLogic.rules > /dev/null && echo "finished installing /etc/udev/rules.d/99-SaleaeLogic.rules"

When run, that command will prompt for the root password. once entered, it will create the file with the correct contents, which can be verified with:

cat /etc/udev/rules.d/99-SaleaeLogic.rules

Content:

# Saleae Logic Analyzer
# This file should be installed to /etc/udev/rules.d so that you can access the Logic hardware without being root
#
# type this at the command prompt: sudo cp 99-SaleaeLogic.rules /etc/udev/rules.d

SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="0925", ATTR{idProduct}=="3881", MODE="0666"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="21a9", ATTR{idProduct}=="1001", MODE="0666"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="21a9", ATTR{idProduct}=="1003", MODE="0666"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="21a9", ATTR{idProduct}=="1004", MODE="0666"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="21a9", ATTR{idProduct}=="1005", MODE="0666"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="21a9", ATTR{idProduct}=="1006", MODE="0666

However, the Logic 2 software must be running when the command is run, otherwise the source file will no longer exist. This is because our application is packaged as an AppImage, the contents of which are only available while the app is running.

Root permissions are required because the udev rules directory is by default read-only.

We frequently perform this ourselves, and we do most of our Linux testing on Ubuntu 22.04 these days.

@b.hughes1, because our app is packaged as an AppImage, there is no installation step. It can be run directly once execute permissions have been granted with chmod +x ....

2 Likes

@markgarrison , I think the pop-up should include a note about that as well as add the sudo to cat.

e.g. “Run the following to install the udev rules while this app is running:… sudo cat /tmp...

Thanks @lucasrangit,

I agree, the note should be improved. It does mention the app needs to be running, but it’s buried in the second block of text. The instructions are currently:

udev rules allow non-root applications like the Saleae software to access USB devices. To record data, please first install the rules file that is provided with the app.

Instructions: while Logic 2 is running, open terminal, run the command below, then restart the app.

Also, the sudo is after the pipe operator, because the initial cat command does not need root permissions, but the tee command does.

We’re using the tee command because redirecting standard out to a file with > does not play well with sudo. Basically we need to invoke a command as sudo that takes its standard input and writes it to a file, and the tee command does this well. This is why we route the standard out of the tee command to /dev/null, because we don’t want to also print the file to the terminal.

I’d like to make some improvements here, with the goal of making the process as automatic and simple as possible. At the same time, we won’t want to just prompt the user to enter their root password :slight_smile:

1 Like