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

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...

Spread the love

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.

Debian Goodies Utilities to Manage Debian Packakges

8 Debian Goodies Utilities to Manage Debian Packages

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.

Let’s see the description of each tool below:

  1. dglob – Produce a list of package names which match a pattern
  2. dgrep – Search all files in given packages for a regex
  3. dpigs – Display which installed packages taken the most disk space
  4. debget – Obtain a .deb for a package in APT’s database
  5. debmany – Choose manpages of installed or removed packages
  6. checkrestart – Finds and restart processes which are using outdated versions of upgraded files
  7. popbugs – Show a customized release-critical bug report based on packages you use
  8. which-pkg-broke – Catch which package might have broken another

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.

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

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


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

# sudo apt-get install debian-goodies
Install Debian Goodies

Install Debian Goodies

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.

How to Use Debian-Goodies Utilities

1. dglob Utility

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.

[email protected]:~# dglob fonts-sil-abyssinica
libatk-adaptor
openoffice-onlineupdate
libvorbisfile3
libquadmath0
libxkbfile1
linux-sound-base
python-apt-common
python-gi-cairo
libgs9-common
libgom-1.0-common
libqt5qml5
libgtk2.0-bin
libregexp-common-perl
evolution-data-server
libaccount-plugin-generic-oauth
bind9-host
libhtml-tagset-perl
iputils-ping
libcgmanager0
evince
...

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.

[email protected]:~# dglob firefox
firefox-locale-en
unity-scope-firefoxbookmarks
firefox
[email protected]:~# dglob apache2
apache2
apache2-utils
apache2-bin
apache2-data
[email protected]:~# dglob debian-goodies
debian-goodies

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

[email protected]:~# dglob -f firefox
/usr/share/doc/firefox-locale-en/copyright
/usr/share/doc/firefox-locale-en/changelog.Debian.gz
/usr/lib/firefox-addons/extensions/[email protected]
/usr/lib/firefox-addons/extensions/[email protected]
/usr/lib/firefox/distribution/searchplugins/locale/en-ZA/amazondotcom.xml
/usr/lib/firefox/distribution/searchplugins/locale/en-ZA/google.xml
/usr/lib/firefox/distribution/searchplugins/locale/en-ZA/ddg.xml
/usr/lib/firefox/distribution/searchplugins/locale/en-GB/google.xml
/usr/lib/firefox/distribution/searchplugins/locale/en-GB/amazon-en-GB.xml
/usr/lib/firefox/distribution/searchplugins/locale/en-GB/ddg.xml
/usr/lib/firefox/webapprt/extensions/[email protected]
/usr/lib/firefox/webapprt/extensions/[email protected]
/usr/share/unity/scopes/web/firefoxbookmarks.scope
/usr/share/unity-scopes/firefoxbookmarks/unity_firefoxbookmarks_daemon.py
/usr/share/unity-scopes/firefoxbookmarks/__init__.py
/usr/share/doc/unity-scope-firefoxbookmarks/copyright
....

2. How to Use dgrep Utility

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.

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

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

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

[email protected]:~# dgrep -l conf apache2
/usr/sbin/a2query
/usr/sbin/apache2ctl
/usr/sbin/a2enmod
/usr/share/doc/apache2/migrate-sites.pl
/usr/share/doc/apache2/copyright
/usr/share/doc/apache2/README.multiple-instances
/usr/share/doc/apache2/examples/setup-instance
/usr/share/doc/apache2/examples/secondary-init-script
/usr/share/doc/apache2/README.backtrace
/usr/share/apache2/apache2-maintscript-helper
/usr/share/lintian/overrides/apache2
/etc/bash_completion.d/apache2
/etc/init.d/apache2
...

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

[email protected]:~# dgrep -o conf apache2
/usr/sbin/a2query:conf
/usr/sbin/a2query:conf
/usr/sbin/a2query:conf
/usr/sbin/a2query:conf
/usr/sbin/a2query:conf
/usr/sbin/a2query:conf
/usr/sbin/a2query:conf
/usr/sbin/a2query:conf
...

3. How to Use dpigs Utility

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.

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

[email protected]:~# dpigs
158762 linux-image-extra-4.2.0-16-generic
157066 linux-image-extra-3.19.0-31-generic
155037 wine1.8-amd64
143459 wine1.8-i386
103364 linux-firmware
100412 firefox
96741 openjdk-8-jre-headless
96302 libgl1-mesa-dri
90808 thunderbird
90652 liboxideqtcore0

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

[email protected]:~# dpigs -H
155.0M linux-image-extra-4.2.0-16-generic
153.4M linux-image-extra-3.19.0-31-generic
151.4M wine1.8-amd64
140.1M wine1.8-i386
100.9M linux-firmware
98.1M firefox
94.5M openjdk-8-jre-headless
94.0M libgl1-mesa-dri
88.7M thunderbird
88.5M liboxideqtcore0

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

[email protected]:~# dpigs -H -n 15
155.0M linux-image-extra-4.2.0-16-generic
153.4M linux-image-extra-3.19.0-31-generic
151.4M wine1.8-amd64
140.1M wine1.8-i386
100.9M linux-firmware
98.1M firefox
94.5M openjdk-8-jre-headless
94.0M libgl1-mesa-dri
88.7M thunderbird
88.5M liboxideqtcore0
87.9M libgl1-mesa-dri
81.3M openoffice-core04
77.8M fonts-horai-umefont
64.2M linux-headers-4.2.0-16
61.5M ubuntu-docs

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

[email protected]:~# dpigs -h
Usage: dpigs [options]
Options:
-n, --lines=N
Display the N largest packages on the system (default 10).
-s, --status=status-file
Use status-file instead of the default dpkg status file.
-S, --source
Display the largest source packages of binary packages installed
on the system.
-H, --human-readable
Display package sizes in human-readable format (like ls -lh or du -h)
-h, --help
Display this message.

4. How to Use debget Utility

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.

[email protected]:~# debget apache2
(apache2 -> 2.4.12-2ubuntu2)
[email protected]:~# debget zip
(zip -> 3.0-11)
Downloading zip from http://in.archive.ubuntu.com/ubuntu/pool/main/z/zip/zip_3.0-11_amd64.deb
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
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 --:--:-- 74220
[email protected]:~# debget tar (tar -> 1.27.1-2)
Downloading tar from http://in.archive.ubuntu.com/ubuntu/pool/main/t/tar/tar_1.27.1-2_amd64.deb
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
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 --:--:-- --:--:-- --:--:-- 201k

All the fetched .deb packages.

[email protected]:~# dir -hl
total 348K
-rw-r--r-- 1 root root 86K Dec 30 12:46 apache2_2.4.7-1ubuntu4.6_amd64.deb
-rw-r--r-- 1 root root 192K Dec 30 12:46 tar_1.27.1-2_amd64.deb
-rw-r--r-- 1 root root 155K Dec 30 12:46 zip_3.0-11_amd64.deb

5. How to Use debmany Utility

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.

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

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

[email protected]:~# debmany -k tar

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

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

[email protected]:~# debmany -g tar
View Man Pages of Installed Packages

View Man Pages of Installed Packages

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

[email protected]:~# debmany -x tar

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

6. How to Use checkrestart Utility

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

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

[email protected]:~# checkrestart -a
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
Found 30 processes using old versions of upgraded files
(28 distinct programs)
(23 distinct packages)
Of these, 1 seem to contain systemd service definitions or init scripts which can be used to restart them.
The following packages seem to have definitions that could be used
to restart their services:
openssh-server:
1947 /usr/sbin/sshd
1889 /usr/sbin/sshd
These are the initd scripts:
service ssh restart
...

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

[email protected]:~# checkrestart -p
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
Found 0 processes using old versions of upgraded files

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

[email protected]:~# checkrestart -v
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
Found 1 processes using old versions of upgraded files
(1 distinct program)
[DEBUG] Process /usr/bin/update-manager (PID: 2027) List of deleted files in use:
/var/cache/apt/pkgcache.bin
/var/lib/dpkg/status (deleted)
/var/cache/apt/pkgcache.bin
/var/lib/dpkg/status (deleted)
/var/cache/apt/pkgcache.bin
/var/lib/dpkg/status (deleted)
/var/cache/apt/pkgcache.bin
/var/lib/dpkg/status (deleted)
[DEBUG] Running:['dpkg-query', '--search', '/usr/bin/update-manager']
[DEBUG] Reading line from dpkg-query: update-manager: /usr/bin/update-manager
[DEBUG] Found package update-manager for program /usr/bin/update-manager
(1 distinct packages)
[DEBUG] Running:['dpkg-query', '--listfiles', 'update-manager']
These processes (1) do not seem to have an associated init script to restart them:
update-manager:
2027 /usr/bin/update-manager

7. How to Use popbugs Utility

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.

[email protected]:~# popbugs
There is no popularity-contest data present on your system. This
probably means that popularity-contest has not yet run since it
was installed. Try waiting for /etc/cron.daily/popularity-contest to
to collect some data or manually run (as root user):
/usr/sbin/popularity-contest >/var/log/popularity-contest

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

[email protected]:~# /usr/sbin/popularity-contest > /var/log/popularity-contest

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

[email protected]:~# popbugs --output=/tmp/output.html

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

popbugs output

popbugs output

To display debugging information, use the -d option.

[email protected]:~# popbugs --d
POPCON: Adding package zeitgeist-core
POPCON: Adding package upstart
POPCON: Adding package unity-gtk2-module
POPCON: Adding package whoopsie
POPCON: Adding package xserver-xorg-input-evdev
POPCON: Adding package unity-services
POPCON: Adding package zlib1g
POPCON: Adding package xserver-xorg-core
..

8. How to Use which-pkg-broke Utility

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.

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

[email protected]:~# which-pkg-broke apache2 Package apache2 has no install time info
Package mysql-common has no install time info
Package libaprutil1-ldap has no install time info
Package has no install time info
Package libmysqlclient18 has no install time info
Package has no install time info
Package libaprutil1-dbd-sqlite3 has no install time info
Package has no install time info
Package libaprutil1-dbd-mysql has no install time info
Package apache2-utils has no install time info
Package libpq5 has no install time info
Package apache2-data has no install time info
Package libaprutil1-dbd-pgsql has no install time info
Package libaprutil1-dbd-odbc has no install time info
libacl1:amd64 Wed Apr 22 17:31:54 2015
libattr1:amd64 Wed Apr 22 17:31:54 2015
insserv Wed Apr 22 17:31:54 2015
libc6:amd64 Wed Apr 22 17:31:55 2015
...

Summary

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.

Facebook Comments
Spread the love

Posted by News Monkey