Automatically Remove Packages in Ubuntu

It is possible that removing some packages on your Debian, Ubuntu or Mint Linux system will leave a number of software packages behind. Although they are not required by any existing package, they are still kept until you implicitly remove them.

Packages That Are No Longer Required

You will probably see a message like this every time when you’re running apt or apt-get command (using sudo, of course):

The following packages were automatically installed and are no longer required:
...
Use 'sudo apt autoremove' to remove them.

This happens when you run apt/apt-get for any reason. For instance, I’m trying to install a PCAP library, but look at all the packages that can be autoremoved:

greys@xps:/home/greys$ sudo apt install libpcap-dev
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following packages were automatically installed and are no longer required:
adobe-flashplugin cabextract chromium-codecs-ffmpeg-extra gstreamer1.0-vaapi libaribb24-0 libavcodec-extra
libbasicusageenvironment1 libcddb2 libdrm-dev libdvbpsi10 libebml4v5 libegl1-mesa-dev libgl1-mesa-dev libgles1
libgles2-mesa-dev libglu1-mesa-dev libglvnd-core-dev libglvnd-dev libgroupsock8 libhal1-flash libhunspell-dev
libjs-jquery libjs-jquery-scrollto liblivemedia62 liblua5.2-0 libmad0 libmatroska6v5 libmicrodns0 libminizip1
libmspack0 libnfs11 libopengl0 libopenmpt-modplug1 libplacebo4 libprotobuf-lite10 libpthread-stubs0-dev
libresid-builder0c2a libsdl-image1.2 libsidplay2 libssh2-1 libunshield0 libupnp6 libusageenvironment3 libva-wayland2
libvlc-bin libvlc5 libvlccore9 libwayland-bin libwayland-dev libx11-dev libx11-xcb-dev libxau-dev libxcb-dri2-0-dev
libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-shape0-dev
libxcb-sync-dev libxcb-xfixes0-dev libxcb1-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev
libxshmfence-dev libxxf86vm-dev mesa-common-dev qt5-qmake qt5-qmake-bin qtchooser sigil-data unshield vlc-bin
vlc-data vlc-l10n vlc-plugin-base vlc-plugin-notify vlc-plugin-video-output x11proto-core-dev x11proto-damage-dev
x11proto-dev x11proto-fixes-dev x11proto-xext-dev x11proto-xf86vidmode-dev xorg-sgml-doctools xtrans-dev
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libpcap0.8-dev
The following NEW packages will be installed:
libpcap-dev libpcap0.8-dev
0 upgraded, 2 newly installed, 0 to remove and 251 not upgraded.
Need to get 221 kB of archives.
After this operation, 748 kB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.

Use apt autoremove to uninstall software packages

as suggested, this is what happens when I run apt autoremove:

greys@xps:/home/greys$ sudo apt autoremove
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following packages will be REMOVED:
adobe-flashplugin cabextract chromium-codecs-ffmpeg-extra gstreamer1.0-vaapi libaribb24-0 libavcodec-extra
libbasicusageenvironment1 libcddb2 libdrm-dev libdvbpsi10 libebml4v5 libegl1-mesa-dev libgl1-mesa-dev libgles1
libgles2-mesa-dev libglu1-mesa-dev libglvnd-core-dev libglvnd-dev libgroupsock8 libhal1-flash libhunspell-dev
libjs-jquery libjs-jquery-scrollto liblivemedia62 liblua5.2-0 libmad0 libmatroska6v5 libmicrodns0 libminizip1
libmspack0 libnfs11 libopengl0 libopenmpt-modplug1 libplacebo4 libprotobuf-lite10 libpthread-stubs0-dev
libresid-builder0c2a libsdl-image1.2 libsidplay2 libssh2-1 libunshield0 libupnp6 libusageenvironment3 libva-wayland2
libvlc-bin libvlc5 libvlccore9 libwayland-bin libwayland-dev libx11-dev libx11-xcb-dev libxau-dev libxcb-dri2-0-dev
libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-shape0-dev
libxcb-sync-dev libxcb-xfixes0-dev libxcb1-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev
libxshmfence-dev libxxf86vm-dev mesa-common-dev qt5-qmake qt5-qmake-bin qtchooser sigil-data unshield vlc-bin
vlc-data vlc-l10n vlc-plugin-base vlc-plugin-notify vlc-plugin-video-output x11proto-core-dev x11proto-damage-dev
x11proto-dev x11proto-fixes-dev x11proto-xext-dev x11proto-xf86vidmode-dev xorg-sgml-doctools xtrans-dev
0 upgraded, 0 newly installed, 88 to remove and 251 not upgraded.
After this operation, 131 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 270228 files and directories currently installed.)
Removing adobe-flashplugin (1:20190212.1-0ubuntu0.18.04.1) ...
Removing cabextract (1.6-1.1) ...
Removing chromium-codecs-ffmpeg-extra (71.0.3578.98-0ubuntu0.18.04.1) ...
Removing gstreamer1.0-vaapi:amd64 (1.14.1-1~ubuntu18.04.1) ...
Removing vlc-plugin-base:amd64 (3.0.4-1ubuntu0.2) ...
Removing libaribb24-0:amd64 (1.0.3-1) ...
Removing libavcodec-extra (7:3.4.4-0ubuntu0.18.04.1) ...
Removing libbasicusageenvironment1:amd64 (2018.02.18-1) ...
Removing libcddb2 (1.3.2-5fakesync1) ...
Removing libgles2-mesa-dev:amd64 (18.2.2-0ubuntu1~18.04.2) ...
Removing libegl1-mesa-dev:amd64 (18.2.2-0ubuntu1~18.04.2) ...
Removing libglu1-mesa-dev:amd64 (9.0.0-2.1build1) ...
Removing libgl1-mesa-dev:amd64 (18.2.2-0ubuntu1~18.04.2) ...
Removing mesa-common-dev:amd64 (18.2.2-0ubuntu1~18.04.2) ...
Removing libdrm-dev:amd64 (2.4.95-1~18.04.1) ...
Removing libdvbpsi10:amd64 (1.3.2-1) ...
Removing libmatroska6v5:amd64 (1.4.8-1.1) ...
Removing libebml4v5:amd64 (1.3.5-2) ...
Removing libglvnd-dev:amd64 (1.0.0-2ubuntu2.2) ...
Removing libgles1:amd64 (1.0.0-2ubuntu2.2) ...
Removing libglvnd-core-dev:amd64 (1.0.0-2ubuntu2.2) ...
Removing libgroupsock8:amd64 (2018.02.18-1) ...
Removing libhal1-flash (0.3.3-2) ...
Removing libhunspell-dev:amd64 (1.6.2-1) ...
Removing libjs-jquery-scrollto (2.1.2+dfsg-4) ...
Removing libjs-jquery (3.2.1-1) ...
Removing liblivemedia62:amd64 (2018.02.18-1) ...
Removing liblua5.2-0:amd64 (5.2.4-1.1build1) ...
Removing libmad0:amd64 (0.15.1b-9ubuntu18.04.1) ...
Removing libmicrodns0:amd64 (0.0.8-1) ...
Removing libminizip1:amd64 (1.1-8build1) ...
Removing libmspack0:amd64 (0.6-3ubuntu0.2) ...
Removing libnfs11:amd64 (2.0.0-1~exp1) ...
Removing libopengl0:amd64 (1.0.0-2ubuntu2.2) ...
Removing libopenmpt-modplug1:amd64 (0.3.6-1) ...
Removing vlc-plugin-video-output:amd64 (3.0.4-1ubuntu0.2) ...
Removing libplacebo4:amd64 (0.4.0-2) ...
Removing libprotobuf-lite10:amd64 (3.0.0-9.1ubuntu1) ...
Removing libx11-xcb-dev:amd64 (2:1.6.4-3ubuntu0.2) ...
Removing libxxf86vm-dev:amd64 (1:1.1.4-1) ...
Removing libresid-builder0c2a (2.1.1-15ubuntu1) ...
Removing libsdl-image1.2:amd64 (1.2.12-8) ...
Removing libsidplay2 (2.1.1-15ubuntu1) ...
Removing libssh2-1:amd64 (1.8.0-1) ...
Removing unshield (1.4.2-1) ...
Removing libunshield0:amd64 (1.4.2-1) ...
Removing libupnp6:amd64 (1:1.6.24-4) ...
Removing libusageenvironment3:amd64 (2018.02.18-1) ...
Removing libva-wayland2:amd64 (2.1.0-3) ...
Removing vlc-bin (3.0.4-1ubuntu0.2) ...
Removing libvlc-bin:amd64 (3.0.4-1ubuntu0.2) ...
Removing libvlc5:amd64 (3.0.4-1ubuntu0.2) ...
Removing vlc-plugin-notify:amd64 (3.0.4-1ubuntu0.2) ...
Removing libvlccore9:amd64 (3.0.4-1ubuntu0.2) ...
Removing libwayland-dev:amd64 (1.16.0-1ubuntu1.1~18.04.1) ...
Removing libwayland-bin (1.16.0-1ubuntu1.1~18.04.1) ...
Removing libxcb-dri2-0-dev:amd64 (1.13-1) ...
Removing libxcb-dri3-dev:amd64 (1.13-1) ...
Removing libxcb-glx0-dev:amd64 (1.13-1) ...
Removing libxcb-present-dev:amd64 (1.13-1) ...
Removing libxcb-randr0-dev:amd64 (1.13-1) ...
Removing libxcb-xfixes0-dev:amd64 (1.13-1) ...
Removing libxcb-render0-dev:amd64 (1.13-1) ...
Removing libxcb-shape0-dev:amd64 (1.13-1) ...
Removing libxcb-sync-dev:amd64 (1.13-1) ...
Removing libxdamage-dev:amd64 (1:1.1.4-3) ...
Removing libxext-dev:amd64 (2:1.3.3-1) ...
Removing libxfixes-dev:amd64 (1:5.0.3-1) ...
Removing libxshmfence-dev:amd64 (1.3-1) ...
Removing qt5-qmake:amd64 (5.9.5+dfsg-0ubuntu1) ...
Removing qt5-qmake-bin (5.9.5+dfsg-0ubuntu1) ...
Removing qtchooser (64-ga1b6736-5) ...
Removing sigil-data (0.9.12+dfsg-1ubuntu1804) ...
Removing vlc-data (3.0.4-1ubuntu0.2) ...
Removing vlc-l10n (3.0.4-1ubuntu0.2) ...
Removing x11proto-damage-dev (1:2018.4-4) ...
Removing x11proto-xf86vidmode-dev (2018.4-4) ...
Removing x11proto-xext-dev (2018.4-4) ...
Removing x11proto-fixes-dev (1:2018.4-4) ...
Removing libx11-dev:amd64 (2:1.6.4-3ubuntu0.2) ...
Removing libxcb1-dev:amd64 (1.13-1) ...
Removing libpthread-stubs0-dev:amd64 (0.3-4) ...
Removing libxau-dev:amd64 (1:1.0.8-1) ...
Removing libxdmcp-dev:amd64 (1:1.1.2-3) ...
Removing x11proto-core-dev (2018.4-4) ...
Removing x11proto-dev (2018.4-4) ...
Removing xorg-sgml-doctools (1:1.11-1) ...
Removing xtrans-dev (1.3.5-1) ...
Processing triggers for sgml-base (1.29) ...
Processing triggers for mintsystem (8.4.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
greys@xps:/dist/wireshark/wireshark-ninja$

Just to finish this brief example, here’s what happens when I try the same apt install command again. Note how there are no more packages suggested for auto-remove:

greys@xps:/home/greys$ sudo apt install libpcap-dev
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following additional packages will be installed:
libpcap0.8-dev
The following NEW packages will be installed:
libpcap-dev libpcap0.8-dev
0 upgraded, 2 newly installed, 0 to remove and 251 not upgraded.
Need to get 221 kB of archives.
After this operation, 748 kB of additional disk space will be used.
Do you want to continue? [Y/n]

##See Also




Contact Me

Follow me on Facebook, Twitter or Telegram:
Recommended
I learn with Educative: Educative
IT Consultancy
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!
Recent Articles
03 Sep 2024

macOS Sequoia 15.0

02 Sep 2024

Video: Has This Worked Before?

24 Mar 2024

Homelab: Mac Pro 2013 32GB

Recent Tweets