After realizing my beginner’s mistake of choosing the wrong ROS distribution to start my self-education, I set out to downgrade my ROS distribution from the newer but less supported “L” (Lunar) release to the previous “K” (Kinetic) release. Given the sheer number of different packages involved in a ROS installation, I had been worried this was going to be a tangled mess chasing down files all over the operating system. Fortunately, this was not the case, though there were a few hiccups that I’ll document today for other fellow beginners in the future.
The first step is to undo the package installation, which can be accomplished by asking the Ubuntu package manager to remove the desktop package I used to install.
sudo apt remove ros-lunar-desktop-full
Once the top-level package was removed, all of its related packages were marked as unnecessary and could be auto-removed.
sudo apt autoremove
At this point ROS Lunar is gone. If a new terminal is opened at this point, there will be an error because the Lunar setup script called by ~/.bashrc
is gone.
bash: /opt/ros/lunar/setup.bash: No such file or directory
This is not an immediate problem. We can leave it for now and install Kinetic.
sudo apt install ros-kinetic-desktop-full
After this completes, we can edit ~/.bashrc
and change the reference from /opt/ros/lunar/setup.bash
to /opt/ros/kinetic/setup.bash
. This will address the above “No such file or directory” error when opening up a new terminal.
Then we can fix up the build environment. If we now go into the catkin workspace and run source devel/setup.bash
as usual, that command will succeed but trying to run catkin_make
will result in an error:
The program 'catkin_make' is currently not installed. You can install it by typing:
sudo apt install catkin
This is a misleading error message because catkin_make was installed as part of ROS Kinetic. However, devel/setup.bash
still pointed to ROS Lunar which is now gone and that’s why our system believes catkin_make is not installed.
How to fix this: open a new terminal window but do NOT run source devel/setup.bash
. Go into the catkin workspace and run catkin_make
there. This will update devel/setup.bash
for ROS Kinetic. After this completes, it is safe to run source devel/setup.bash
to set up ROS Kinetic. Now catkin_make
will execute successfully using ROS Kinetic version of files, and we’re back in business!