Cap_add for NET_ADMIN is not permitted for CAN C script in extraparams

Hello,
I am trying to update the extraparams parameter in the Torizon VSCode plugin for my .C file to contain iproute2 and can-utils.
I believe this is equivalent to the --cap-add=“NET_ADMIN” option for using Docker to run the container.

As per the following link:

We can update extraparams with cap_add (not cap-add because the ‘-’ dash is not allowed and only underscore is allowed.) I tried adding NET_ADMIN and CAP_NET_ADMIN as values but was getting a YAML validation error. So could not add them.

I tried using __cap_add (i.e. 2 underscores before the cap_add) and was able to add NET_ADMIN, but then this did not compile with F5 and I got an error whilst compilation.

Please can you let me know how to address this aspect with the Torizon core plugin.

Note: I am using an Apalis iMX8 with Ixora board.

Dear @SJ_BHD,

Could you please share with us the following:

  • Which TorizonCore version are you running on the module?
  • Which Extension are you using and which version?
  • What is the full error log that you get while trying to compile?

Also, about the cap_add did you check how does the extraparams work on here? C/C++ Development and Debugging on TorizonCore Using Visual Studio Code | Toradex Developer Center. They point you out to this webpage Containers — Docker SDK for Python 6.0.1 documentation that shows how to properly write the property.

Best regards,

Hi,
I am using the TorizonCore version as below.
Operating System: TorizonCore 5.6.0+build.13 (dunfell)
Kernel: Linux 5.4.161-5.6.0+git.0f0011824921

VSCode Extension is Torizon Early access V1.6.0.

The error log is likely related to the YAML issue, how do you add the option --cap-add = NET_ADMIN in the Torizon extension? Try adding and you would see it.

Kind regards,
Shantanu

Dear @SJ_BHD,

Without having any error log or indication it’s hard for us to debug and see what could be causing the issue. You could, for instance, send a screenshot of the extraparms field on the extension.

If you take a look at the two links that I’ve added to the previous message, it shows on the second page (Containers — Docker SDK for Python 7.1.0 documentation) the following sentence:

  • cap_add (list of str) – Add kernel capabilities. For example, ["SYS_ADMIN", "MKNOD"].

So, I did a quick test with:
image

And it seems to compile without any major problems. Can you please test it? In the meantime, I’ll send a request to correct the CAN article on our developer page as it’s indicating a wrong way: How to Use CAN on Torizon OS | Toradex Developer Center

Best regards,

Hello,
That seems to have resolved it. Got no build errors with that change.
We need to add [“NET_ADMIN”] with the brackets and ".
Thanks.

Hi @SJ_BHD,

That’s it! I’ve sent a request already to update the developer page. It may be corrected early next week with also a new screenshot.

Please feel free to come back anytime needed and enjoy your weekend :slight_smile: .

Best regards,

Hi @SJ_BHD,

We updated the page: How to Use CAN on TorizonCore | Toradex Developer Center. It has now the right information. Thanks for reporting :slight_smile: