Robotics StackExchange | Archived questions

Rosrun tab autocompletion crashes terminal

I have been using ROS Kinetic on Ubuntu 16.04 for some time now. After doing some kernel upgrades I run into a problem when running the rosrun command. When I hit the tab after writing rosrun the terminal freezes and crashes after few seconds. This does not happen for roslaunch or other ros commands. If I type the whole rosrun command with the node that I want to run it works as expected. Has anyone encountered this problem? There was a question regarding this that proposed some fixes that unfortunately did not work for me (deleting the contents of /var/crash and doing a clean build).

Edit:
The output of env |grep -i ros |sort is:

CMAKE_PREFIX_PATH=/home/pavel/catkin_ws/devel:/opt/ros/kinetic
LD_LIBRARY_PATH=/home/pavel/catkin_ws/devel/lib:/opt/ros/kinetic/lib:/opt/ros/kinetic/lib/x86_64-linux-gnu
PATH=/opt/ros/kinetic/bin:/home/pavel/bin:/home/pavel/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PKG_CONFIG_PATH=/home/pavel/catkin_ws/devel/lib/pkgconfig:/opt/ros/kinetic/lib/pkgconfig:/opt/ros/kinetic/lib/x86_64-linux-gnu/pkgconfig
PYTHONPATH=/home/pavel/catkin_ws/devel/lib/python2.7/dist-packages:/opt/ros/kinetic/lib/python2.7/dist-packages
ROS_DISTRO=kinetic
ROS_ETC_DIR=/opt/ros/kinetic/etc/ros
ROS_MASTER_URI=http://localhost:11311
ROS_PACKAGE_PATH=/home/pavel/catkin_ws/src/pkg1:/home/pavel/catkin_ws/src/pkg2:......../opt/ros/kinetic/share
ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_VERSION=1

where the ROS_PACKAGE_PATH contains a lot of packages, but to make it short I just put pkg1, pkg2.... in the output above.

Asked by pavel92 on 2018-10-08 07:11:27 UTC

Comments

What is the output of env |grep -i ros |sort ?

Asked by Delb on 2018-10-08 07:55:58 UTC

I edited the question with the output

Asked by pavel92 on 2018-10-08 08:16:28 UTC

Have you sourced your workspace ? The variable ROS_PACKAGE_PATH should be /home/pavel/catkin_ws/src:/opt/ros/kinetic/share

Asked by Delb on 2018-10-08 08:34:37 UTC

Try unset ROS_PACKAGE_PATH, and then source devel/setup.bash. Is the output the same ? (only for ROS_PACKAGE_PATH )

Asked by Delb on 2018-10-08 08:36:01 UTC

When I do a clean build ROS_PACKAGE_PATH gives only /opt/ros/kinetic/share . After I source the workspace I get the same package path that was shown in the question. When i unset the ROS_PACKAGE_PATH and source the workspace the package path is the same and the crash still occurs

Asked by pavel92 on 2018-10-08 08:49:18 UTC

Have you modified your .bashrc ? Moreover have you run sudo apt-get update, then sudo apt-get upgrade and finally sudo apt-get autoremove ?

Asked by Delb on 2018-10-08 09:47:44 UTC

Did that but it did not help. I had this added in my .bashrc:

source /opt/ros/kinetic/setup.bash
source /home/pavel/catkin_ws/devel/setup.bash

Asked by pavel92 on 2018-10-10 02:17:16 UTC

Can you just try to unset ROS_PACKAGE_PATH and then export ROS_PACKAGE_PATH=/home/pavel/catkin_ws/src:/opt/ros/kinetic/share (don't source your workspace after that and try the autocompletion) just to make sure the problem isn't with this variable not correctly set.

Asked by Delb on 2018-10-10 02:33:07 UTC

Tried it and auto-completion works so the problem is coming after sourcing the workspace (devel/setup.bash)

Asked by pavel92 on 2018-10-11 02:22:07 UTC

Okay, so each time you source you have something like that : ROS_PACKAGE_PATH=/home/pavel/catkin_ws/src/pkg1:/home/pavel/catkin_ws/src/pkg2:......../opt/ros/kinetic/share ?

Asked by Delb on 2018-10-11 02:35:06 UTC

Yes, after sourcing devel/setup.bash that is my ROS_PACKAGE_PATH. There are around 60 packages paths there :)

Asked by pavel92 on 2018-10-11 03:08:25 UTC

Even when you delete the build and devel folders and then catkin_make the output is still the same ? I suspect you haven't correctly created the packages inside the catkin workspace and for some reasons you create a new catkin workspace for each package.

Asked by Delb on 2018-10-11 03:12:17 UTC

Maybe try to delete everything (build and devel and content of src), run catkin_make and then put back the source files in the src folder and run catkin_make again.

Asked by Delb on 2018-10-11 03:13:41 UTC

rosrun auto-completion crashes the terminal even in a new and empty workspace after sourcing it. I guess something is broken in my ROS installation. Maybe reinstalling ROS will fix it

Asked by pavel92 on 2018-10-11 05:35:45 UTC

It's likely to be catkin related imo. You can try to go in the setup.bash file and add at the end (it should be 3 instructions only) :

echo $(builtin cd "`dirname "${BASH_SOURCE[0]}"`" > /dev/null && pwd)

Then source the workspace you should have the ouput : /home/pavel/catkin_ws/devel

Asked by Delb on 2018-10-11 07:26:03 UTC

I have experienced similar issues when running an anaconda install of jupyter notebook alongside ROS on the same machine.

Asked by cpetersmeier on 2019-09-18 02:20:11 UTC

The problem is definitely with sourcing ROS installation and package environment. In the past few years I have seen this happen 2 times on 2 different machines. On my machine it managed to get fixed after installing ROS2 in parallel and tinkering with the sourcing of the environments but I still cant pinpoint the exact source of the problem.

Asked by pavel92 on 2019-09-18 02:42:11 UTC

Answers

Maybe a stupid solution but in my case uninstalling and reinstalling Ros helped.

sudo apt-get purge ros-kinetic-*

and then following the tutorial for installing again

Asked by nikeke19 on 2019-06-22 10:25:47 UTC

Comments

I am aware that this is one of the solution but I am trying to pinpoint the source of the problem and avoid reinstalling ROS

Asked by pavel92 on 2019-09-18 02:44:22 UTC

Reinstalling ROS bash worked for me

sudo apt-get install --reinstall ros-kinetic-rosbash

Asked by Anchellon on 2019-09-04 04:23:58 UTC

Comments

I tried that but no luck so far

Asked by pavel92 on 2019-09-18 03:35:39 UTC

TLDR; Use ros-%ROS_DISTRO%-rosbash (e.g. ros-kinetic-rosbash) instead of rosbash.

Our team ran into the similar/same rosrun issue on Ubuntu 16.04 with ROS Kinetic. TLDR, we fixed by installing ros-kinetic-rosbash and removed "upstream" version of rosbash. Command-wise it was:

apt-get purge rosbash && apt-get autoremove
apt-get install ros-kinetic-rosbash

We found in our case rosrun was provided by rosbash (NOT the one hosted on ros.org)

$ which rosrun
/usr/bin/rosrun

After having installed the one from ros.org, I see the path I expect:

$ which rosrun
/opt/ros/kinetic/bin/rosrun

(The reason we had the upstream rosbash installed was that we installed it manually by our mistake.)

Asked by 130s on 2020-05-21 12:29:47 UTC

Comments

Rebuilding my workspace worked for me:

catkin clean --yes -all

catkin build

Asked by Dikshant on 2020-07-02 07:56:32 UTC

Comments

In my case, I just had a large amount of files in the package (was a neural network with many versions and logs). Removing unnecessary files fixed this.

Asked by GeorgeSh on 2020-07-23 05:06:43 UTC

Comments