데비안 패키지를 관리하기 위해 8 가지 유용한 'Debian Goodies Utilities'를 사용하는 방법


Debian-goodies는 데비안 및 Ubuntu, Kali Linux와 같은 파생 시스템을 관리하는 데 사용되는 도구 상자 스타일 유틸리티가 포함 된 패키지입니다. 이 패키지의 유틸리티는 많은 인식 된 셸 도구와 결합하는 방식으로 개발되었으며, 데비안 기반 Linux 배포판에서 자체 패키지로 개발할 수 없기 때문에 다른 도구가 포함되어 있습니다.

이 가이드에서는 dglob, debget, dpigs, dgrep, debmany, checkrestart, popbugs 및 which-pkg-broke를 포함하는 debian-goodies 패키지의 유틸리티를 사용하는 방법을 살펴볼 것입니다.

아래에서 각 도구에 대한 설명을 살펴 보겠습니다.

  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

이것은 다른 쉘 도구와 함께 사용할 때 시스템 관리를 훨씬 더 쉽게 만들 수있는 매우 유용한 유틸리티입니다. 실제로 Debian-goodies 도구는 dpkg 및 apt 도구와 같은 표준 도구보다 패키지에 대한 더 많은 정보를 표시합니다.

Debian, Ubuntu 및 Linux Mint에서 Debian-goodies를 설치하는 방법

debian-goodies 패키지를 설치하려면 아래 명령을 실행하십시오.

# sudo apt-get install debian-goodies

debian-goodies 패키지가 설치 되었으면 이제 나머지 기사에서이 패키지에서 제공하는 각 유틸리티의 사용법을 확인할 차례입니다.

Debian-Goodies 유틸리티 사용 방법

dglob은 패턴에 지정된대로 패키지 또는 파일의 이름 목록을 생성합니다. 모든 패키지의 이름을 생성하려면 dglob을 실행하거나 -a 옵션을 포함하면됩니다.

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

시스템에 패키지가 있는지 확인하려면 패키지 이름으로 dglob을 실행합니다. 아래 예에서는 Firefox, Apache2 및 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

-f 옵션을 사용하여 지정된 패키지의 모든 파일 목록을 인쇄 할 수 있습니다.

[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]xpi
/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
....

dgreb 유틸리티는 정규식에 대해 지정된 패키지 이름의 파일을 검색하는 데 사용됩니다. 기본적으로 시스템에 설치된 패키지 파일을 살펴보고 함께 사용되는 대부분의 옵션은 몇 가지를 제외하고는 grep과 함께 사용되는 옵션입니다.

패턴을 지정하려면 다음과 같이 -e 옵션을 사용하십시오.

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

출력이 인쇄 될 각 입력 파일의 이름을 인쇄하려면 -l 옵션을 사용하십시오.

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

일치하는 행에서 일치하는 부분 만 표시하려면 -o 옵션을 사용하십시오.

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

이 유틸리티는 시스템에서 가장 많은 공간을 사용한 패키지를 표시하는 데 사용됩니다. 특히 공간이 부족하고 일부 패키지를 제거하려는 경우 매우 중요합니다.

시스템에서 가장 많은 공간을 차지하는 패키지를 찾으려면이 명령을 실행하면됩니다.

[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

-H 옵션을 사용하여 사람이 읽을 수있는 형식으로 패키지 크기를 읽을 수 있습니다.

[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

기본값 인 10과 별도로 주어진 패키지 수를 지정하려면 -n 옵션을 사용하십시오.

[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

dpigs 사용에 대한 도움말을 찾으려면 -h 옵션을 사용하십시오.

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

debget은 APT의 패키지 데이터베이스에서 패키지에 대해 주어진 .deb를 가져 오는 데 사용됩니다. 다음 예에서는 apache2, zip 및 tar 유틸리티에 대한 .deb 파일을 가져옵니다.

[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

가져온 모든 .deb 패키지.

[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

시스템에 설치되거나 제거 된 패키지의 수동 입력 페이지를 선택하는 데 사용됩니다. 이 유틸리티를 사용하면 패키지의 모든 맨 페이지를 볼 수 있습니다.

선택한 뷰어를 사용하여 맨 페이지를 표시하기 위해 debmany와 함께 사용할 수있는 다음 옵션 중 일부 :

KDE 데스크탑 환경을 사용하는 경우 -k 옵션을 사용하여 kfmclient를 사용하십시오.

[email protected]:~# debmany -k tar

참고 : 시스템에 KDE DE가 설치되어 있지 않아 위 명령의 출력을 표시하기가 어렵습니다.

GNOME 데스크탑 환경을 사용하는 경우 -g 옵션을 사용하여 gnome-open을 사용하십시오.

[email protected]:~# debmany -g tar

KDE/GNOME/Xfce 데스크탑 환경을 사용하는 경우 -x 옵션을 사용하여 kdg-open을 사용하십시오.

[email protected]:~# debmany -x tar

위의 뷰어를 사용하기 전에 설치되어 있는지 확인하십시오. 그렇지 않으면 오류가 발생할 수 있습니다.

chechstart는 이미 업그레이드 된 파일의 이전 버전을 사용하는 프로세스를 찾고 다시 시작하는 데 사용됩니다.

모든 프로세스에서 checkrestart를 사용하려면 -a 옵션을 사용하십시오.

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

시스템의 지정된 패키지에 첨부 된 프로세스 삭제 된 파일 만 지정하려면 -p 옵션을 사용하십시오.

[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

-v 옵션을 사용하여 자세한 출력 정보를 생성 할 수 있습니다.

[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

시스템에서 일반적으로 사용하는 패키지를 기반으로 사용자 정의 된 릴리스에 중요한 버그 목록을 표시하는 데 사용됩니다. 옵션없이 처음으로 popbugs를 실행하면 아래와 같은 메시지가 표시됩니다.

[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

인기 콘테스트 로그를 생성하려면 아래 명령을 실행하십시오.

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

출력을 파일에 저장하려면 –output =/path/to/file 옵션을 사용하십시오. 출력 파일은 html 파일이어야합니다.

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

출력 파일을 보려면 파일 위치를 지정하여 웹 브라우저에서 파일을 엽니 다.

디버깅 정보를 표시하려면 -d 옵션을 사용하십시오.

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

다른 패키지를 손상시킨 패키지를 찾는 데 사용됩니다. "때로는 시스템을 업그레이드 할 때 특정 패키지로 인해 시스템이 손상 될 수 있습니다. "따라서 which-pkg-broke는 시스템을 손상시킨 패키지 또는 시스템의 특정 패키지를 찾는 데 도움이 될 수 있습니다.

apache2가 손상된 패키지를 찾으려면 아래 명령을 실행하십시오.

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

요약

우리가 살펴본 것들과 관련된 다른 많은 유틸리티가 있으며, 이후 기사에서 배울 수 있습니다. 이 가이드가 유용하기를 바라며 사용시 오류가 발생하거나 추가 할 다른 아이디어가 있으면 의견을 게시 해주세요. Tecmint에 계속 연결하십시오.