ihmcrobotics / ihmc-ethercat-master

Java EtherCAT master based on the SOEM EtherCAT master
Apache License 2.0
21 stars 14 forks source link

User Permissions for ihmc-realtime #5

Closed DanielsMaCoogan closed 6 years ago

DanielsMaCoogan commented 6 years ago
Required Info
Current Release
Debian Stretch with RT_Preempt patch
OpenJDK 1.8

I have successfully used intellij to build and run the program using the provided examples and some more that I developed for testing. To do this however I have been running Intellij with sudo privileges. I have done some reading on internet and understand this not a bug but I still would like some help or pointers of how to work around.

Error from attempted run without sudo privileges is "Cannot start realtime thread, do you have permission"

Please let me know if you require more information but if I understand correctly this is already a discussed topic and you may be able to provide a link to another discussion that could provide pointers on how to resolve the problem.

thanks, Matt

dljsjr commented 6 years ago

We highly suggest that any real-time applications be run as root. The recommended workflow would be to use Maven or Gradle to create a "deployment" task that emits a .jar of your project somewhere on disk and then start that .jar from the command line with sudo privileges instead of having to run your IDE as root.

If that isn't a feasible solution, there is a workaround, but we don't suggest that you use it on a production target. You can modify the user's PAM ulimit limits. Edit the file /etc/security/limits.conf with the following additions:

[username]       soft    cpu     unlimited
[username]       -       rtprio  100
[username]       -       nice    40
[username]       -       memlock unlimited

Then reboot. You should now be able to spawn real-time threads as a non-root user.

DanielsMaCoogan commented 6 years ago

Thank you, that is exactly the information I was looking for.