ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

ROS2 through docker: failed to configure logging: Failed to create log directory

asked 2022-04-20 05:16:58 -0500

AlexandrosNic gravatar image

updated 2022-04-22 03:47:11 -0500

I am trying to run ROS2 with x11 support through docker, but I receive this error when I try to open rviz2:

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-cocobots'
[ERROR] [1650449124.107459824] [rclcpp]: rcl context unexpectedly not shutdown during cleanup
terminate called after throwing an instance of 'rclcpp::exceptions::RCLError'
  what():  failed to configure logging: Failed to create log directory: /home/cocobots/.ros/log, at /tmp/binarydeb/ros-foxy-rcl-logging-spdlog-1.1.0/src/rcl_logging_spdlog.cpp:100
Aborted (core dumped)

Indeed there is no log directory in /home/cocobots/.ros/log Anyone knows what may causes the error?

edit retag flag offensive close merge delete


It was probably an ownership problem. I had the same error, it was fixed after giving my user the ownership of his home directory. chown -R user /home/user

Jasmin gravatar image Jasmin  ( 2022-06-15 23:19:57 -0500 )edit

Have there been any updates on this? I gave the user ownership of their home directory but that hasn't fixed it. The issue is also infrequent. I cannot get it to show up every time I run my ROS2 packages but it is still present about 20% of the time.

Zach gravatar image Zach  ( 2022-06-21 17:39:28 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-04-22 03:40:31 -0500

AlexandrosNic gravatar image

updated 2022-06-30 09:42:36 -0500

I had to change to the root user in order for ROS to work ( docker run ... --user=root ...). Also, rocker by tfoote is another handy tool to tackle this

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2022-04-20 05:16:58 -0500

Seen: 201 times

Last updated: Jun 30