I grabbed the image for Ubuntu on Raspberry PI over here https://ubuntu.com/download/raspberry-pi loaded a L928N python program via a virtualenv as the ubuntu user and got an error. Did some digging and some testing turned out to be ubuntu group could not access /dev/gpiomem
which belongs to root root
So the option I was left with was to run my python program as root but virtualenv was not really isolating my programs then. It appeared sudo
was pulling everything from root's global python setup. Seeing as I run a couple project on the raspberry pi having them overlap can cause me nights of frustration trying to understand why something broke (when a dep updates for one project and not another).
So I made /dev/gpiomem
group gpio
which ubuntu user is apart of. Viola python, pip, virtualenv and my project worked without sudo
in a controlled isolated virtualenv!
Now a couple days later login run the program and it fails. Turns out /dev/gpiomem
reverted back to root root
.
Questions I have are A) is there a better way to give ubuntu access to /dev/gpiomem
B) is there a way to ensure that the group stays the same (assuming A is no).