Using apt autoremove in Ubuntu

Posted on

This article is specifically used to describe on how to remove package in Linux Ubuntu 16.04 operating system which is actually recommended directly by the operating system. The action to remove package automatically is triggered by an update package command executing using ‘apt’ command.

Specifically, after updating package overall, the next step which is done is updating sublime-text. This process is actually triggering autoremove command and it is asked to be executed since therea are specified program or packages listed is considered as  no longer required or used. Below is the sequence event :

1. Updating package using ‘apt-get update’. It is mainly check for the current installed version with the version in the online repository and retrieve information about new and updated packages available. The command is :

apt-get update

Below is the execution of the above command :

root@hostname:/var/www/html/laravel-project/app/Http/Controllers# apt-get update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Get:2 http://dl.google.com/linux/chrome/deb stable Release [1.189 B]                                            
Hit:4 http://archive.ubuntu.com/ubuntu xenial InRelease                                                                                          
Hit:5 http://us.archive.ubuntu.com/ubuntu xenial InRelease                                                          
Hit:6 http://ppa.launchpad.net/atareao/telegram/ubuntu xenial InRelease                                             
Get:7 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]                                          
Hit:8 http://archive.canonical.com/ubuntu xenial InRelease                                          
Hit:9 http://ppa.launchpad.net/gns3/ppa/ubuntu xenial InRelease                                           
Ign:10 http://downloads-distro.mongodb.org/repo/debian-sysvinit dist InRelease                                                             
Hit:11 http://ppa.launchpad.net/inkscape.dev/stable/ubuntu xenial InRelease    
Hit:12 http://downloads-distro.mongodb.org/repo/debian-sysvinit dist Release                    
Get:14 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-11 Metadata [306 kB]
Hit:15 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease
Hit:16 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu xenial InRelease
Get:17 http://us.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons [187 kB]
Get:18 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 DEP-11 Metadata [133 kB]
Get:19 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons [162 kB]
Get:20 http://us.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 DEP-11 Metadata [2.516 B]                                                                                                                             
Fetched 894 kB in 6s (135 kB/s)                                                                                                                                                                                                  
AppStream cache update completed, but some metadata was ignored due to errors.
Reading package lists... Done
W: http://downloads-distro.mongodb.org/repo/debian-sysvinit/dists/dist/Release.gpg: Signature by key 492EAFE8CD016A07919F1D2B9ECBEC467F0CEB10 uses weak digest algorithm (SHA1)
root@hostname:/var/www/html/laravel-project/app/Http/Controllers# apt-get install --only-upgrade sublime-text-installer
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package sublime-text-installer is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  sublime-text

E: Package 'sublime-text-installer' has no installation candidate
You have new mail in /var/mail/root
root@hostname:/var/www/

Depends on the condition or circumstances, the recommendation to auto remove package can arise differently. In this case, the opportunity to auto remove the package using apt utility comes when the process of updating sublime-text editor is executed as the next step.

2. Updating sublime-text editor which is directly triggered a request to execute apt autoremove command so that any packages no longer required or used can be automatically removed :

root@hostname:/var/www/html/laravel-project/app/Http/Controllers# apt-get install --only-upgrade sublime-text
Reading package lists... Done
Building dependency tree       
Reading state information... Done
sublime-text is already the newest version (2.0.2-1~webupd8~3).
The following packages were automatically installed and are no longer required:
  libjs-coffeescript libjs-jquery-ui nginx-common redmine-sqlite ruby-actionmailer ruby-actionpack ruby-actionpack-action-caching ruby-actionpack-xml-parser ruby-actionview ruby-activejob ruby-activemodel ruby-activerecord
  ruby-activesupport ruby-addressable ruby-arel ruby-atomic ruby-awesome-nested-set ruby-binding-of-caller ruby-blankslate ruby-builder ruby-byebug ruby-coderay ruby-coffee-rails ruby-coffee-script ruby-coffee-script-source
  ruby-columnize ruby-css-parser ruby-debug-inspector ruby-execjs ruby-globalid ruby-hike ruby-hmac ruby-htmlentities ruby-jbuilder ruby-jquery-rails ruby-json ruby-loofah ruby-mail ruby-multi-json ruby-net-ldap ruby-oj
  ruby-openid ruby-polyglot ruby-protected-attributes ruby-rack-openid ruby-rack-test ruby-rails ruby-rails-deprecated-sanitizer ruby-rails-dom-testing ruby-rails-html-sanitizer ruby-rails-observers ruby-railties ruby-rbpdf
  ruby-rbpdf-font ruby-redcarpet ruby-request-store ruby-rmagick ruby-roadie ruby-roadie-rails ruby-sass ruby-sass-rails ruby-sdoc ruby-spring ruby-sprockets ruby-sprockets-rails ruby-thread-safe ruby-tilt ruby-treetop
  ruby-turbolinks ruby-tzinfo ruby-uglifier ruby-web-console
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 661 not upgraded.
root@hostname:/var/www/html/laravel-project/app/Http/Controllers# apt-get autoremove install --only-upgrade sublime-text
Reading package lists... 0%
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package install
root@hostname:/var/www/html/laravel-project/app/Http/Controllers# 

There is an output states  to remove unnecessary package or application, it can be done by executing the command ‘apt autoremove’ in the line output above :

Use 'apt autoremove' to remove them.

Below is the execution of the command to auto remove the package :

apt autoremove

The output of the above command executed in the command line can be shown below :

root@hostname:/var/www/html/laravel-project/app/Http/Controllers# apt autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  libjs-coffeescript libjs-jquery-ui nginx-common redmine-sqlite ruby-actionmailer ruby-actionpack ruby-actionpack-action-caching ruby-actionpack-xml-parser ruby-actionview ruby-activejob ruby-activemodel ruby-activerecord
  ruby-activesupport ruby-addressable ruby-arel ruby-atomic ruby-awesome-nested-set ruby-binding-of-caller ruby-blankslate ruby-builder ruby-byebug ruby-coderay ruby-coffee-rails ruby-coffee-script ruby-coffee-script-source
  ruby-columnize ruby-css-parser ruby-debug-inspector ruby-execjs ruby-globalid ruby-hike ruby-hmac ruby-htmlentities ruby-jbuilder ruby-jquery-rails ruby-json ruby-loofah ruby-mail ruby-multi-json ruby-net-ldap ruby-oj
  ruby-openid ruby-polyglot ruby-protected-attributes ruby-rack-openid ruby-rack-test ruby-rails ruby-rails-deprecated-sanitizer ruby-rails-dom-testing ruby-rails-html-sanitizer ruby-rails-observers ruby-railties ruby-rbpdf
  ruby-rbpdf-font ruby-redcarpet ruby-request-store ruby-rmagick ruby-roadie ruby-roadie-rails ruby-sass ruby-sass-rails ruby-sdoc ruby-spring ruby-sprockets ruby-sprockets-rails ruby-thread-safe ruby-tilt ruby-treetop
  ruby-turbolinks ruby-tzinfo ruby-uglifier ruby-web-console
0 upgraded, 0 newly installed, 72 to remove and 661 not upgraded.
After this operation, 32,1 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 907285 files and directories currently installed.)
Removing ruby-turbolinks (2.5.3-2) ...
Removing ruby-coffee-rails (4.1.0-2) ...
Removing ruby-coffee-script (2.4.1-1) ...
Removing ruby-coffee-script-source (1.9.1.1-1) ...
Removing libjs-coffeescript (1.9.3~dfsg-1) ...
Removing ruby-jquery-rails (4.0.5-1) ...
Removing libjs-jquery-ui (1.10.1+dfsg-1) ...
Removing nginx-common (1.10.0-0ubuntu0.16.04.4) ...
Removing redmine-sqlite (3.2.1-2) ...
Removing ruby-rails (2:4.2.6-1) ...
Removing ruby-actionmailer (2:4.2.6-1) ...
Removing ruby-web-console (2.2.1-2) ...
Removing ruby-sass-rails (5.0.4-1) ...
Removing ruby-sprockets-rails (2.3.2-1) ...
Removing ruby-roadie-rails (1.1.0-1) ...
Removing ruby-railties (2:4.2.6-1) ...
Removing ruby-actionpack-action-caching (1.1.1-4) ...
Removing ruby-actionpack-xml-parser (1.0.2-2) ...
Removing ruby-activejob (2:4.2.6-1) ...
Removing ruby-protected-attributes (1.1.3-1) ...
Removing ruby-rails-observers (0.1.2-1) ...
Removing ruby-activerecord (2:4.2.6-1) ...
Removing ruby-jbuilder (2.3.1-1) ...
Removing ruby-roadie (3.1.1-1) ...
Removing ruby-css-parser (1.3.6-1) ...
Removing ruby-addressable (2.3.8-1) ...
Removing ruby-arel (6.0.3-2) ...
Removing ruby-awesome-nested-set (3.0.0-1) ...
Removing ruby-binding-of-caller (0.7.2+debian1-3) ...
Removing ruby-byebug (5.0.0-1build3) ...
Removing ruby-coderay (1.1.1-1) ...
Removing ruby-columnize (0.9.0-1) ...
Removing ruby-debug-inspector (0.0.2-1.1build3) ...
Removing ruby-uglifier (2.7.2-1) ...
Removing ruby-execjs (2.6.0-1) ...
Removing ruby-globalid (0.3.6-1) ...
Removing ruby-sprockets (3.3.0-1) ...
Removing ruby-hike (1.2.1-3) ...
Removing ruby-rack-openid (1.4.2-1) ...
Removing ruby-openid (2.7.0debian-1) ...
Removing ruby-hmac (0.4.0-4build1) ...
Removing ruby-rbpdf (1.19.0-1) ...
Removing ruby-htmlentities (4.3.3-1) ...
Removing ruby-sdoc (0.4.1-1) ...
Removing ruby-mail (2.6.3+dfsg1-1) ...
Removing ruby-multi-json (1.11.2-3) ...
Removing ruby-net-ldap (0.8.0-1) ...
Removing ruby-oj (2.12.10-4build1) ...
Removing ruby-treetop (1.6.3-1) ...
Removing ruby-polyglot (0.3.4-1) ...
Removing ruby-rbpdf-font (1.19.0-1) ...
Removing ruby-redcarpet (3.3.4-2build1) ...
Removing ruby-request-store (1.3.0-1) ...
Removing ruby-rmagick (2.15.4-2build3) ...
Removing ruby-sass (3.4.21-1) ...
Removing ruby-spring (1.3.6-2) ...
Removing ruby-tilt (2.0.1-2) ...
Removing ruby-actionpack (2:4.2.6-1) ...
Removing ruby-actionview (2:4.2.6-1) ...
Removing ruby-activemodel (2:4.2.6-1) ...
Removing ruby-rails-dom-testing (1.0.6-1) ...
Removing ruby-rails-deprecated-sanitizer (1.0.3-1) ...
Removing ruby-activesupport (2:4.2.6-1) ...
Removing ruby-tzinfo (1.2.2-1) ...
Removing ruby-thread-safe (0.3.5-3) ...
Removing ruby-atomic (1.1.16-2build5) ...
Removing ruby-builder (3.2.2-4) ...
Removing ruby-blankslate (3.1.3-1) ...
Removing ruby-json (1.8.3-1build4) ...
Removing ruby-rails-html-sanitizer (1.0.3-2) ...
Removing ruby-loofah (2.0.3-2) ...
Removing ruby-rack-test (0.6.3-1) ...
Processing triggers for man-db (2.7.5-1) ...
root@hostname:/var/www/html/laravel-project/app/Http/Controllers# 

Based on the above output, packages which can be removed by the command ‘apt autoremove’ command has already succesfully executed.

2 thoughts on “Using apt autoremove in Ubuntu

Leave a Reply