Unable to get permissions for Jetson GPIO

Hello, I am having trouble getting permissions for Jetson GPIO. I am able to import Jetson.GPIO, but when I run my file I get this error message:
raise RuntimeError(“The current user does not have permissions set to access the library functionalites. Please configure permissions or use the root user to run this. It is also possible that {} does not exist. Please check if that file is present.”.format(_GPIOCHIP_ROOT))
RuntimeError: The current user does not have permissions set to access the library functionalites. Please configure permissions or use the root user to run this. It is also possible that /dev/gpiochip0 does not exist. Please check if that file is present.

I am on Jetson nano with JetPack 4.6.1. I have tried both installing with pip and installing from source. I have checked that the 99-gpio.rules are in /etc/udev/rules.d. Can anyone help me solve this issue? I need to be able to access the GPIO pins through a python script if there is a better library/ one that is easier to install.

Did you run it with sudo?
You should also do this:

sudo groupadd -f -r gpio
sudo usermod -a -G gpio your_user_name

I’ve tried that before and still didn’t get permission. I am not sure what I changed since last time but I am now getting this error message:

line 147, in chip_open
chip_fd = os.open(gpio_chip, os.O_RDONLY)
PermissionError: [Errno 13] Permission denied: ‘/dev/gpiochip1’

raise GPIOError(e.errno, "Opening GPIO chip: " + e.strerror)
Jetson.GPIO.gpio_cdev.GPIOError: [Errno 13] Opening GPIO chip: Permission denied

Just to test sudo, does “sudo ls” work, or does that command deny using ls via sudo?

Also, I want to mention that changing the GPIO is actually talking to a driver. If you have the incorrect GPIO device, or if that device belongs to a different carrier board or module layout, then the alternate driver would likely refuse. Make sure the rule or change you are using goes with the module and carrier board (for example, a third party carrier board with the same module would probably require a different device tree and a different GPIO designation to do the same thing).

1 Like

Yes sudo ls works and I can also use sudo to run my python script with Jetson.GPIO. However, I need to use Jetson.GPIO in my virtual environment.

Is this a VM or container (such as Docker)? If so, then this changes everything. The parent owner of a container or VM has to pass services through to the VM. Can you verify that “sudo” works within the VM or container? Mostly this sounds like a VM or Docker setup rather than a device tree or GPIO setup.

I got it to work with these commands.

sudo usermod -aG gpio $USER
sudo chown root.gpio /dev/gpiochip1
sudo chmod 660 /dev/gpiochip1

Apparently the gpio group only had permission for /dev/gpiochip0 and not /dev/gpiochip1.

I got these commands from here : Permission issue · Issue #20 · NVIDIA/jetson-gpio · GitHub

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.