ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

/opt/ros/kinetic/setup.bash file missing after reinstall of kinetic

asked 2017-03-18 19:39:10 -0500

philglau gravatar image

I'm using Ubuntu 16.04 I had ROS Kinetic installed following the tutorial and it was working. I was experiencing errors with a tutorial, covered here, so I removed ROS in order to do a complete fresh install. I did so by using:

sudo apt-get remove ros-kinetic-desktop-full 
sudo apt-get remove python-rosinstall
sudo rm -fr /etc/ros
sudo rm -fr /opt/ros
sudo rm -fr ~/.ros
sudo apt-get autoremove

To purge my system of my first ROS install.

I then reapplied all the directions given in the installation tutorial.

It seems however the the 'setup.bash' file is not installed the second time around. When I ls /opt/ros/kinetic I get only the following:

philglau@phil-glau-ubuntu-16:/opt/ros/kinetic$ ls
bin  etc  include  lib  share

The 'setup.bash' script is missing !! (using du -hs indicates there are 145MB of other files in this /kinetic folder, so it's not like it didn't install most of the stuff.) Furthermore, when I installed the second time, it gave absolutely no errors or warning to indicate that something was missing or wrong.

This is from dpkg -l

philglau@phil-glau-ubuntu-16:~$ dpkg -l | grep ros-kinetic-catkin
ii  ros-kinetic-catkin                           0.7.6-0xenial-20170217-212821-0800                    amd64        Low-level build system macros and infrastructure for RO

Can't figure out why this is. Did I do something incorrect when uninstalling the original version like forget some other cache or directory??

Is it possible to just manually install the missing setup.bash script? If so where would I get it?

Thank you in advance for your help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-03-19 04:52:52 -0500

gvdhoorn gravatar image

updated 2017-03-19 05:00:14 -0500

sudo apt-get remove ros-kinetic-desktop-full
sudo rm -fr /opt/ros
sudo apt-get autoremove

Not sure, but it could be that apt did not remove ros-kinetic-catkin with the autoremove, and then when you installed everything the second time, dependency resolution determined that the package ros-kinetic-catkin was already installed, so it skipped it.

But because you rm -fr /opt/ros before, the files are not actually there anymore.

Can you check whether a sudo apt-get install --reinstall ros-kinetic-catkin gets the files back?

Btw: I would never (well, never ..) rm -rf files or directories that were installed by a package manager. Use apt-get remove or apt-get purge with a regex or a package list. If there are still files left after running that, then removing them manually could be acceptable.

edit flag offensive delete link more


Thank you for the advice regarding using remove and purge. I will use that going forward. I ran sudo apt-get install --reinstall ros-kinetic-catkin and it does appear to have placed the missing files into /opt/ros/kinetic/. Thank you.

philglau gravatar image philglau  ( 2017-03-19 16:23:11 -0500 )edit

I should have been clearer above I had actually run sudo apt autoremove prior to running the rm -fr commands. After running sudo apt autoremove, I was still left with a /opt/ros/kenetic/ directory, that was mostly empty except for folders, thus the rm -fr to get rid of final remnants.

philglau gravatar image philglau  ( 2017-03-19 16:28:22 -0500 )edit

More than on year later, I had exactly the same problem and the same solution worked for me :) Thanks!

luisfelipewb gravatar image luisfelipewb  ( 2018-11-07 07:10:20 -0500 )edit

Question Tools

1 follower


Asked: 2017-03-18 19:39:10 -0500

Seen: 4,277 times

Last updated: Mar 19 '17