# Linux AppImage udev command needs sudo on Ubuntu 22.04

**URL:** <https://discuss.saleae.com/t/linux-appimage-udev-command-needs-sudo-on-ubuntu-22-04/2552>\
**Category:** Logic 2 Software\
**Created:** [November 22, 2023, 2:18pm UTC](https://discuss.saleae.com/t/linux-appimage-udev-command-needs-sudo-on-ubuntu-22-04/2552 "2023-11-22T14:18:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucasrangit](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/lucasrangit/32/1598_2.png) [@lucasrangit](https://discuss.saleae.com/u/lucasrangit)\
**Post date:** [November 22, 2023, 2:18pm UTC](https://discuss.saleae.com/t/linux-appimage-udev-command-needs-sudo-on-ubuntu-22-04/2552/1 "2023-11-22T14:18:55Z")

</div>

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

```sh
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.

---

<div class="post-metadata">

**Author:** ![timreyes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/timreyes/32/108_2.png) [@timreyes](https://discuss.saleae.com/u/timreyes)\
**Post date:** [November 22, 2023, 11:20pm UTC](https://discuss.saleae.com/t/linux-appimage-udev-command-needs-sudo-on-ubuntu-22-04/2552/2 "2023-11-22T23:20:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![b.hughes1](https://avatars.discourse-cdn.com/v4/letter/b/ce73a5/32.png) [@b.hughes1](https://discuss.saleae.com/u/b.hughes1)\
**Post date:** [November 23, 2023, 6:51am UTC](https://discuss.saleae.com/t/linux-appimage-udev-command-needs-sudo-on-ubuntu-22-04/2552/3 "2023-11-23T06:51:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![timreyes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/timreyes/32/108_2.png) [@timreyes](https://discuss.saleae.com/u/timreyes)\
**Post date:** [November 27, 2023, 7:10pm UTC](https://discuss.saleae.com/t/linux-appimage-udev-command-needs-sudo-on-ubuntu-22-04/2552/4 "2023-11-27T19:10:16Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![markgarrison](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/markgarrison/32/23_2.png) [@markgarrison](https://discuss.saleae.com/u/markgarrison)\
**Post date:** [November 29, 2023, 10:05pm UTC](https://discuss.saleae.com/t/linux-appimage-udev-command-needs-sudo-on-ubuntu-22-04/2552/5 "2023-11-29T22:05:07Z")

</div>

A few quick notes on the udev rules install script.

The install command looks like this:

```bash
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:

```auto
# 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 ...`.

---

<div class="post-metadata">

**Author:** ![lucasrangit](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/lucasrangit/32/1598_2.png) [@lucasrangit](https://discuss.saleae.com/u/lucasrangit)\
**Post date:** [November 30, 2023, 10:57am UTC](https://discuss.saleae.com/t/linux-appimage-udev-command-needs-sudo-on-ubuntu-22-04/2552/6 "2023-11-30T10:57:23Z")

</div>

@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...`”

---

<div class="post-metadata">

**Author:** ![markgarrison](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/markgarrison/32/23_2.png) [@markgarrison](https://discuss.saleae.com/u/markgarrison)\
**Post date:** [November 30, 2023, 7:03pm UTC](https://discuss.saleae.com/t/linux-appimage-udev-command-needs-sudo-on-ubuntu-22-04/2552/7 "2023-11-30T19:03:03Z")

</div>

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 🙂
