I have a Verdin iMX8M plus SOM and a Verdin Dev board v1.1.
I had CAN working until I got GPIO working and now the utilities from can (can utills) don’t work and iprout2 doesn’t work either.
I have added the following to my dockerfile under as per the suggestion of your site:
RUN apt-get -y update && apt-get install -y
&& apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/*
&& addgroup docker && groupmod --non-unique --gid 0 docker && adduser torizon docker
I get no errors when building the image and no other errors. But within my program if I am trying to ascertain if the CAN is available, using “ip link show”, it returns “ip not found”.
Before I added all the gpio chips in the /devices section, I was able to run can applications. But now I am not able to, but I don’t know if it is related.
I’ve rebuilt the SDK many times trying different things, but nothing seems to work. Any ideas here as to what and where I need to put a trigger to allow access to commands and CAN modules?
OK, I got this going at least as far as being able to execute commands by putting the docker file shown in the previous posting, by appending them to the “buildcommands” of the custom Properties section. You have to use && and take out the RUN.
I still am unable to make the CAN bus send anything without an error, but it could be something in our code that is doing this.
OK, While I have some of the commands working, some commands don’t work. i.e.
ip link set can0 type can bitrate 500000
ip link set can0 up
Both return:RTNETLINK answers: Operation not permitted
What permission am I missing and how do I fix this?
Also, cansend is not found. That seems weird.
Apparently, you can only run CAN as root? Why is this?
It’s stated in our CAN documentation that root permission is required to use CAN: How to Use CAN on TorizonCore | Toradex Developer Center
This is because CAN is treated as a network interface in Linux. On most Linux distributions manipulating network interfaces require root permissions. Therefore CAN ends up requiring root permissions because of this.
The issue is, I can’t log in as root as I don’t have the password. The debug system seems to work just fine so I must be able to. Can I know what the pw is?
Root doesn’t have a password configured by default. Also you don’t need to provide one you just need to specify in the extension configuration to run as “root” inside the container. The article I linked gives instructions on how to do this in the extension.
You only need to provide a password when adding a new device, but that is just for device connection purposes. This does not dictate what user is being ran inside the application container.
Well, I can’t log into my board directly with ssh and being root because it asks for a passwd, and if I just hit return, it “Authentication failure”, so it can’t be blank. I also tried su root, but it still comes back with a passord request. So it must be set to something.
The user you use to log in via ssh is not the same as the user that is executing your code in the container. These are separate things. You can use the “torizon” user with whatever password you set to access the device via ssh and then you can set the root user to be the user that executes your code inside the container. If you look at the article I linked you will see what configurations you need to do to set the root user as the executing user inside the container if you are using the VS Code extension.