2018年11月28日

grep コマンドで Segmentation fault

とあるCeotOS6.10のサーバで、rootディレクトリにcore.***っていうファイルが大量にできている。

このサーバ、社内の何人かで共有しているサーバで、それぞれがプログラム書いて
勝手にアップして、使っている。

きっと誰かが書いたプログラムがcore吐いているんだろうと勝手に思っていた。

# cd /
# ll
-rw------- 1 root root 122880 Nov 15 05:33 core.10019
-rw------- 1 root root 122880 Nov 26 05:30 core.10024
-rw------- 1 root root 122880 Nov 26 05:31 core.10032
-rw------- 1 root root 122880 Nov 26 05:32 core.10041
-rw------- 1 root root 122880 Nov 27 18:49 core.10042
-rw------- 1 root root 122880 Nov 26 05:33 core.10046
-rw------- 1 root root 122880 Nov 27 18:50 core.10051
-rw------- 1 root root 122880 Nov 15 05:34 core.10055
-rw------- 1 root root 122880 Nov 27 18:51 core.10058
続く.....


結構な数あるわけで、気持ち悪い。

logとか見ていて、気持ち悪いっていう感覚って結構大事じゃないかなと勝手に思っています。


そういえば、
/etc/cron.daily/makewhatis.cron:からメールが届いていたな。

/etc/cron.daily/makewhatis.cron: line 27: 17382 Done find /usr/sbin/makewhatis -newer /var/cache/man/whatis
17383 Segmentation fault | grep -q .



ここではまだピンと来ていない。

#file core.10058
core.10058: ELF 32-bit LSB core file Intel 80386, version 1 (SYSV), SVR4-style, from '/bin/grep ^/dev/', real uid: 0, effective uid: 0, real gid: 0, effective gid: 0, execfn: '/bin/grep', platform: 'i686'


from '/bin/grep

ん?? 他のcoreダンプ見てみても、from '/bin/grep って言われる。

これ面倒くさそうな奴ガ-ン


もう一度/etc/cron.daily/makewhatis.cronファイルを見てみると
find /usr/sbin/makewhatis -newer /var/cache/man/whatis |grep -q .

こういう1文がある。

最初はmakewhatis コマンドが行けないのかと思って、
データベースを作り直してみたりしたけど、エラーは出る。

find /usr/sbin/makewhatis -newer /var/cache/man/whatis

は正常に終了するけど

find /usr/sbin/makewhatis -newer /var/cache/man/whatis |grep -q .

は失敗。

そのうち、yumコマンドも Segmentation fault 出る。

Cent の Yum さんが Segmentation fault と言ってきたときの対処方法 ってページを見つけたので、

「RPM DB をクリアして、改めてキャッシュしてもらう」 の通りやっても駄目。

「インストール済みの Zlib をアンインストールする (特に 1.2.5 の場合はこれで直る)」 を実行するとエラー
# sudo rpm -qa | grep zlib
Segmentation fault


おい! grep よ お前か!

grepなんて色んなスクリプトで使われているナンテのは想像しなくてもわかる。

さぁて どうしたら良いもんか?(今ここ)

2018/12/01追記

忙しくてちょっと放置していたのだけど、coreダンプも増えてくるので更に試行錯誤。

再インストールするのにバージョンを確認しようにも
# yum info grep しても #yum list も #rpm -q grep しても Segmentation fault

いずれyum updateされるから、ちょっと前のバージョンのを入れてみる

# yum downgrade http://vault.centos.org/6.6/os/i386/Packages/grep-2.6.3-6.el6.i686.rpm

ダウングレードには成功した様子。 grep コマンド叩いても、エラーは出ない

だけど


# yum update
Loaded plugins: fastestmirror
Setting up Update Process
Loading mirror speeds from cached hostfile
Segmentation fault



びっくり!


結局どうしたかと言うと
別の同じバージョンのサーバから 
/usr/lib/libcurl.so.4.1.1 と /lib/libz.so.1 をscpすることで解決しました。


同じカテゴリー(仕事)の記事
Bitcasaが完全有料化?
Bitcasaが完全有料化?(2016-04-08 12:05)


Posted by ナナの旦那 │Comments(0)仕事
 
<ご注意>
書き込まれた内容は公開され、ブログの持ち主だけが削除できます。