Debug as Root /Sys/.../GPIO (Nvidia NSight)

Hi, all.

I was hoping or some advice…

I’m using a Jetson TX1 and remotely debugging it using NSight. My objective is to be able to debug the the JetsonHacks GPIO application using NSight (GPIO Interfacing – NVIDIA Jetson TX1 - JetsonHacks).

The GPIO application requires ‘root’ to use /sys/… files which is part of the application. Is there a way to instruct/setup NSight to run as ‘root’ when debugging remotely? The issue I am getting is “Permission denied” when trying to access “/sys/class/gpio/export”.

I’m not entirely sure what’s “best practice” for this, I’ve changed ownership of the ‘sys/’ folder to the default ‘ubuntu’ user of the Jetson (NSight uses the ubuntu hostname when debugging), and that worked with the debugger. However, I imagine that’s not best practice and I’d like to do it the appropriate way.

Any information or recommendations are greatly appreciated.

I’m not sure how nsight could be told to use sudo (probably use it directly in any command), but if any remote application needs sudo, then you would need a pop-up to ask for the password when in a graphical environment. See “man ssh”, and search for “SSH_ASKPASS”. Basically you install an application which does nothing more than present a password pop-up, and then set the SSH_ASKPASS environment variable to name that program. After that any operation from nsight which needs a password will pop up the password.

There are multiple askpass applications out there. I use KDE, so I am set up for ksshaskpass. There are many others. Under Ubuntu I think you could run “apt search askpass” and several packages will be found. I’m going to guess that the lightest weight askpass on Ubuntu would be just plain old “ssh-askpass”.

There are other solutions, but those solutions are more involved. See first if askpass does the trick. Don’t forget to set that environment variable to point at your askpass choice before testing.

Thank you, LinuxDev!