1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

使っていない Debian パッケージを popcon-largest-unused コマンドで調査する

Last updated at Posted at 2019-08-04

概要

  • popularity-contest パッケージをインストールして、 popcon-largest-unused コマンドで未使用のパッケージを調べる。
  • 今回の環境: Debian 9 (stretch)

第4章 Debian 9 (stretch) からのアップグレード

popularity-contest をインストールしていれば、popcon-largest-unused を使うことにより、容量の多くを占めていて使うことのないパッケージの一覧が得られます。

popularity-contest パッケージをインストールする

# apt install popularity-contest

/var/log/popularity-contest を生成する

popularity-contest パッケージをインストールしてしばらくたっているなら、 /var/log/popularity-contest はすでに存在していると思われる。

Debian -- stretch の popularity-contest パッケージに関する詳細

popularity-contest パッケージは、システム上で最も用いられている Debian パッケージに関する統計を Debian 開発者に匿名で周期的に投稿する cron ジョブを設定します。

/var/log/popularity-contest が存在しない場合は popcon-largest-unused コマンドを打つと警告メッセージが表示される。

# popcon-largest-unused
warning: Missing required file /var/log/popularity-contest.
info:    Run 'popularity-contest > /var/log/popularity-contest' to generate it.

/var/log/popularity-contest が無い場合は、 popularity-contest コマンドの結果をリダイレクトして出力しておく。

# popularity-contest > /var/log/popularity-contest

popcon-largest-unused コマンドで使っていないパッケージの一覧を出力する

popcon-largest-unused コマンドを打つと、未使用のパッケージの一覧がサイズの大きい順に出力される。

# popcon-largest-unused
188502 linux-image-4.9.0-8-amd64
106734 llvm-3.8-dev
90436 libicu-dev
86183 llvm-3.5-dev
85325 clang-3.8
72174 clang-3.5
53292 libpython3.5-dev
40662 libpython2.7-dev
29838 libclang-common-3.8-dev
27583 vim-runtime
25114 gcc-6
23930 g++-6
23353 binutils
22665 cpp-6
(以下略)

今回の環境では Linux カーネルのパッケージである linux-image-4.9.0-8-amd64 が最もサイズが大きかったので調べてみた。

dpkg コマンドで linux-image パッケージの一覧を出力する。

# dpkg -l linux-image-*
要望=(U)不明/(I)インストール/(R)削除/(P)完全削除/(H)保持
| 状態=(N)無/(I)インストール済/(C)設定/(U)展開/(F)設定失敗/(H)半インストール/(W)トリガ待ち/(T)トリガ保留
|/ エラー?=(空欄)無/(R)要再インストール (状態,エラーの大文字=異常)
||/ 名前                バージョン     アーキテクチャ 説明
+++-===================-==============-==============-===========================================
rc  linux-image-3.16.0- 3.16.51-3      amd64          Linux 3.16 for 64-bit PCs
rc  linux-image-3.16.0- 3.16.51-3+deb8 amd64          Linux 3.16 for 64-bit PCs
rc  linux-image-4.9.0-5 4.9.65-3+deb9u amd64          Linux 4.9 for 64-bit PCs
rc  linux-image-4.9.0-6 4.9.88-1+deb9u amd64          Linux 4.9 for 64-bit PCs
rc  linux-image-4.9.0-7 4.9.110-3+deb9 amd64          Linux 4.9 for 64-bit PCs
ii  linux-image-4.9.0-8 4.9.144-3.1    amd64          Linux 4.9 for 64-bit PCs
ii  linux-image-4.9.0-9 4.9.168-1+deb9 amd64          Linux 4.9 for 64-bit PCs
ii  linux-image-amd64   4.9+80+deb9u7  amd64          Linux for 64-bit PCs (meta-package)

uname コマンドの結果と突き合わせると、たしかに linux-image-4.9.0-8 は使われていないようだ。現在はこれより新しい linux-image-4.9.0-9-amd64 が使われている。

# uname -a
Linux my-host-name 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u4 (2019-07-19) x86_64 GNU/Linux

popcon-largest-unused コマンドのマニュアル

man popcon-largest-unused コマンドの結果の一部を載せておく。

NAME
popcon-largest-unused - List size of unused packages

SYNTAX
popcon-largest-unused

DESCRIPTION
Based on the list of unused packages reported by popularity-contest, this program extract the package size from the APT cache, and list the unused packages sorted by size.

popularity-contest コマンドのマニュアル

man popularity-contest コマンドの結果の一部を載せておく。

NAME
popularity-contest - list the most popular Debian packages

SYNOPSIS
popularity-contest

DESCRIPTION
The popularity-contest command gathers information about Debian packages installed on the system, and prints the name of the most recently used executable program in that package as well as its last-accessed time (atime) and last-attribute-changed time (ctime) to stdout.

When aggregated with the output of popularity-contest from many other systems, this information is valuable because it can be used to determine which Debian packages are commonly installed, used, or installed and never used. This helps Debian maintainers make decisions such as which packages should be installed by default on new systems.

The resulting statistic is available from the project home page http://popcon.debian.org/.

Normally, popularity-contest is run from a cron(8) job, /etc/cron.daily/popularity-contest, which automatically submits the results to Debian package maintainers (only once a week) according to the settings in /etc/popularity-contest.conf and /usr/share/popularity-contest/default.conf.

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?