努力したWiki

推敲の足りないメモ書き多数

ユーザ用ツール

サイト用ツール


Action disabled: source
documents:freebsd:freebsd-003

FreeBSDのportdowngradeで古いバージョンを適用する

2006年12月26日 20時35分04秒

最新のソフトウエアに変更したものの、いろいろな理由で以前のバージョンに戻したい場合があります。 その場合、portupgrade の逆、 portdowngrade コマンドを利用するのが楽で正確です。

2016/08/15
現在のportdowngradeはCVSサーバを使いません。subversionでportsの履歴を一覧し、どのリビジョンを使うか指定する事で目的のリビジョンをチェックアウトします。 こちらの情報を参照してください。

始まりは spamメールの来ない日

ええ、非常に平和でした。 毎日の様に(てか毎日だな)メールが最大で1000通ほど届き、そのほとんどがspamであるという日常から考えると、10通ほどしか届かないのは非常に珍しい。

自宅サーバのログを調べると…

 flatbox.root.hgotoh.jp kernel log messages:
 +++ /tmp/security.RBMQNVjy	Sat Dec  2 03:14:44 2006
 +pid 19768 (fetchmail), uid 1001: exited on signal 11
 +pid 19856 (fetchmail), uid 1001: exited on signal 11
 +pid 19857 (fetchmail), uid 1001: exited on signal 11
 +pid 21367 (fetchmail), uid 1001: exited on signal 11 (core dumped)
 +pid 21384 (fetchmail), uid 1001: exited on signal 11 (core dumped)
 +pid 21391 (fetchmail), uid 1001: exited on signal 11 (core dumped)
 +pid 21406 (fetchmail), uid 1001: exited on signal 11
 +pid 96980 (fetchmail), uid 1001: exited on signal 11 (core dumped)
 +pid 97224 (fetchmail), uid 1001: exited on signal 11 (core dumped)
 +pid 628 (fetchmail), uid 1001: exited on signal 11
 +pid 706 (fetchmail), uid 1001: exited on signal 11
 +pid 977 (fetchmail), uid 1001: exited on signal 11

???

fetchmail の虚弱体質化

複数のメールサーバからメールを受信するのに fetchmail を使っています。『伽藍とバザール』で出てくる有名な(?)ソフトウエアの一つです。

ずいぶん長い事使っています。非常に有用なソフトウエアです。 この fetchmail がどういう訳かコアダンプ吐いて落っこちてる。 早速調べてみました。

 $ fetchmail -v
 fetchmail: 6.3.5 は xxxx.xxxx.jp とプロトコル POP3 を用いて 金 12/ 1 10:06:41 2006 に交信しています。交信が開始されました。
 abc.def.gh.ijk/110 へ接続しようとしています...接続しました。
 fetchmail: POP3< +OK <2439.1164935201@xxx.xxx.xxxx.jp>
 fetchmail: POP3> CAPA
 fetchmail: POP3< -ERR authorization first
 fetchmail: authorization first
 fetchmail: すぐに xxx@xxxx.xxxx.jp 宛メッセージの再取得を試みます
 abc.def.gh.ijk/110 へ接続しようとしています...接続しました。
 fetchmail: POP3< +OK <2440.1164935202@xxx.xxx.xxxx.jp>
 fetchmail: POP3> USER xxx
 fetchmail: POP3< +OK
 fetchmail: POP3> PASS *
 fetchmail: POP3< +OK
 fetchmail: POP3> STAT
 fetchmail: POP3< +OK 5 15270
 5 通のメッセージが アカウント xxx , サーバ xxxx.xxxx.jp 宛に届いています (15270 バイト)
 fetchmail: POP3> LIST 1
 fetchmail: POP3< +OK 1 3313
 fetchmail: POP3> RETR 1
 fetchmail: POP3< +OK
 xxx@xxxx.xxxx.jp 宛に届いた 1 番目のメッセージ(全部で 5 通)を読み込んでいます (3313 バイト)
 fetchmail: ヘッダを解析中にエラーのある行を見つけました
 fetchmail: 該当行: ----97924571137397315
  ..Segmentation fault (core dumped)
 $

メールヘッダ解析中に落ちたようです。 問題のメールはこれ。

 Return-Path: <rich978@excite.co.jp>
 Delivered-To: xxx@xxxx.xxxx.jp
 Received: (qmail 2862 invoked from network); 30 Nov 2006 13:43:54 +0900
 Received: from unknown (HELO abc.def.gh.ijk) (60.174.199.134)
   by xxx.xxx.xxx.jp with SMTP; 30 Nov 2006 13:43:54 +0900
 Received: from 197.92.16.53 by 60.174.199.134; Wed, 29 Nov 2006 23:33:07 -0500
 Message-ID: <EOJCNQMYDHAEPYBQUGKG@dud.ocn.ne.jp>
 From: "西野  莉乃" <rich978@excite.co.jp>
 Reply-To: "西野  莉乃" <rich978@excite.co.jp>
 To: xxx@xxxx.xxxx.jp
 Subject: ご無沙汰しております
 Date: Thu, 30 Nov 2006 02:34:07 -0200
 X-Mailer: AOL 8.0 for Windows US sub 419
 MIME-Version: 1.0
 Content-Type: multipart/alternative;
         boundary="--97924571137397315"
 X-Priority: 3
 X-MSMail-Priority: Normal
 X-IP:199.63.122.220
 ----97924571137397315                ←ダメだろーこれは
 Content-Type: text/plain;
 Content-Transfer-Encoding: base64
 
 -- 以下略 --

ヘッダじゃ無いものがヘッダみたいな振りしている。 マルチパートメールの生成に失敗してる。「X-IP:」ヘッダの後に空行が入れば一応OKなのかな。

しかし、こんなメールはしょっちゅう来ていた気もするし、fetchmailも平気で取り込めていたよなぁ。

…あ、そーいえば最近 リリース 6.3.5 に変更したなぁ。

ダウングレードを行う

落ちる場所を調べてパッチを作るのがベストなんだろーけど、そんなすぐに見つけるのは無理。 手っ取り早く、以前の版へ戻すことに。

そういった場合、portdowngradeコマンドが非常に楽です。

情報収集

shag の日記 2006-01-27 portsdowngradeとた日記 2003-12-04 portdowngrade を試すを参考にしました。あと、manも忘れずに確認しておく。

anoncvsサーバ探し

安直にコマンドラインをコピペして試そうとすると、たいてい怒られます。意味を理解してからコピペしなきゃダメです。

 # portdowngrade -s :pserver:anoncvs@anoncvs.jp.freebsd.org:2401/home/cvs mail/fetchmail
 
 portdowngrade 0.6 by Heiner Eichmann
 Please note, that nothing is changed in the ports tree
 unless it is explicitly permitted in step 6!
 
 Seeking port mail/fetchmail ... found: mail/fetchmail
 
 Step 1: Checking out port from CVS repository
 CVS root directory: :pserver:anoncvs@anoncvs.jp.freebsd.org:2401/home/cvs
 cvs [checkout aborted]: connect to anoncvs.jp.freebsd.org(211.14.6.246):2401 failed: Operation timed out
 portdowngrade error: Can not check out port mail/fetchmail
 
 An error had occured. If this was an cvs error, try another cvs server.
 If this was an cvs login error, try the -o option.
 
 See http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/anoncvs.html for details.
 #

タイムアウトか…メンテナンス中かな。3回ほど同じコマンドラインを実行してみましたが、変わらず。
なので、http://www.jp.freebsd.org/www.FreeBSD.org/doc/ja_JP.eucJP/books/handbook/anoncvs.html よりオーストリアのサーバをチョイスしました。

さて実行だ

コマンドラインはこれ。

 # portdowngrade -l x.log -o -s:'pserver:anoncvs@anoncvs.at.freebsd.org:/home/ncvs' mail/fetchmail
  • -l x.log → ログを x.log に出力させます。
  • -o → anoncvsサーバ接続の際にはログインが必要であることを指示します。
    これが無いと~/.cvspassを見に行き、これが無いとそこで終了してしまいます。パスワードには anoncvs を入力しました。
    この辺は、サーバにより色々指示やお願いがあるので、ちゃんと確認しましょう。
 # portdowngrade -l x.log -o -s:'pserver:anoncvs@anoncvs.at.freebsd.org:/home/ncvs' mail/fetchmail
 
 portdowngrade 0.6 by Heiner Eichmann
 Please note, that nothing is changed in the ports tree
 unless it is explicitly permitted in step 6!
 
 Seeking port mail/fetchmail ... found: mail/fetchmail
 Logging in to :pserver:anoncvs@anoncvs.at.freebsd.org:2401/home/ncvs
 CVS password:
 cvs login: warning: failed to open /root/.cvspass for reading: No such file or directory
 
 Step 1: Checking out port from CVS repository
 CVS root directory: :pserver:anoncvs@anoncvs.at.freebsd.org:/home/ncvs
 
 Step 2: Reading the port history from the CVS repository
 
 Step 3: Analyzing the port history from the CVS repository
 
 Step 4: Load port version numbers and present results
 Keys: <space> : next page                      d : details
             p : previous page
       <enter> : leave presentation and downdgrade if wanted
 ==============================================================================================================================
 number         date         portversion  comment
     1  2006/11/02 16:05:29  6.3.5        - Update to fetchmail 6.3.5. See here for the release notes:
     2  2006/08/30 11:56:13  6.3.4_3      - Add new rc.conf option "fetchmail_logging_facility" which can be used
     3  2006/05/26 22:18:57  6.3.4_3      Make prefix clean.
     4  2006/05/25 16:26:50  6.3.4_2      - Use %%RC_SUBR%% [1]
     5  2006/05/15 21:18:39  6.3.4_1      - Fix PID file for system-wide daemon mode
     6  2006/05/12 16:58:48  6.3.4        - Update to 6.3.4 [1]
     7  2006/05/10 22:36:51  6.3.2_1      Remove USE_REINPLACE from ports starting with M
     8  2006/01/30 12:47:52  6.3.2_1      - Prevent fetchmail from crashing if the .netrc file does not contain
     9  2006/01/23 15:14:27  6.3.2        - Update to 6.3.2
    10  2005/12/19 15:21:52  6.3.1        Update to 6.3.1
    11  2005/12/11 21:24:18  6.3.0_3      - Fix a null pointer dereference in multi-drop mode [1]
    12  2005/12/10 19:58:31  6.3.0_2      - Add RUN_DEPENDS on security/ca-roots, so the certificate check really
    13  2005/12/10 16:09:12  6.3.0_1      - Use USE_OPENSSL [1]
    14  2005/12/06 21:07:18  6.3.0        - Update to fetchmail 6.3.0
    15  2005/11/24 14:08:00  6.2.5.2_4    Add SHA256 for my ports (that don't already have it).
    16  2005/11/14 11:48:52  6.2.5.2_4    - Fix a bug introduced with fetchmail-6.2.5.2_3, where it would sometimes
    17  2005/11/10 16:30:32  6.2.5.2_3    Add private backup master site.
    18  2005/11/10 10:29:32  6.2.5.2_3    - fix IMAP client timeout bug with upstream servers that do not send updated
    19  2005/10/30 23:05:06  6.2.5.2_1    Don't indent comment added in last commit by one tab, so it is not printed.
    20  2005/10/30 19:06:46  6.2.5.2_1    - Use fetchmailconf-1.43.2 in order to fix a password exposure caused by
    21  2005/07/28 13:41:18  6.2.5.2      Fix Kerberos {IV, V} detection.
    22  2005/07/23 18:47:35  6.2.5.2      Update WWW (new fetchmail homepage fetchmail.berlios.de).
    23  2005/07/22 07:07:14  6.2.5.2      Forced commit to note the following (this also applies for the following files
    24  2005/07/22 06:59:44  6.2.5.2      - Update to 6.2.5.2. This fixes a denial of service vulerability introduced
    25  2005/07/21 10:25:32  6.2.5.1      - Update to 6.2.5.1 (security update!)
    26  2005/07/18 03:49:54  6.2.5_2      With portmgr hat on, reset eik's ports since he has been inactive for
    27  2005/04/12 03:25:56  6.2.5_2      At Kris's request, back out the MACHINE_ARCH spelling correction until
    28  2005/04/11 08:03:00  6.2.5_2      Assist getting more ports working on AMD64 by obeying the
    29  2004/04/28 17:26:35  6.2.5_2      - fix POP bug [1]
    30  2004/03/18 01:04:31  6.2.5_1      SIZEify
    31  2004/02/04 04:36:06  6.2.5_1      Add USE_GETTEXT and bump PORTREVISION.
    32  2004/01/23 18:12:01  6.2.5        Now gettext 0.12.1 is gettext-old.
 Total lines: 221. Command:
 Enter version number to change port to (0: exit): 2
 

リリース 6.3.4_3 が一つ前の版なので、2を選択します。

 
 Step 5: Checking out choosen date of the port from the CVS repository
 
 Step 6: Modifying the port
 Port: mail/fetchmail
 at : 2006/08/30 11:56:13
 Type 'yes' to bring the port to the state of the date above
 or 'no' to exit without changing anything. Note, that this only changes
 the port, not the installed software! yes or no:yes

yesと答えてportstreeを更新します。

 
 The port has been set to the selected version. Install it if you wish.
 If you have portupgrade installed, you should run
 
 portsdb -Uu
 
 now, to see the changes in the ports database. In any case
 
 portupgrade -f fetchmail
 
 will install the changed port. Note: if you run cvsup, the port
 is changed back to the choosen label!
 
 #

「portsdb -Uu」と「portupgrade -f fetchmail」を実行してね、とメッセージが出て終了しました。

再導入実行

 # portupgrade -f fetchmail
 --->  Downgrading 'fetchmail-6.3.5' to 'fetchmail-6.3.4_3' (mail/fetchmail)
 --->  Building '/usr/ports/mail/fetchmail'
 ===>  Cleaning for gmake-3.81_1
 ===>  Cleaning for gettext-0.14.5_2
 ===>  Cleaning for ca-roots-1.2
 ===>  Cleaning for libtool-1.5.22_2
 ===>  Cleaning for libiconv-1.9.2_2
 ===>  Cleaning for fetchmail-6.3.4_3
 ===>  Vulnerability check disabled, database not found
 => fetchmail-6.3.4.tar.bz2 doesn't seem to exist in /usr/ports/distfiles/.
 => Attempting to fetch from http://download.berlios.de/fetchmail/.
 
 -- 以下略 --

確かにダウングレードしてる。

fetchmail実行

 $ fetchmail
 fetchmail: 古いロックファイルを削除します。
 9 通のメッセージが アカウント xxx , サーバ xxxx.xxxx.jp 宛に届いています (43863 バイト)
 xxx@xxxx.xxxx.jp 宛に届いた 1 番目のメッセージ(全部で 9 通)を読み込んでいます (3083 バイト) fetchmail: ヘッダを解析中にエラーのある行を見つけました
 ... サーバからメッセージを削除しました。
 xxx@xxxx.xxxx.jp 宛に届いた 2 番目のメッセージ(全部で 9 通)を読み込んでいます (2268 バイト) .. サーバからメッセージを削除しました。
 xxx@xxxx.xxxx.jp 宛に届いた 3 番目のメッセージ(全部で 9 通)を読み込んでいます (5979 バイト) fetchmail: ヘッダを解析中にエラーのある行を見つけました
 ..... サーバからメッセージを削除しました。
 xxx@xxxx.xxxx.jp 宛に届いた 4 番目のメッセージ(全部で 9 通)を読み込んでいます (2517 バイト) .. サーバからメッセージを削除しました。
 xxx@xxxx.xxxx.jp 宛に届いた 5 番目のメッセージ(全部で 9 通)を読み込んでいます (3730 バイト) ... サーバからメッセージを削除しました。
 xxx@xxxx.xxxx.jp 宛に届いた 6 番目のメッセージ(全部で 9 通)を読み込んでいます (810 バイト)  サーバからメッセージを削除しました。
 xxx@xxxx.xxxx.jp 宛に届いた 7 番目のメッセージ(全部で 9 通)を読み込んでいます (17807 バイト) ................. サーバからメッセージを削除しました。
 xxx@xxxx.xxxx.jp 宛に届いた 8 番目のメッセージ(全部で 9 通)を読み込んでいます (2709 バイト) fetchmail: ヘッダを解析中にエラーのある行を見つけました
 .. サーバからメッセージを削除しました。

落ちない。無事回復した模様。

documents/freebsd/freebsd-003.txt · 最終更新: 2023/04/14 02:32 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki