This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature: Debian

Three scripts for package management on Debian and Ubuntu systems

By Bruce Byfield on October 29, 2008 (3:00:00 PM)

Share    Print    Comments   

Five of the top 10 most downloaded distributions on Distrowatch use the Debian package system. It has developed a rich infrastructure of utilities -- not just the core commands apt-get and dpkg, but also such less well-known commands as apt-cache, apt-spy, and apt-listbugs. In addition, an array of other scripts, some mashups of existing utilities, and some original, are regularly available on sites like openDesktop.org. Such scripts help to streamline the process of keeping a Debian-based package system in working order, and provide information to help you make better decisions about software installation.

These scripts join a host of graphical front ends to apt-get and GUI tools for searching package repositories. However, because efficient package management is still done at the command line, they have a relevance that many command lines tools lack today. Some are simple, some are specific to one distribution (usually Ubuntu), and you might need to modify them before they suit your needs. However, all can be surprisingly useful if you believe in making hands-on decisions about the contents of your system instead of relying on the update applet in your notification tray. Here are three excellent examples.

Apt-utility

Apt-utility is a simple bash script designed for those who like to keep their systems constantly up to date, and would prefer not to enter the commands one at a time.

Unfortunately, the script is a little muddled in the apt-get commands that it issues. It begins, reasonably enough, by using apt-get update to make sure that the package repositories are current. However, it then runs apt-get upgrade, followed immediately by apt-get dist-upgrade -- which is a redundancy, since dist-upgrade does everything that upgrade does, as well as handling the dependencies in new versions of packages. Then it runs apt-get clean, followed by apt-get autoclean, leaving autoclean with nothing to do, since clean has already cleared out the /var/cache/apt/archives directory. The script ends with apt-get autoremove to remove packages that were installed as dependencies for packages that are no longer on the system.

You can fix those issues with a little judicious editing. While you are removing apt-get upgrade and apt-get autoclean from the script, you can also remove sudo from the start of every line of the script if you are not using the sudo command to access the root account (by default, Debian does not use sudo, while Ubuntu does).

You should also be check which repositories are enabled in /etc/apt/sources.list before you use this script or your own version of it. Used with the stable or even the testing repositories of Debian, Apt-utility should be safe, but automated updates with the unstable or experimental repositories enabled could result in broken dependencies and, in extreme cases, even major system problems.

Ubucleaner

Although it's intended primarily for Ubuntu, Ubucleaner is a grab-bag script that works -- mostly -- with other Debian-based distributions as well. The script cleans the apt-cache, removes the configuration files for removed packages, removes all kernels except the present one, and empties the trash for every user on the system. The kernel removal function works only with Ubuntu kernels.

All these tasks have in common is that they remove extra files from the system, so you might want to edit the script or comment out sections that you don't want. In particular, considering that a backup kernel may be useful if tinkering disables your current one, you might want to disable the kernel removal feature -- as well as the "Removing old kernels" message, so you don't have a heart attack when you run the script.

The script assumes that you are using the text-based Aptitude application, rather than apt-get and dpkg. If you are not using Aptitude, you should also replace the reference to aptitude clean with apt-get clean and the reference to aptitude purge to dpkg --purge.

daptup

Like Ubucleaner, daptup is intended for use with Aptitude. However, it is far safer than Ubucleaner, since it is purely informational, building for Debian-derived distributions lists of new packages, upgradeable packages, watched packages, and outdated packages that have upgrades available. You can use these lists to plan your software upgrades.

You can configure the content of these lists by editing the file /etc/daptup.conf. Here you can set such criteria as how many days old a package should be before it is listed as outdated, what packages on your system to watch, and what packages to watch that are uninstalled. You might, for instance, want to keep checking on whether the latest version of OpenOffice.org has arrived in a repository, or to wait until Gnash reaches its 1.0 release before you install it. The configuration file is heavily commented and includes examples, so you should have little trouble setting daptup to run exactly as you want.

If you do not automatically upgrade, or if you know that a large number of packages has recently flooded into the repositories you use, you might want to run daptup piped into either the less or more command (for instance, daptup | less); otherwise, the lists could easily be longer than your display buffer, so that the first entries disappear before the last one is visible. Alternatively, you might comment out some of the lists in /etc/daptup.conf, or change the number of lines in the display buffer in your terminal program's configuration settings.

Conclusion

There are many other scripts out on the Internet for Debian-based package management. For instance, UnusedPkg lists programs on the system that are not used and therefore might be removable, but the download is apparently no longer available. And for more advanced users who want to examine and compare dpkg status files, the awk script dpkg-diff might come in handy.

All these scripts help you gain more information about your system, and most are easy to modify even if you know little about any form of scripting. If you keep an eye on sites like openDesktop.org that list new applications, chances are that you will have no trouble finding utilities that allow you to make more intelligent decisions about the software you are running.

Bruce Byfield is a computer journalist who writes regularly for Linux.com.

Share    Print    Comments   

Comments

on Three scripts for package management on Debian and Ubuntu systems

Note: Comments are owned by the poster. We are not responsible for their content.

Three scripts for package management on Debian and Ubuntu systems

Posted by: Anonymous [ip: 172.28.171.114] on October 29, 2008 05:56 PM
> If you are not using Aptitude, you should also replace the reference to aptitude clean with apt-get clean

Why should it matter what APT front-end you normally use? They all operate on the same database, no?

#

Re: Three scripts for package management on Debian and Ubuntu systems

Posted by: Anonymous [ip: 71.193.119.0] on October 30, 2008 01:38 AM
Tech Patterns :: smxi dist-upgrade/ maintenance script, kernel install
http://techpatterns.com/forums/about736.html

smxi works on sidux, and Debian systems and would probably work on Ubuntu with a couple of tweaks.

#

Re(1): Three scripts for package management on Debian and Ubuntu systems

Posted by: JackieBrown on October 31, 2008 02:39 AM
Since apt-get is so difficult.

#

Three scripts for package management on Debian and Ubuntu systems

Posted by: Anonymous [ip: 208.127.109.106] on October 30, 2008 06:10 AM
It would be nice if you had instructions for installing these as well. You are wrong though about apt-get upgrade and apt-get dist-upgrade as they do different things. Some times you will upgrade and it won't install any thing but you do dist-upgrade and it will have items to upgrade.

#

Re: Three scripts for package management on Debian and Ubuntu systems

Posted by: Anonymous [ip: 192.168.1.102] on November 01, 2008 03:38 PM
"You are wrong though about apt-get upgrade and apt-get dist-upgrade"

No he's not. "apt-get dist-upgrade" will do everything "apt-get upgrade" will do (and possibly more). The call to "upgrade" is redundant if you are going to call "dist-upgrade" immediately after.

#

Three scripts for package management on Debian and Ubuntu systems

Posted by: Anonymous [ip: 81.77.210.72] on October 31, 2008 12:56 PM
As has been said - because apt is so hard to use!

I recently had the joy of trying to decipher, search and get information on what was installed on a machine.
"oh, I just normally run apt-get and if it returns no action needed then it's done" was what I received.. Not to mention the fact there are multiple commands for interfacing with ONE thing (package management).

Why not ONE command (aptitude)?

... Bad design IMO - and by the looks of all the scripts turning up, people agree.

--
Paul_one

#

Three scripts for package management on Debian and Ubuntu systems

Posted by: Anonymous [ip: 151.59.103.163] on November 13, 2008 03:42 PM
Version 0.4 of unusedpkg is available on http://freshmeat.net/projects/unusedpkg/

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya