How to Use 8 Useful ‘Debian Goodies Utilities’ to Manage Debian Packages

[‘

n

Debian-goodies is a package that includes toolbox-style utilities used to manage Debian and its derivative systems such as Ubuntu, Kali Linux. The utilities under this package are developed in such a way to combine with many recognized shell tools and others are included because they cannot be developed as their own packages on Debian-based Linux distributions.

n

Debian Goodies Utilities to Manage Debian Packakges
8 Debian Goodies Utilities to Manage Debian Packages

n

In this guide we shall look at how to use the utilities under the debian-goodies package which include dglob, debget, dpigs, dgrep, debmany, checkrestart, popbugs and which-pkg-broke.

n

Let’s see the description of each tool below:

n

    n

  1. dglob – Produce a list of package names which match a pattern
  2. n

  3. dgrep – Search all files in given packages for a regex
  4. n

  5. dpigs – Display which installed packages taken the most disk space
  6. n

  7. debget – Obtain a .deb for a package in APT’s database
  8. n

  9. debmany – Choose manpages of installed or removed packages
  10. n

  11. checkrestart – Finds and restart processes which are using outdated versions of upgraded files
  12. n

  13. popbugs – Show a customized release-critical bug report based on packages you use
  14. n

  15. which-pkg-broke – Catch which package might have broken another
  16. n

n

These are very useful utilities that can make System Administration a lot more easy when used with other shell tools. In-fact, Debian-goodies tool shows more information about packages than standard tools such as dpkg and apt tools.

n

Read Also: Learn 15 dpkg commands and 25 apt-get commands to manage packages in Debian and it’s derivatives.

n

How to Install Debian-goodies in Debian, Ubuntu and Linux Mint

n

To install debian-goodies package, run this command below.

n

# sudo apt-get install debian-goodiesrn

n

Install Debian Goodies
Install Debian Goodies

n

Once debian-goodies package has been installed, it’s now time to check out usage of each utility provided by this package in the rest of the article.

n

How to Use Debian-Goodies Utilities

n

1. dglob Utility

n

The dglob generate a list of names of packages or files as specified in a pattern. To generate the name of all packages, simply run dglob or include the -a option.

n

[emailxa0protected]:~# dglob rnfonts-sil-abyssinicarnlibatk-adaptorrnopenoffice-onlineupdaternlibvorbisfile3rnlibquadmath0rnlibxkbfile1rnlinux-sound-basernpython-apt-commonrnpython-gi-cairornlibgs9-commonrnlibgom-1.0-commonrnlibqt5qml5rnlibgtk2.0-binrnlibregexp-common-perlrnevolution-data-serverrnlibaccount-plugin-generic-oauthrnbind9-hostrnlibhtml-tagset-perlrniputils-pingrnlibcgmanager0rnevincern...rn

n

To find out if a package exists on your system, run dglob with package name. In the example below we shall search for Firefox, Apache2 and debain-goodies.

n

[emailxa0protected]:~# dglob firefoxrnfirefox-locale-enrnunity-scope-firefoxbookmarksrnfirefoxrn[emailxa0protected]:~# dglob apache2rnapache2rnapache2-utilsrnapache2-binrnapache2-datarn[emailxa0protected]:~# dglob debian-goodiesrndebian-goodiesrn

n

You can print out a list of all files in the specified package by using the -f options.

n

[emailxa0protected]:~# dglob -f firefoxrn/usr/share/doc/firefox-locale-en/copyrightrn/usr/share/doc/firefox-locale-en/changelog.Debian.gzrn/usr/lib/firefox-addons/extensions/[emailxa0protected]rn/usr/lib/firefox-addons/extensions/[emailxa0protected]rn/usr/lib/firefox/distribution/searchplugins/locale/en-ZA/amazondotcom.xmlrn/usr/lib/firefox/distribution/searchplugins/locale/en-ZA/google.xmlrn/usr/lib/firefox/distribution/searchplugins/locale/en-ZA/ddg.xmlrn/usr/lib/firefox/distribution/searchplugins/locale/en-GB/google.xmlrn/usr/lib/firefox/distribution/searchplugins/locale/en-GB/amazon-en-GB.xmlrn/usr/lib/firefox/distribution/searchplugins/locale/en-GB/ddg.xmlrn/usr/lib/firefox/webapprt/extensions/[emailxa0protected]rn/usr/lib/firefox/webapprt/extensions/[emailxa0protected]rn/usr/share/unity/scopes/web/firefoxbookmarks.scopern/usr/share/unity-scopes/firefoxbookmarks/unity_firefoxbookmarks_daemon.pyrn/usr/share/unity-scopes/firefoxbookmarks/__init__.pyrn/usr/share/doc/unity-scope-firefoxbookmarks/copyrightrn....rn

n

2. How to Use dgrep Utility

n

The dgreb utility is used to search for files in specified package names for a regular expression. It basically greps through files of packages that are installed on your system and most of the options used with are those used with grep except for a few.

n

To specify a pattern, use the -e option as follows.

n

[emailxa0protected]:~# dgrep -e README apache2rn/usr/sbin/apache2ctl:        echo Setting ulimit failed. See README.Debian for more information. >&2rn/usr/sbin/a2enmod:                info(     "See /usr/share/doc/apache2/README.Debian.gz on "rn/etc/apache2/mods-available/autoindex.conf:tAddIcon /icons/hand.right.gif READMErn/etc/apache2/mods-available/autoindex.conf:t# ReadmeName is the name of the README file the server will look for byrn/etc/apache2/mods-available/autoindex.conf:tReadmeName README.htmlrn/etc/apache2/mods-available/cache_disk.conf:t# /usr/share/doc/apache2/README.Debian, and the htcacheclean(8)rn/etc/apache2/sites-available/default-ssl.conf:tt#   /usr/share/doc/apache2/README.Debian.gz for more info.rn...rn

n

To print the name of each input file from which output would have been printed, use the -l option.

n

[emailxa0protected]:~# dgrep -l conf apache2rn/usr/sbin/a2queryrn/usr/sbin/apache2ctlrn/usr/sbin/a2enmodrn/usr/share/doc/apache2/migrate-sites.plrn/usr/share/doc/apache2/copyrightrn/usr/share/doc/apache2/README.multiple-instancesrn/usr/share/doc/apache2/examples/setup-instancern/usr/share/doc/apache2/examples/secondary-init-scriptrn/usr/share/doc/apache2/README.backtracern/usr/share/apache2/apache2-maintscript-helperrn/usr/share/lintian/overrides/apache2rn/etc/bash_completion.d/apache2rn/etc/init.d/apache2rn...rn

n

To display only matched parts of a matching line, use the -o option.

n

[emailxa0protected]:~# dgrep -o conf apache2rn/usr/sbin/a2query:confrn/usr/sbin/a2query:confrn/usr/sbin/a2query:confrn/usr/sbin/a2query:confrn/usr/sbin/a2query:confrn/usr/sbin/a2query:confrn/usr/sbin/a2query:confrn/usr/sbin/a2query:confrn...rn

n

3. How to Use dpigs Utility

n

This utility is used to show packages that have used the most space on your system. It is very important especially when you are running out of space and want to remove some packages.

n

To find out packages consuming the most space on your system, simply run this command.

n

[emailxa0protected]:~# dpigsrn158762 linux-image-extra-4.2.0-16-genericrn157066 linux-image-extra-3.19.0-31-genericrn155037 wine1.8-amd64rn143459 wine1.8-i386rn103364 linux-firmwarern100412 firefoxrn96741 openjdk-8-jre-headlessrn96302 libgl1-mesa-drirn90808 thunderbirdrn90652 liboxideqtcore0rn

n

You can use the -H option to read package sizes in a human-readable format.

n

[emailxa0protected]:~# dpigs -Hrn 155.0M linux-image-extra-4.2.0-16-genericrn 153.4M linux-image-extra-3.19.0-31-genericrn 151.4M wine1.8-amd64rn 140.1M wine1.8-i386rn 100.9M linux-firmwarern  98.1M firefoxrn  94.5M openjdk-8-jre-headlessrn  94.0M libgl1-mesa-drirn  88.7M thunderbirdrn  88.5M liboxideqtcore0rn

n

To specify a given number of packages apart from the default which is 10, use the -n option.

n

[emailxa0protected]:~# dpigs -H -n 15rn 155.0M linux-image-extra-4.2.0-16-genericrn 153.4M linux-image-extra-3.19.0-31-genericrn 151.4M wine1.8-amd64rn 140.1M wine1.8-i386rn 100.9M linux-firmwarern  98.1M firefoxrn  94.5M openjdk-8-jre-headlessrn  94.0M libgl1-mesa-drirn  88.7M thunderbirdrn  88.5M liboxideqtcore0rn  87.9M libgl1-mesa-drirn  81.3M openoffice-core04rn  77.8M fonts-horai-umefontrn  64.2M linux-headers-4.2.0-16rn  61.5M ubuntu-docsrn

n

To seek for help in using dpigs, use the -h option.

n

[emailxa0protected]:~# dpigs -hrnUsage: dpigs [options]rnrnOptions:rn  -n, --lines=Nrn    Display the N largest packages on the system (default 10).rn  -s, --status=status-filern    Use status-file instead of the default dpkg status file.rn  -S, --sourcern    Display the largest source packages of binary packages installedrn    on the system.rn  -H, --human-readablern    Display package sizes in human-readable format (like ls -lh or du -h)rn  -h, --helprn    Display this message.rn

n

4. How to Use debget Utility

n

The debget is used to get a given .deb for a package from APT’s package database. In the next examples we shall fetch .deb files for apache2, zip and tar utilities.

n

[emailxa0protected]:~# debget apache2rn(apache2 -> 2.4.12-2ubuntu2)rn

n

[emailxa0protected]:~# debget ziprn(zip -> 3.0-11)rnDownloading zip from http://in.archive.ubuntu.com/ubuntu/pool/main/z/zip/zip_3.0-11_amd64.debrn  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Currentrn                                 Dload  Upload   Total   Spent    Left  Speedrn  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--   0  154k    0  1211    0     0   2039      0  0:01:17 --:--:--  0:01:17  47  154k   47 75059    0     0  44694      0  0:00:03  0:00:01  0:00:02 100  154k  100  154k    0     0  74182      0  0:00:02  0:00:02 --:--:-- 74220rn

n

[emailxa0protected]:~# debget tar rn(tar -> 1.27.1-2)rnDownloading tar from http://in.archive.ubuntu.com/ubuntu/pool/main/t/tar/tar_1.27.1-2_amd64.debrn  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Currentrn                                 Dload  Upload   Total   Spent    Left  Speedrn  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--  15  191k   15 30155    0     0  48338      0  0:00:04 --:--:--  0:00:04 100  191k  100  191k    0     0   201k      0 --:--:-- --:--:-- --:--:--  201krn

n

All the fetched .deb packages.

n

[emailxa0protected]:~# dir -hlrntotal 348Krn-rw-r--r-- 1 root root 86K Dec 30 12:46 apache2_2.4.7-1ubuntu4.6_amd64.debrn-rw-r--r-- 1 root root 192K Dec 30 12:46 tar_1.27.1-2_amd64.debrn-rw-r--r-- 1 root root 155K Dec 30 12:46 zip_3.0-11_amd64.debrn

n

5. How to Use debmany Utility

n

It is used to select the manual entry pages of installed or uninstalled packages on your system. This utility allows you to view all the manpages of a package.

n

Some of the following options you can use with debmany to display the manpage using your viewer of choice:

n

If you use KDE desktop environment, use -k option to use kfmclient.

n

[emailxa0protected]:~# debmany -k tarrn

n

Note: I don’t have KDE DE installed on my system, so it’s difficult to show output of the above command.

n

If you use GNOME desktop environment, use -g option to use gnome-open.

n

[emailxa0protected]:~# debmany -g tarrn

n

View Man Pages of Installed Packages
View Man Pages of Installed Packages

n

If you use KDE/GNOME/Xfce desktop environment, use -x option to use kdg-open.

n

[emailxa0protected]:~# debmany -x tarrn

n

Make sure that the above viewers are installed before you can use them or else you may get an error.

n

6. How to Use checkrestart Utility

n

The chechstart is used to find and restart processes that are using old versions of files that have already been upgraded.

n

To use checkrestart with all processes, use the -a option.

n

[emailxa0protected]:~# checkrestart -arnlsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfsrn      Output information may be incomplete.rnFound 30 processes using old versions of upgraded filesrn(28 distinct programs)rn(23 distinct packages)rnrnOf these, 1 seem to contain systemd service definitions or init scripts which can be used to restart them.rnThe following packages seem to have definitions that could be usedrnto restart their services:rnopenssh-server:rnt1947t/usr/sbin/sshdrnt1889t/usr/sbin/sshdrnThese are the initd scripts:rnservice ssh restartrn...rn

n

To specify only process deleted files that are attached to a given package on the system, use the -p option.

n

[emailxa0protected]:~# checkrestart -prnlsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfsrn      Output information may be incomplete.rnFound 0 processes using old versions of upgraded filesrn

n

You can generate a detailed output information by using the -v option.

n

[emailxa0protected]:~# checkrestart -vrnlsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfsrn      Output information may be incomplete.rnFound 1 processes using old versions of upgraded filesrn(1 distinct program)rn[DEBUG] Process /usr/bin/update-manager (PID: 2027) rnList of deleted files in use:rnt/var/cache/apt/pkgcache.binrnt/var/lib/dpkg/status (deleted)rnt/var/cache/apt/pkgcache.binrnt/var/lib/dpkg/status (deleted)rnt/var/cache/apt/pkgcache.binrnt/var/lib/dpkg/status (deleted)rnt/var/cache/apt/pkgcache.binrnt/var/lib/dpkg/status (deleted)rn[DEBUG] Running:['dpkg-query', '--search', '/usr/bin/update-manager']rn[DEBUG] Reading line from dpkg-query: update-manager: /usr/bin/update-managerrnrn[DEBUG] Found package update-manager for program /usr/bin/update-managerrn(1 distinct packages)rn[DEBUG] Running:['dpkg-query', '--listfiles', 'update-manager']rnThese processes (1) do not seem to have an associated init script to restart them:rnupdate-manager:rnt2027t/usr/bin/update-managerrn

n

7. How to Use popbugs Utility

n

It is used to show a list of customized release-critical bugs based on the packages you commonly use on your system. When you run popbugs without any option for the first time, it will show you a message such as the one below.

n

[emailxa0protected]:~# popbugsrnrnThere is no popularity-contest data present on your system.  Thisrnprobably means that popularity-contest has not yet run since itrnwas installed.  Try waiting for /etc/cron.daily/popularity-contest tornto collect some data or manually run (as root user):rnrn    /usr/sbin/popularity-contest >/var/log/popularity-contestrn

n

To generate the popularity-contest log, run this command below.

n

[emailxa0protected]:~# /usr/sbin/popularity-contest > /var/log/popularity-contestrn

n

To store output in a file, use the –output=/path/to/file option. The output file should be a html file.

n

[emailxa0protected]:~# popbugs --output=/tmp/output.htmlrn

n

To view the output file open the file from the web browser by specifying the file location.

n

popbugs output
popbugs output

n

To display debugging information, use the -d option.

n

[emailxa0protected]:~# popbugs --drnPOPCON: Adding package zeitgeist-corernPOPCON: Adding package upstartrnPOPCON: Adding package unity-gtk2-modulernPOPCON: Adding package whoopsiernPOPCON: Adding package xserver-xorg-input-evdevrnPOPCON: Adding package unity-servicesrnPOPCON: Adding package zlib1grnPOPCON: Adding package xserver-xorg-corern..rn

n

8. How to Use which-pkg-broke Utility

n

It is used to find packages that have broken another package. Sometimes your system may be broken by certain packages especially when upgrading it. Therefore which-pkg-broke may help you to find the packages that have broken your system or a particular package on the system.

n

To find out packages that have broken apache2, run this command below.

n

[emailxa0protected]:~# which-pkg-broke apache2 rnPackage apache2 has no install time infornPackage mysql-common has no install time infornPackage libaprutil1-ldap has no install time infornPackage  has no install time infornPackage libmysqlclient18 has no install time infornPackage  has no install time infornPackage libaprutil1-dbd-sqlite3 has no install time infornPackage  has no install time infornPackage libaprutil1-dbd-mysql has no install time infornPackage apache2-utils has no install time infornPackage libpq5 has no install time infornPackage apache2-data has no install time infornPackage libaprutil1-dbd-pgsql has no install time infornPackage libaprutil1-dbd-odbc has no install time infornlibacl1:amd64                                          Wed Apr 22 17:31:54 2015rnlibattr1:amd64                                         Wed Apr 22 17:31:54 2015rninsserv                                                Wed Apr 22 17:31:54 2015rnlibc6:amd64                                            Wed Apr 22 17:31:55 2015rn...rn

n

Summary

n

There are many other utilities related to the ones we have look at, which we may learn about in subsequent articles. Hope you find this guide useful and if you get any errors when using them or have any other ideas to add, please post a comment. Stay connected to Tecmint.

n

‘]