R.A. Epigonos et al.

[aptitude] whyオプションでインストールされた理由がわからないパッケージを探す

aptitude whyでインストールされた理由がわかる。例えば、他のパッケージによって必要とされているパッケージはいいが、手作業でインストールしたものなど、なぜかインストールされているものがある。

キモは| xargs --max-args 1 aptitude why | grep "^Unable"の部分。これに標準入力で1行ごとに適当なパッケージ名を与えればよい。例えば、以下のようにすることで全てのインストール済みパッケージに関して理由の無いパッケージを探してくれる。

# dpkg -l | grep '^i' | awk '{print $2}' | xargs --max-args 1 aptitude why | grep "^Unable"
Unable to find a reason to install bvi.
Unable to find a reason to install cmake.
Unable to find a reason to install curlftpfs.
Unable to find a reason to install diffutils.
Unable to find a reason to install epstool.
Unable to find a reason to install ftp.
Unable to find a reason to install gettext-el.
Unable to find a reason to install gs-cjk-resource.
Unable to find a reason to install gsl-bin.
Unable to find a reason to install hostname.
Unable to find a reason to install installation-report.
Unable to find a reason to install jwhois.
Unable to find a reason to install libaspell-dev.
Unable to find a reason to install libclass-factory-util-perl.
Unable to find a reason to install libdatetime-format-strptime-perl.
Unable to find a reason to install libgsl0-dev.
Unable to find a reason to install libio-compress-base-perl.
Unable to find a reason to install libio-compress-zlib-perl.
Unable to find a reason to install liblocale-maketext-lexicon-perl.
Unable to find a reason to install liblua5.1-0-dev.
Unable to find a reason to install libmail-pop3client-perl.
Unable to find a reason to install libmime-perl.
Unable to find a reason to install libperl-dev.
Unable to find a reason to install libsigc++-dev.
Unable to find a reason to install libtest-exception-perl.
Unable to find a reason to install libtest-www-selenium-perl.
Unable to find a reason to install libunicode-japanese-perl.
Unable to find a reason to install libwww-mechanize-shell-perl.
Unable to find a reason to install libxml-sax-writer-perl.
Unable to find a reason to install linux-image-2.6-686.
Unable to find a reason to install login.
Unable to find a reason to install lv.
Unable to find a reason to install nano.
Unable to find a reason to install ngrep.
Unable to find a reason to install nkf.
Unable to find a reason to install nmap.
Unable to find a reason to install ntpdate.
Unable to find a reason to install pdftk.
Unable to find a reason to install pppoeconf.
Unable to find a reason to install rtorrent.
Unable to find a reason to install smbfs.
Unable to find a reason to install sysvinit.
Unable to find a reason to install tcpdump.
Unable to find a reason to install telnet.
Unable to find a reason to install traceroute.
Unable to find a reason to install uim-fep.
Unable to find a reason to install wakeonlan.
Unable to find a reason to install xml2.
Unable to find a reason to install xvnc4viewer.

もう少しインテリジェンスな解決策はdeborphanを使うこと。これも標準出力にパッケージ名を出力してくれるので、先ほどと同様にチェックが出来る。また、deborphanで出てきたパッケージの中にはなぜか他のパッケージで使われているものも有るため、double checkの意味でもこれは大事。

# deborphan --guess-all | sort | xargs --max-args 1 aptitude why | grep "^Unable"
Unable to find a reason to install libaspell-dev.
Unable to find a reason to install libclass-factory-util-perl.
Unable to find a reason to install libdatetime-format-strptime-perl.
Unable to find a reason to install libgsl0-dev.
Unable to find a reason to install libio-compress-base-perl.
Unable to find a reason to install libio-compress-zlib-perl.
Unable to find a reason to install liblocale-maketext-lexicon-perl.
Unable to find a reason to install liblua5.1-0-dev.
Unable to find a reason to install libmail-pop3client-perl.
Unable to find a reason to install libmime-perl.
Unable to find a reason to install libperl-dev.
Unable to find a reason to install libsigc++-dev.
Unable to find a reason to install libtest-exception-perl.
Unable to find a reason to install libtest-www-selenium-perl.
Unable to find a reason to install libunicode-japanese-perl.
Unable to find a reason to install libwww-mechanize-shell-perl.
Unable to find a reason to install libxml-sax-writer-perl.

リファレンス

  1. Debian パッケージ管理
  2. 第2章 Debian パッケージ管理
  3. Debianリファレンス
  4. "aptitude why" - Google 検索
  5. D: AptGet - Debian GNU/Linux スレッドテンプレ
  6. "aptitude --without-recommend"|"aptitude -R" - Google 検索
  7. Manpage of XARGS
  8. manpage xargs - Google 検索

ソーシャルブックマーク

  1. はてなブックマーク
  2. Google Bookmarks
  3. del.icio.us

ChangeLog

  1. Posted: 2010-01-18T10:21:57+09:00
  2. Modified: 2010-01-18T10:21:57+09:00
  3. Generated: 2023-08-27T23:09:16+09:00