Tech Tip: Removing Unnecessary Packages on Debian Systems
The command deborphan can be used to check for unnecessary (orphaned) packages. By default deborphan searches for orphaned libraries, but you can have it search for other types of packages also: data packages, dev packages, etc. by specifying one of its many --guess-* command line options.
If you don't have deborphan installed you can install it via:
$ sudo apt-get install deborphan
Now, to remove all orphaned (library) packages simply run:
$ sudo deborphan | xargs apt-get -y remove purge
To remove all orphaned data packages run:
$ sudo deborphan --guess-dev | xargs apt-get -y remove purge
To see all the orphaned packages on your system run:
$ deborphan --guess-all
The following excerpt comes from the deborphan man page and relates to the --guess-* options:
deborphan can try to guess what packages may not be of much use to you by examining the package's name. It will pretend the package is in the main/libs section, and report it as if it were a library. This method is in no way perfect or even reliable, so beware when using this!
So it's usually a good idea to view the output of deborphan and make sure that it appears reasonable before feeding it to apt-get -y remove purge.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- Designing Electronics with Linux
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Dynamic DNS—an Object Lesson in Problem Solving
- Validate an E-Mail Address with PHP, the Right Way
- What's the tweeting protocol?
- Mediated Reality: University of Toronto RWM Project
- New Products
- Using Salt Stack and Vagrant for Drupal Development
- Dart: a New Web Programming Experience
- OpenOffice.org Off-the-Wall: ToCs, Indexes and Bibliographies in OOo Writer
- General
56 min 50 sec ago - Kernel Problem
10 hours 59 min ago - BASH script to log IPs on public web server
15 hours 26 min ago - DynDNS
19 hours 2 min ago - Reply to comment | Linux Journal
19 hours 34 min ago - All the articles you talked
21 hours 58 min ago - All the articles you talked
22 hours 1 min ago - All the articles you talked
22 hours 2 min ago - myip
1 day 2 hours ago - Keeping track of IP address
1 day 4 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?



Comments
A less extreme aproach
I usually like to pipe it too markauto rather than immediately using purge so that aptitude gets a vote in the removal process.
test first:
deborphan --guess-all | xargs aptitude -ys markauto
then do it:
deborphan --guess-all | xargs aptitude -y markauto
then I remove all lingering configs with
test first:
aptitude search ~c
then do it:
aptitude purge ~c
Sorry, I ment
Sorry, I ment autoremove.
When i remove or purge something that was installed with "suggested" or with a lot of dependencys and something was left, the "autoremove" removes them.
For example I installed "extremetuxracer", "removed" it and used autoremove after:
sudo apt-get autoremove
Reading package lists ... Done
Building dependency tree
Reading state information ... Done
The following packages will be REMOVED:
extremetuxracer-date
libmikmod2
libsdl-mixer1.2
libsmpeg0
tcl8.5
0 upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
After this operation there will be released 37.4 MB of disk space.
Continue [Y / n] ? Y
(Reading database ... 62,198 files and directories currently installed.)
Removing extremetuxracer-date ...
Removing libsdl-mixer1.2 ...
Removing libmikmod2 ...
Removing libsmpeg0 ...
Removing tcl8.5 ...
Processing triggers for man-db ...
Processing triggers for menu ...
My man for apt-get:
APT-GET(8)
NAME
apt-get - APT package handling utility -- command-line interface
SYNOPSIS
apt-get [-sqdyfmubV] [-o= config_string ] [-c= config_file ] [-t= { target_release_name | target_
release_number_expression }] {update | upgrade | dselect-upgrade | dist-upgrade | install pkg [ { =pkg_version_number | /target_release_name } ] ... | remove pkg... | purge pkg... | source pkg [ =pkg_version_number ] ... | build-dep pkg... | check | clean | autoclean | autoremove | {-v | --version} | {-h | --help}}
autoclean
Like clean, autoclean clears out the local repository of retrieved package files. The difference is that it only removes package files that can no longer be downloaded, and are largely useless. This allows a cache to be maintained over a long period without it growing out of control. The configuration option APT::Clean-Installed will prevent installed packages from being erased if it is set to off.
autoremove
autoremove is used to remove packages that were automatically installed to satisfy dependencies for some package and that are no more needed.
apt v:0.7.20.2+lenny1
Similar
Guess I was looking at an old man page, I didn't see the autoremove option (I use openSUSE so I'm not a regular apt-get user). I found a newer man page and yes it is there.
So, yes, autoremove is similar to deborphan but from what I read they don't always produce the same results (in terms of what they think can be removed).
Mitch Frazier is an Associate Editor for Linux Journal.
And what about apt-get
And what about apt-get auroremove ? Or apt-get autoclean ?
Different Thing Completely
That's something completely different, from the man page:
I don't see an "autoremove" option, or "auroremove" for that matter.
Mitch Frazier is an Associate Editor for Linux Journal.
See above
I was looking at an old man page, autoremove does exist, see the comment above.
I use openSUSE so I don't use apt-get very often.
Mitch Frazier is an Associate Editor for Linux Journal.
Status file is in an improper state
deborphan installed fine, but when I ran 'deborphan --guess-all' I got the error message below:
deborphan: The status file is in an improper state.
One or more packages are marked as half-installed, half-configured,
unpacked, triggers-awaited or triggers-pending. Exiting.
Any suggestions?
Check These
Check these two boogs:
Boog 1
Boog 2
(found at sidux).
Mitch Frazier is an Associate Editor for Linux Journal.
Thanks! I ran the command
Thanks! I ran the command below and it showed me which packages had an error.
egrep '^Status: |^Package: ' /var/lib/dpkg/status | egrep -B 1 'half-installed|half-configured|unpacked|triggers-awaited|triggers-pending'
deborphan works now.
doesn't aptitude do this?
How is this different from 'sudo aptitude purge ~c'?
Aptitude ~c
According to the aptitude manual:
On the other hand, deborphan attempts to find packages which are installed but which are no longer needed, at least not needed by any of the other installed packages.
Mitch Frazier is an Associate Editor for Linux Journal.