-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GPIO permission errors after upgrade to 3.18.x (Raspbian) #791
Comments
I think this is happening because For example, here's
The directory |
I came round this issue when testing my PiFace Digital, where pifacecommon/interrupts.py threw an exception of not finding /sys/devices/virtual/gpio. BR |
Can somebody explain how PiFace (my phone really wanted to write "pigface" there) uses these file nodes, and why it doesn't/can't use the nodes under /sys/class/gpio/ instead? |
I believe it's just used in /lib/udev/rules.d/60-python3-pifacecommon.rules (which we include in raspbian image) |
I don't buy that. Why bother changing permissions on files or directories that you aren't otherwise going to use? |
Phil, I tried changing above file. Pifacedigital-emulator started up afterwards, Hope that helped, Am 07.02.2015 um 20:10 schrieb Phil Elwell [email protected]: I don't buy that. Why bother changing permissions on files or directories — |
In order for user pi to be able to access gpios without root permissions on a michine with the device tree disabled, udev rules are needed for both
I can't think of a sane reason to use Note that this only functions when the device tree is disabled. When the device tree is enabled, If the device tree is enabled, the udev rules on the Pi 2 need to use Note that |
Can somebody try this modified version of
It should work with and without DT, on Pi1 and Pi2. |
Hi, I'm one of the Tom's at PiFace -- we're looking into this right now. :) |
@pelwell The new rule works when the interrupt module in pifacecommon points to |
That sounds like the right change - you can think of /sys/class/gpio as the generic interface, and /sys/devices/*/gpio as the specific implementation. |
@pelwell The new rule you provided above also works for me. I'm not using PiFace, but rely on the rule to enable user pi on Raspbian to use gpio without root privileges. Thanks :) |
in /boot/config.txt device_tree= is the only solution for me. i am using lric_rpi and some gpios. even lirc_rpi dt_overlay is not working correctly... :( |
I've fixed both pi-gpio (pull request #34) and gpio-admin (pull request #7) in a manner so that both the old and the new paths are supported. Hopefully, those pull requests are merged soon... |
@irlp has this issue been resolved? If yes, please close this issue. Thanks. |
I am experiencing this problem in 4.9.17-v7+ and nothing suggested seems to solve my problem. |
This isn't really a kernel issue. Which distribution are you running, and what is the install history (i.e. is it a clean install or did you upgrade, and if so from what)? |
I was using latest OctoPi raspbian release. It was the kernel 4.1.19-v7+ but I upgraded it by rpi-update. |
Using the 4.9 kernel, what do you get from:
|
|
Those permissions all look correct. What happens when you |
Seems like this problem still exists on the latest released Jessie Lite v4.4, from my testing. Sorry about the cross-post to multiple issues. |
That's not a very useful bug report. Please say what you do and what results you get, and your installation history. |
I installed the default Raspbian from here: https://downloads.raspberrypi.org/raspbian_lite_latest Then I tried to run the Gobot example code that handles in the same fashion as Python/node.js libs, via a sysfs interface using https://github.com/hybridgroup/gobot/blob/master/examples/raspi_blink.go This code is able to run under sudo, but not without sudo. My understanding was that the dev rules in the latest Raspibian would no longer require this. Thank you. |
Thanks - I would have expected that to work. Just to be clear, are you saying you have not upgraded or altered the kernel in any way? |
That's correct. No changes whatever. |
@deadprogram After exporting a gpio to userspace, does your code wait for the permissions on the files in |
Possible race condition? If that is the case, then how long should one wait after exporting before using the pin? |
The udev rules modify the permissions asynchronously and your code runs at the same time, so your code may end up trying to access the files before the permissions are changed.
There isn't really a good answer to this question as it will be highly dependent on the current system load. In onoff it's done like this. The code keeps attempting to set the direction of the GPIO until it succeeds. In theory it tries up to 10000 times. In practice it only has to try once or twice when the system load is "normal". After the direction has been set, onoff doesn't have any further special code for dealing with the issue. |
Thank you for the tip @fivdi and the link. I've implemented that solution now, and works great. |
Sorry for late reply. I was away from my pi.
|
The udev rule uses $devpath to locate the device nodes, and it is looking like that mechanism isn't working in your case. Can you try these tests?:
|
|
That all looks OK. What do you have in /etc/udev/rules.d/99-com.rules? You can omit the spi/i2c/tty rules. |
|
That rule for "gpio*" doesn't match the current Raspbian version - try using this instead (replacing
@XECDesign - @trgtylcnky says he is running OctoPi Raspbian. Does this look like an old Raspbian rules file, or is it some other concoction? |
It looks like it's an older version of the file: What is the md5sum of the file? Is raspberrypi-sys-mods installed? If so, what version? |
See also: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=183481 Had the same issues. In regards to @XECDesign's above question, this is what I had before (non-working):
... and after (working):
Regarding OctoPi: I am not using OctoPi, but vitormhenrique/OctoPrint-Enclosure#16 also looks to be the same. |
This issue will be closed within 30 days unless further interactions are posted. If you wish this issue to remain open, please add a comment. A closed issue may be reopened if requested. |
Closing due to lack of activity. Please request to be reopened if you feel this issue is still relevant. |
rust: add `AsyncRevocable`
When the latest package raspberrypi-bootloader:armhf 1.20150130-1 was installed, the gpio symbolic links in /sys/class/gpio/ moved from /sys/devices/virtual/ to /sys/devices/soc/20200000.gpio.
The permissions in /sys/devices/soc/20200000.gpio do not include the "x" bit, as as such nobody but root can use the gpio.
This has changed since the latest bootloader, and the only way I can fix this is on boot, as root, run
chmod -R +x /sys/devices/soc/20200000.gpio
Is there a better way to allow a non-root user to access the GPIO?
The text was updated successfully, but these errors were encountered: