Posted by Steve on Thu 5 May 2005 at 17:42
Over time most Debian installations acquire packages which are no longer required - they've just been pulled in to satisfy dependencies of software you've since removed. Whilst there are many ways to fix this, the deborphan package is probably the simplest.
deborphan looks for orphaned packages, that is packages which are not required by any other package upon your system.
For example, if you install the game late as follows you'll see that you've pulled in a new package late-data:
root@lappy:~# apt-get install late Reading Package Lists... Done Building Dependency Tree... Done The following extra packages will be installed: late-data The following NEW packages will be installed: late late-data
If you later decide to remove the late package you could do that easily :
dpkg --purge late
But you've left the late-data package upon your system, redundent and orphaned. You could manually remove this, but what about other similar packages you might have lying around, getting needlessly upgraded and wasting disk space?
Enter deborphan. Install it:
root@lappy:~# apt-get install deborphan
Once installed simply run it to display a list of the packages it thinks you don't need upon your system:
skx@lappy:~$ deborphan libsdl-image1.2
(Note that you don't need root privileges to use this tool, it merely reads the installed package lists - it won't remove any packages itself, merely tell you what it thinks you should remove).
As we can see it's decided that the libsdl-image1.2 package isn't required, because no currently installed package depends upon its presence.
There are some other options you can give to the command, which increase it's ability to spot things. These are the "--guess-foo" options. By default it will only list packages which are in the libraries section of the Debian archive, as these are the most likely candidates for removal.
In addition to showing removable library packages it allows you to display potentially orphaned data packages:
skx@lappy:~$ deborphan --guess-data late-data
The manpage shows this option as well as other "guessing" options, and you can read it by invoking:
man deborphan
If you wish to see all the packages which aren't required you could run:
skx@lappy:~$ deborphan --guess-all libxpm-dev libxp-dev xprt-xprintorg libxrandr-dev libxtst-dev pm-dev late-data libjpeg-progs libxmuu-dev libxtrap-dev libhtml-parser-perl libxmu-dev
Most of the packages it reports are development packages, not required per se, but required if you wish to build things from source and link against package libraries.
As with most common jobs in Debian there are alternative methods of cleaning up your system, such as the cruft package.
Additionally some of the package managers such as aptitude and dselect allow you to handle orphaned packages - but I've always thought deborphan was a very underated tool!
Because deborphan requires no setup phase I've always found it simpler to use.
Still each to their own - and like I said there are a few different ways of doing the same job! Steve
-- Steve.org.uk
[ Parent ]
apt-get remove $(deborphan |grep -v shellutils |grep -v textutils)
[ Parent ]
[ Parent ]
apt-get remove `deborphan`
--
Serge van Ginderachter
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
I think from looking at the cruft bug page it looks more neglected than perfect.
That's a shame, it's a long while since I used it but I do remember liking it at the time.
Steve
-- Steve.org.uk
[ Parent ]
[ Parent ]
That's the intention, yes.
Althought it does make sense to look at the list and just check it first - in case it make some mistake.
Steve
-- Steve.org.uk
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
Thanks for the suggestion, I hope this updated version is better for you?
Steve
-- Steve.org.uk
[ Parent ]
Thanks for taking the time to do this again, it's definitely appreciated.
I hope your users are greatful :)
Steve
-- Steve.org.uk
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
Find the list of removed packages by running:
COLUMNS=200 dpkg --list |grep ^r
Or just their names:
COLUMNS=200 dpkg --list |grep ^r | awk '{print $2}'
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]