CentOS の yum-updatesd がおかしい?
やっぱりなかなかエントリを書く時間がとれないです。
が、書くといったら書く。せめて月に2、3エントリぐらいは……というわけで、少し前の話ですが、経過観察してたネタを一つ。
これは、確か、四月の中頃の話。家で24時間可動しているCentOSの箱が、何もしていないのにやたらとディスクアクセスしていることに気づきました。
おかしいなぁと思い、Muninを確認してみると、4月1日ごろから、CPUが常時100%食われてる模様。で、Topでみてみたところ、yum-updatesd が刺さっていたようでした。問題のディスクアクセスは、この暴走プロセスがメモリを食いつぶした挙句、スワップを使いまくるため起きていたようです。
私の環境では、以前こちらのエントリで書いたように、自動アップデートが走るようにしていますので、このての問題は結構起きがちだったりします。
まずは yum-updatesd を停止。
# /etc/init.d/yum-updatesd stop Stopping yum-updatesd: [ OK ]
続けて、手動でアップデート。大抵これでうまくいくでしょう。多分。
# yum update Loading "fastestmirror" plugin Loading "installonlyn" plugin Existing lock /var/run/yum.pid: another copy is running as pid 27893. Another app is currently holding the yum lock; waiting for it to exit... Another app is currently holding the yum lock; waiting for it to exit... Another app is currently holding the yum lock; waiting for it to exit...
あれ? まだ背後で動いてる? メッセージにPIDが出てるのでそのプロセスを確認。
# ps 27893 root 27893 89.6 52.7 503540 254768 ? RN Apr01 13459:00 /usr/bin/python -tt /usr/libexec/yum-updatesd-helper --check --download --deps --apply --dbus
まだ動いてるっぽい。 しかたがないので手動Kill
# kill 27893 # ps 27893 PID TTY STAT TIME COMMAND
で、改めて手動アップデート。
# yum update (中略) Transaction Summary ============================================================================= Install 11 Package(s) Update 279 Package(s) Remove 2 Package(s) Total download size: 498 M
おおっと? 異様に大量のアップデートがある?
もしかして、ずいぶん昔から自動アップデートが効いてませんでした?(^^;
(ログの続き) Running rpm_check_debug ERROR with rpm_check_debug vs depsolve: Package yum-updatesd needs yum = 3.0.5-1.el5.centos.5, this is not available. Package yum-updatesd needs yum = 3.0.5-1.el5.centos.5, this is not available. Complete!
うむ? バージョン依存問題?
とりあえず、Linux箱内部のRPMデータベースがおかしくなってる可能性もあるので、キャッシュを削除してデータベースの再生成をしてから、アップデートをリトライしてみます。
# yum clean all Loading "fastestmirror" plugin Loading "installonlyn" plugin Cleaning up Everything Cleaning up list of fastest mirrors # rpm --rebuilddb # yum upgrade (略) Transaction Summary ============================================================================= Install 11 Package(s) Update 279 Package(s) Remove 2 Package(s) Total download size: 498 M (略) Running rpm_check_debug ERROR with rpm_check_debug vs depsolve: Package yum-updatesd needs yum = 3.0.5-1.el5.centos.5, this is not available. Package yum-updatesd needs yum = 3.0.5-1.el5.centos.5, this is not available. Complete!
それでもダメ。
問題のあるパッケージは yum-updatesd だけみたいなので、一番簡単な解決策は yum-updatesd を一旦アンインストールしてしまうことですね。
# yum remove yum-updatesd (略) Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Removing: yum-updatesd noarch 1:0.9-2.el5 installed 55 k yum-updatesd noarch 3.0.5-1.el5.centos.5 installed 4.0 k Transaction Summary ============================================================================= Install 0 Package(s) Update 0 Package(s) Remove 2 Package(s)
あれ、バージョン違いのが2つ入ってる。
ふうむ。これが原因か?
とりあえず続ける。
(ログ続き) Removed: yum-updatesd.noarch 1:0.9-2.el5 yum-updatesd.noarch 0:3.0.5-1.el5.centos.5 Complete!
yum-updatesd がアンインストールされた状態で、改めてシステムを手動アップデート。
# yum upgrade (略) Transaction Summary ============================================================================= Install 11 Package(s) Update 279 Package(s) Remove 2 Package(s) Total download size: 498 M (略) Complete!
アップデート成功。で、さらに改めて yum-updatesd をインストールしなおす。
# yum install yum-updatesd (略) Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: yum-updatesd noarch 1:0.9-2.el5 base 22 k Transaction Summary ================================================================================ Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 22 k (略) Installed: yum-updatesd.noarch 1:0.9-2.el5 Complete!
1個だけインストールされた。やっぱり変なバージョンのがまじってたのが原因なんだろうなぁ。
最後に、以前設定していたとおりに /etc/yum/yum-updatesd.conf を設定しなおしました。 アンインストール時に、同じディレクトリに yum-updatesd.conf.rpmsave という名前で保存されているはずなので、それを上書きコピーすれば大抵は十分です。心配性なひとは両者のDiffを取ったうえで作業しましょう。
あとは、この設定を有効にするため、yum-updatesdを再起動させたら終了です。
# /sbin/service yum-updatesd restart
この状態で、しばらく様子を見て、問題がなかったらこの顛末をエントリに……と思っていたのですが、そのまま忘れてお蔵入していたので、掘り起こしてみました。
似たような設定でCentOSを動かしている人は、同じ問題を踏んでいる可能性もあるので、一度確認されてみてはいかがでしょうか。