1

I've built my Raspberry Pi2 with Unbuntu per the instructions here. Software wise I have installed the following packages

  • python-pip
  • python-dev
  • mercurial

as well as the following python packages

  • Raspberry Pi GPIO;

    sudo pip install hg+http://hg.code.sf.net/p/raspberry-gpio-python/code#egg=RPi.GPIO
    
  • Adafruit DHT

    git clone https://github.com/adafruit/Adafruit_Python_DHT.git
    cd Adafruit_Python_DHT
    sudo python setup.py install
    

When I try to run the Adafruit_Python_DHT/examples/simpletest.py I use the following command. I did have to update the pin# in the script to match the pin that I used when I hooked it up.

sudo python simpletest.py

The response I get from it this is:

Traceback (most recent call last):   
File "simpletest.py", line 40, in <module> humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)   File "build/bdist.linux-armv7l/egg/Adafruit_DHT/common.py", line 90, in read_retry   
File "build/bdist.linux-armv7l/egg/Adafruit_DHT/common.py", line 77, in read   
File "build/bdist.linux-armv7l/egg/Adafruit_DHT/Raspberry_Pi_2.py", line 34, in read RuntimeError: Error accessing GPIO. 
Make sure program is run as root with sudo!

So I did some research and I found some information regarding the use of the /dev/mem but I did not quite feel that this applied to my build although this is where I found a solution to install the dev version of the GPIO lib instead of the version that gets pulled from the OS repo. In my research on Adafruit's site it was clear that the library is supported on Raspbian. So I rebuilt the Pi using Raspbian and performed the same test without having to install the GPIO library and it worked fine.

So now I am stumped. I would really like to use Ubuntu as my OS for the Pi but at the same time need to be able to leverage this and presumably other similar libraries.

  • Any progress on this? I'm facing exactly the same situation and problem. Thanks – sorenkrabbe Dec 19 '15 at 20:02
  • I did not find an answer to this issue. I ended up reverting that device back to the Raspbian build and it is now working fine. – jsalassi Dec 28 '15 at 4:46
1

The RPi.GPIO Python module is bundled with Raspbian.

Currently RPi.GPIO has to be run with root priviliges because it accesses /dev/mem. You need root priviliges to access /dev/mem.

So you have to run RPi.GPIO with sudo or similar.

Shortly RPi.GPIO may be changed to use /dev/gpiomem rather than /dev/mem. If that happens members of group gpio should be able to run RPi.GPIO without root priviliges.

0

I got the DHT22 sensor working in a similar setup (Ubuntu community maintained on RPi 2) by "adding Device Tree support to the kernel" by following the detailed steps provided by poster "KTB" in this thread: https://www.raspberrypi.org/forums/viewtopic.php?t=113014&p=773725

  • While a good answer, it would be preferable if you would include the most relevant parts of the linked materials in your post into your answer. This to prevent link rot. There's an up vote in it for you. ;) – Bex Dec 29 '15 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.