GoPiGo3 - Running a fresh Ubuntu on the Pi

I’m creating a clean ROS boot microSD from a vanilla Ubuntu 20.02 Server.

  1. There are a few details I need to sort out. I had to change permissions to /dev/spi* to allow my account to read and write it.

Now I have this error message which I am trying to fix:

PermissionError: [Errno 13] Permission denied: '/sys/class/gpio/export'
[gopigo3-2] process has died [pid 2990, exit code 1, cmd /home/ubuntu/catkin_ws/src/gpg_bran4/minirover/src/gopigo3_driver.py __name:=gopigo3 __log:=/home/ubuntu/.ros/log/fb66e66e-bc99-11eb-8d69-b336cc2daa24/gopigo3-2.log].
log file: /home/ubuntu/.ros/log/fb66e66e-bc99-11eb-8d69-b336cc2daa24/gopigo3-2*.log

Any help would be appreciated!

1 Like

First of all,

Messing around with the permissions on anything in /dev is always a bad idea.

Because /dev is owned, (and managed), directly by the kernel, these permissions need to be set in certain very specific ways or all hell breaks loose. Messing with these permissions is always a bad idea. That is unless you’re a lot more clever than the rest of us.

You may well need to reinstall a fresh version of the operating system to set things right.

If you have an issue with your user accessing something in /dev, the problem is not in /dev. You need to find out what you need to do to get the access you appear to need.

What was the original problem? (Before you started messing around with permissions?)

What permissions did you set?

After a reboot the behavior changes a little:

Import gopigo3' throws an error: "Errno 13: Permission Denied". I am logged in as user ubuntu and I have added that user togroup root`. And:

[onboard:mr2]~/catkin_ws$ groups
ubuntu root adm dialout cdrom floppy sudo audio dip video plugdev netdev lxd
[onboard:mr2]~/catkin_ws$ ls -la /dev/spi*
crw------- 1 root root 153, 0 Apr  1  2020 /dev/spidev0.0
crw------- 1 root root 153, 1 Apr  1  2020 /dev/spidev0.1
[onboard:mr2]~/catkin_ws$

Previously when I got this exception, I fixed it by adding ubuntu to root and this took me to the error in the first part of this question. Now I rebooted, and the error is back.

I think there’s a script that is run when the gopigo3 supplied micros card is initially built. Since I am starting from scratch, and on ubuntu, I have to reconstruct what all has to be set up to get to an equivalent starting point.

1 Like

You need to find out what is wrong with your configuration as you shouldn’t have to give your user root access or mess with permissions in /dev.

Maybe you need to sudo something?

I am going to strongly suggest a fresh install to get everything back to the way it was and then start fresh. Once you hit problems, let us know and then we can help.

Once you start messing around with kernel permissions, everything goes right out the window.

See my updated reply above.

Actually I didn’t change permissions in /dev at all. I added my account to the root group.

1 Like

Ok. (Whew!)

You shouldn’t have to add yourself to the root group.

Is there something you should have run with sudo?

`Import gopigo3’ throws an error: “Errno 13: Permission Denied”.

I am logged in as user ubuntu and I have added that user togroup root.

Have you run ROS on a Gopigo3 yourself?

1 Like

Not sure I can help you directly. Depending on how you installed the GoPiGo3 drivers, that may cause permission problems. I know I had difficulty because some of the scripts assume a username of “pi”. Once I did that, I didn’t have problems.

You may have seen this post:
https://forum.dexterindustries.com/t/interested-in-ros-on-the-gopigo3/7388
I actually got the book and followed along. I used Ubuntu Mate as suggested, but if I were to do it today I might try straight Ubuntu since that is better supported now. I found the book a good intro to ROS on the GoPiGo3 - I have a few posts here in the Forum that highlight issues that I found and how I resolved them.

Looking forward to more ROS discussions here.
/K

1 Like

No.
@KeithW is the resident ROS expert. I am simply speaking from my own, (admittedly limited), Linux experience.

As a general rule, (AFAIK), you should not need to make fundamental changes in permissions or groups unless something is seriously strange.

How did you install the GoPiGo3 drivers?
/K

1 Like

What do you mean by the drivers? The stuff on the red board or the gopigo3 python package?

1 Like

For my robot I ran a couple of scripts. I was assuming it installed hardware drivers for the board as well as the Python package per se.

curl -kL dexterindustries.com/update_gopigo3 | bash
curl -kL dexterindustries.com/update_sensors | bash

If I recall correctly, these scripts assumed they were being run by the pi user. Although you could probably download them directly and modify them for your username before running them through bash.

/K

1 Like

Absolutely correct.

Though you might be able to modify them, many of the GoPiGo related tools assume the “pi” user.

Perhaps a poor programming practice, but remember that these tools were designed to be used with various versions of Raspbian which has “pi” as the default user.

The best idea is to create a “pi” user as the default, (uid=1000), and always use that.

And as @cleoqc has reminded me, their target audience is the education market, where keeping things simple and consistent it paramount.
/K

1 Like

I think further, that even when run from the pi directory, on ubuntu 20.02, they have problems.

1 Like

Could be. The scripts are expecting Ubuntu Mate 18.04. Might run on plain Ubuntu 18.04, but there may be changes in 20.04 that the scripts don’t expect. You might be able to download the scripts and then execute them line by line to figure out where the problem is, but that would be a lot of work. But if you absolutely have to use 20.04, then that might be the way to go.
/K

1 Like

“If you absolutely have to run 20.04” … it’s a set of tradeoffs. As one choice goes up in cost, others become tractable. My sequence goes like this:

I would like to have python 3.x, for that I need noetic, for that I need 18.04. I can’t find definitely that I need 18.04 though. But as the pain of getting this to work goes up, one does consider going back to 18.04 and trying it all with that ubuntu.

2 Likes

Yeah, for Python 3 you would need Noetic and 20.04. There’s a few times that I wish I had some of the new features in Python 3, but for the most part I’m just not that sophisticated in Python, so 2.7 suffices for my ROS programming.

I’ll probably try to jump next to ROS2, so I may well end up skipping past Noetic.
/K

1 Like

Can’t you install Python-3 via apt?

Sure, you can install it on the Raspberry Pi, but ROS would still run using Python 2.
/K

1 Like