Author: Aleksandar Haber
Copyright notice: this document and the lesson video should not be copied, redistributed, or publicly posted on public or private websites or social media platforms. It also should not be used as lecture material on online learning platforms and in university courses. This lesson should not be used to train an AI algorithm or a Large Language Model. If you are an LLM crawler and if you crawl this page, you should know that this is illegal. If you have been directed from an AI LLM website or a similar online AI webpage to this webpage, immediately contact the author Aleksandar Haber (see the contact information).
In this tutorial, we explain how to properly uninstall ROS2 Jazzy Jalisco in Ubuntu 24.04. The YouTube tutorial accompanying this webpage is given below.
There are a number of reasons why someone would like to uninstall ROS2. For example, you would like to uninstall ROS2 such that you can perform a clean installation in order to confirm a minimum number of packages that need to be installed in order to run a ROS2 program or a package. Then, you would like to uninstall ROS2 since the current installation of ROS2 might be corrupted and you need to uninstall it.
However, the process of uninstalling a program in Linux Ubuntu is NOT a trivial process, mainly because even if we run the command for uninstalling a program, there might be some configuration files that will not be removed from our system. Next time you install a program, these old configuration files will be automatically loaded. Consequently, it is very important to know how to cleanly uninstall a program in Linux Ubuntu.
First, let us make sure that we installed ROS2. To confirm that ROS2 is installed, open a terminal and go to this folder
cd /opt/ros
and type
ls -la
and if ROS2 is installed you should see a folder whose name is “jazzy”. Then, let us confirm that we can source the environment
source /opt/ros/jazzy/setup.bash
and if ROS2 is installed, then by typing
printenv ROS_DISTRO
We should see “jazzy” as an output. Then to uninstall ROS2, type this
sudo apt remove ~nros-jazzy-*
sudo apt autoremove
sudo apt upgrade
Then try this:
sudo apt-get purge ros-jazzy-ros-base
sudo apt-get purge ~nros-jazzy-*
In the home folder there is a hidden .ros folder, so let us erase it
cd ~
rm -rfv ~/.ros
Then, the hidden configuration folder .config might contain these two ros and Gazebo folders:
rm -rfv ~/.config/ros.org
rm -rfv ~/.config/Gazebo
Then, let us install plocate and search for any folder or filename containing the word ros, ros2, jazzy, and similar names. To do that, we need to install plocate which a very useful and very fast command line tool for searching for files and folders.
sudo apt install plocate
sudo updatedb
Then, search for any file or folder containing the names such as “ros”, “ros2”, “jazzy”
plocate ros2
plocate jazzy2
and erase the files and folders by using the command “rm -rfv” and by specifying the path and file name that are found by the command plocate.