Trying to run I2C based code and cannot run as root #34

Closed
bgeipel opened this Issue Oct 5, 2012 · 8 comments

Projects

None yet

4 participants

@bgeipel
bgeipel commented Oct 5, 2012

I am trying to run my I2C based python script using the adafruit libraries. I am getting acces errors which I assume are because I normally run these as root via sudo.

Can we have a run as root mode?

@bgeipel
bgeipel commented Oct 6, 2012

I modified the run_file function in editor/public/javascripts/occ_editor.js to do a sudo. Perhaps this could be an option?

@jwcooper
Member
jwcooper commented Oct 6, 2012

Yup, this will definitely need to be an option. You can also manually launch the terminal and run it as sudo as well, but definitely not as convenient as a button. We'll design a good way of doing that, and implement it.

Also, if an update is available, and you choose to update, it will overwrite any of your manual changes.

@bgeipel
bgeipel commented Oct 6, 2012

Understood!

@richard-sim

Does anything that uses GPIO need root? Running the CharLCD sample also requires a "sudo python [script]" from the terminal window:
RPi.GPIO.SetupException: No access to /dev/mem. Try running as root!

@jwcooper
Member
jwcooper commented Oct 8, 2012

Yea, I think basically anything using GPIO needs root due to the low level access required. You can do the same thing that bgeibel did, or just manually open the terminal, and run as sudo.

@ladyada
Member
ladyada commented Oct 8, 2012

justin, maybe have the installer run

  • sudo adduser pi i2c

so they don't have to sudo for i2c?

@jwcooper
Member
jwcooper commented Oct 8, 2012

Yea, good idea. I'll see if I can get that in for the next release.

@jwcooper
Member

The default is to run as root for now in 0.2.0, as nearly anything interesting requires it on the Pi. I've also added the user to the i2c group. Here is how to upgrade: http://www.adafruit.com/blog/2012/10/18/raspberry-pi-webide-update-to-0-2-0/

@jwcooper jwcooper closed this Oct 18, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment