Run linuxcnc as root user

More
14 May 2024 07:08 - 14 May 2024 07:14 #300556 by nauman
Hi
I am tryinh to run linuxcnc on fedora using copr.fedorainfracloud.org/coprs/dwrobel/linuxcnc/ link
Now I am trying to run it as root user because I don't want to give root access to main user.
after running linuxcnc command in terminal I am getting

LINUXCNC - 2.10.0-0.100.20231213git6d8161a.fc38
Machine configuration directory is '/usr/share/doc/linuxcnc/examples/sample-configs/sim/axis'
Machine configuration file is 'axis.ini'
Starting LinuxCNC...
linuxcncsvr (261738) emcsvr: machine 'LinuxCNC-HAL-SIM-AXIS'  version '1.1'
linuxcnc TPMOD=tpmod HOMEMOD=homemod EMCMOT=motmod
Refusing to run as root without fallback UID specified
To run under a debugger with I/O, use e.g.,
    sudo env RTAPI_UID=`id -u` RTAPI_FIFO_PATH=$HOME/.rtapi_fifo gdb /usr/bin/rtapi_app
<commandline>:0: waitpid failed /usr/bin/rtapi_app tpmod
<commandline>:0: /usr/bin/rtapi_app exited without becoming ready
<commandline>:0: insmod for tpmod failed, returned -1
Refusing to run as root without fallback UID specified
To run under a debugger with I/O, use e.g.,
    sudo env RTAPI_UID=`id -u` RTAPI_FIFO_PATH=$HOME/.rtapi_fifo gdb /usr/bin/rtapi_app
<commandline>:0: waitpid failed /usr/bin/rtapi_app homemod
<commandline>:0: /usr/bin/rtapi_app exited without becoming ready
<commandline>:0: insmod for homemod failed, returned -1
milltask (261749) task: machine 'LinuxCNC-HAL-SIM-AXIS'  version '1.1'
halui (261754) halui: machine 'LinuxCNC-HAL-SIM-AXIS'  version '1.1'
Found file(lib): /usr/share/linuxcnc/hallib/core_sim.hal
Refusing to run as root without fallback UID specified
To run under a debugger with I/O, use e.g.,
    sudo env RTAPI_UID=`id -u` RTAPI_FIFO_PATH=$HOME/.rtapi_fifo gdb /usr/bin/rtapi_app
/usr/share/linuxcnc/hallib/core_sim.hal:5: waitpid failed /usr/bin/rtapi_app trivkins
/usr/share/linuxcnc/hallib/core_sim.hal:5: /usr/bin/rtapi_app exited without becoming ready
/usr/share/linuxcnc/hallib/core_sim.hal:5: insmod for trivkins failed, returned -1
Shutting down and cleaning up LinuxCNC...
USRMOT: ERROR: command 30 timeout
emcMotionInit: emcTrajInit failed
USRMOT: ERROR: command 3 timeout
Refusing to run as root without fallback UID specified
To run under a debugger with I/O, use e.g.,
    sudo env RTAPI_UID=`id -u` RTAPI_FIFO_PATH=$HOME/.rtapi_fifo gdb /usr/bin/rtapi_app
LinuxCNC terminated with an error.  You can find more information in the log:
    /root/linuxcnc_debug.txt
and
    /root/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal


File: /root/linuxcnc_debug.txt


  260460
  260470
  Stopping realtime threads
  Unloading hal components


File: /root/linuxcnc_print.txt

  RUN_IN_PLACE=no
  LINUXCNC_DIR=
  LINUXCNC_BIN_DIR=/usr/bin
  LINUXCNC_TCL_DIR=/usr/lib64/tcl8.6/linuxcnc2.10.0
  LINUXCNC_SCRIPT_DIR=
  LINUXCNC_RTLIB_DIR=/usr/lib/linuxcnc/modules
  LINUXCNC_CONFIG_DIR=
  LINUXCNC_LANG_DIR=/usr/lib/tcltk/linuxcnc/msgs
  INIVAR=inivar
  HALCMD=halcmd
  LINUXCNC_EMCSH=/usr/bin/wish8.6
  INIFILE=/usr/share/doc/linuxcnc/examples/sample-configs/sim/axis/axis.ini
  VERSION=1.1
  PARAMETER_FILE=sim.var
  TPMOD=
  HOMEMOD=
  TASK=milltask
  HALUI=halui
  DISPLAY=axis
  COORDINATES=X Y Z
  KINEMATICS=trivkins
  Starting LinuxCNC server program: linuxcncsvr
  Loading Real Time OS, RTAPI, and HAL_LIB modules
  Starting TASK program: milltask
  Starting HAL User Interface program: halui
  Removing HAL_LIB, RTAPI, and Real Time OS modules
  Removing NML shared memory segments

 
Last edit: 14 May 2024 07:14 by nauman.

Please Log in or Create an account to join the conversation.

More
14 May 2024 11:12 #300568 by tommylight

Refusing to run as root without fallback UID specified

You might be able to run it after setting a fallback UID, but i have no idea how to do that.
In general, do not run anything as root unless strictly required. it is a security risk, although not as terrible as the internet will try to convince you.
There might also be the possibility of running any program as another user in Linux, again, no idea if and how as it's been over 15 years since i did that and a lot has changed.

Please Log in or Create an account to join the conversation.

More
14 May 2024 19:12 #300593 by cornholio
Replied by cornholio on topic Run linuxcnc as root user
The biggest issue is the mess that can be made of the file system.


TBH the OP confuses me.

Please Log in or Create an account to join the conversation.

More
14 May 2024 20:15 #300599 by PCW
Replied by PCW on topic Run linuxcnc as root user
I would think that would lower rather than raise security.

Please Log in or Create an account to join the conversation.

More
14 May 2024 20:22 #300600 by nauman
Replied by nauman on topic Run linuxcnc as root user
I have one root and one non-root user. So the idea is root user is running linuxcnc and non-root user is sending commands via python api. So I have all security issues under control.

Please Log in or Create an account to join the conversation.

More
14 May 2024 20:23 #300601 by nauman
Replied by nauman on topic Run linuxcnc as root user
User has no access to file system i have one service running which is doing all the work

Please Log in or Create an account to join the conversation.

More
14 May 2024 20:25 #300602 by nauman
Replied by nauman on topic Run linuxcnc as root user
I am taking care of the security. Giving root level access to non-root user is more risky for me.

Please Log in or Create an account to join the conversation.

More
14 May 2024 21:11 #300609 by tommylight

Now I am trying to run it as root user because I don't want to give root access to main user.
 

Why would you give main user root access? There is no need for it, ever if the normal user does not need to install or remove something.
Pretty sure something is amiss, and given the wrong info on the internet, i am not surprised at all.

User has no access to file system i have one service running which is doing all the work

That is as simple as setting permissions to a single user folder.

I am taking care of the security. Giving root level access to non-root user is more risky for me.

I sincerely doubt it, you do NOT have to give root access to user if you think they do not need it.
Thinking a bit, did you work with Windows Domain Servers?
Linux does not work like that.
You can set the PC to boot into a normal user, you can limit everything to it, so it can run LinuxCNC and not have access to files at all, but this requires someone with SUDO privileges to open a file. Once only.
Or you can limit access to a single folder so he can open files and run the machine, but not save files or open files on other folders, etc, etc
It is a simple as "do not give the user the password", that is it. In normal use they will never need it.

Please Log in or Create an account to join the conversation.

More
15 May 2024 00:20 #300635 by cornholio
Replied by cornholio on topic Run linuxcnc as root user
With regards to “security” with Linuxcnc.
It really comes down to who has access to the machine. I feel once the “bad guy” has physical access it’s the damage that can be done to the cnc machine whilst running linuxcnc. It’s not like you’re running a server with sensitive info, you’re running a piece of equipment that can either harm personnel or damage itself.
First rule of security is physical security of the machine. Once an unauthorised person get physical access to your cnc machine I can guarantee it’s not the file system on the computer you’ll be “shitting bricks” about.

Please Log in or Create an account to join the conversation.

More
15 May 2024 04:47 #300641 by rodw
Replied by rodw on topic Run linuxcnc as root user
I might be wrong but from my memory linuxcnc does not like being run by the root user. Certainly compiling hte source as root creats all sorts of issues. I found that out the hard way.

What you could do is build linuxcnc from source via RIP as a specific user and that will place all of the executables in that users home folder. The linuxcnc folder will also be there too. Its pretty easy to do. I did a tutorial of it. 


So other users can be set up as another user and they will never see any access to linuxcnc and root is not used at all.

Please Log in or Create an account to join the conversation.

Time to create page: 0.220 seconds
Powered by Kunena Forum