Why are ros logs stored under '/root/.ros/log' ?
Hi everyone!
I'm working with ros-indigo under ubuntu 14.04.
Normally ros logs are stored under ~/.ros/log
!? and can be deleted when running rosclean purge
.
In my case, log files are saved under ~/.ros/log
and also under ./root/.ros/log
and I don't know why they are stored there!
Are some nodes run with root privileges or something because I'm running so many ros nodes in background? Well the root itself don't know the command rosclean
...
I need to Know why is that happening? and How can I tell ROS to delete logs regularly or to not create log files at all? This last question was already asked here but It was a while ago.
For instance I'm going with ROS_LOG_DIR=/tmp
for the user but unable to do the same for the root.
When ROS is using ./root/.ros/log
it feels like the ~
is pointing on root
. Is there any problem in launching ROS nodes from a python script? In this case it feels like the root is the owner of the launched ROS nodes...
Your help would be appreciated.
Asked by Jasmin on 2017-09-14 05:40:13 UTC
Comments
I'm not sure if it is possible to force the
~
to point on a specific user (not root) when running ROS nodes in different conditions. but for instance, when running the codes that run the scripts launching the ROS nodes I forced the user to be my normal user withsudo -u user
and it worked.Asked by Jasmin on 2018-06-22 05:57:36 UTC
sudo
runs things asroot
(by default). That is why logs were written to/root/.ros/log
.~
is evaluated by the shell, and as that was run asroot
, it resolved to/root
.In general running ROS nodes as
root
is discouraged and most of the times not necessary.Asked by gvdhoorn on 2018-06-22 15:13:47 UTC
You're right, but I was not running the nodes as
root
in purpose, I was running the nodes via astartup script
. but since I added the script to "/etc/init.d/
" it was run by root causing the launched ros nodes to be owned by the root as well. I should correct the way I'm running startup nodes!Asked by Jasmin on 2018-06-24 04:17:39 UTC
That would have been good to include in your question text, as that is the most likely cause of why the logs end up in
/root/.ros/log
.Asked by gvdhoorn on 2018-06-24 05:08:08 UTC