繋がらないんだよね〜

セリカ!

最近どうにも ftp.jp.debian.org に繋がらないことが多い。

paraches@debian:~$ sudo apt-get update
Password:
ヒット http://security.debian.org stable/updates/main Packages                   
ヒット http://security.debian.org stable/updates/main Release                    
エラー http://ftp.jp.debian.org stable/main Packages                             
  ftp.jp.debian.org:80 (203.178.137.175) へ接続できませんでした。接続がタイムアウトしました
エラー http://ftp.jp.debian.org stable/main Release          
  ftp.jp.debian.org:80 (203.178.137.175) へ接続できませんでした。接続がタイムアウトしました
エラー http://ftp.jp.debian.org stable/main Sources          
  ftp.jp.debian.org:80 (203.178.137.175) へ接続できませんでした。接続がタイムアウトしました
エラー http://ftp.jp.debian.org stable/main Release          
  ftp.jp.debian.org:80 (203.178.137.175) へ接続できませんでした。接続がタイムアウトしました
http://ftp.jp.debian.org/debian/dists/stable/main/binary-powerpc/Packages.gz の取得に失敗しました  ftp.jp.debian.org:80 (203.178.137.175) へ接続できませんでした。接続がタイムアウトしました
http://ftp.jp.debian.org/debian/dists/stable/main/binary-powerpc/Release の取得に失敗しました  ftp.jp.debian.org:80 (203.178.137.175) へ接続できませんでした。接続がタイムアウトしました
http://ftp.jp.debian.org/debian/dists/stable/main/source/Sources.gz の取得に失敗しました  ftp.jp.debian.org:80 (203.178.137.175) へ接続できませんでした。接続がタイムアウトしました
http://ftp.jp.debian.org/debian/dists/stable/main/source/Release の取得に失敗しました  ftp.jp.debian.org:80 (203.178.137.175) へ接続できませんでした。接続がタイムアウトしました
パッケージリストを読みこんでいます... 完了0%
E: いくつかのインデックスファイルのダウンロードに失敗しました。無視されたか、あるいは古いものが使用されました。

どうも debian を使う人は自分に近い場所のサーバを apt-get で繋ぐサーバに選択するみたいだ。自分はインストールの時に面倒だからデフォルトになってる ftp.jp.debian.org にしちゃったけど、そのサーバがどうにも調子悪いんだからこの機会にサーバをちゃんと選択してみよう。
で、サーバの選択は apt-spyってのが自動でやってくれるみたいだけど… ftp.jp.debian.org に繋がらないんじゃインストールできないじゃん!
というわけで、仕方がないのでひとまずメジャー(?)な所に接続して apt-spy を落とせるようにしよう。
とりあえず apt-sources の内容はこんな感じ。so-net にしてみた。

deb http://ring.so-net.ne.jp/pub/linux/debian/debian stable main contrib non-free
deb-src http://ring.so-net.ne.jp/pub/linux/debian/debian stable main contrib non-free
deb http://ring.so-net.ne.jp/pub/linux/debian/debian-jp stable-jp main contrib non-free
deb-src http://ring.so-net.ne.jp/pub/linux/debian/debian-jp stable-jp main contrib non-free


deb http://security.debian.org/ stable/updates main contrib non-free

で、オリジナルの sources.list は念のために名前を変えてとっておいて、ホームディレクトリに作った新しい sources.list を /etc/apt に持ってくる。

paraches@debian:/etc/apt$ sudo mv sources.list sources.list.org
paraches@debian:/etc/apt$ cd
paraches@debian:~$ sudo cp sources.list /etc/apt
paraches@debian:~$ cd /etc/apt
paraches@debian:/etc/apt$ ls
apt.conf.d  sources.list  sources.list.org

これでとりあえずは apt-get できるようになったはず。確認。

paraches@debian:/etc/apt$ sudo apt-get update
取得:1 http://ring.so-net.ne.jp stable/main Packages [3276kB]
ヒット http://security.debian.org stable/updates/main Packages                    
ヒット http://security.debian.org stable/updates/main Release                     
取得:2 http://security.debian.org stable/updates/contrib Packages [537B]         
取得:3 http://security.debian.org stable/updates/contrib Release [116B]          
取得:4 http://security.debian.org stable/updates/non-free Packages [20B]
取得:5 http://security.debian.org stable/updates/non-free Release [117B]
99% [1 Packages gzip 0] [ヘッダの待機中です]                         287kB/s 取得:6 http://ring.so-net.ne.jp stable/main Release [98B]                        
取得:7 http://ring.so-net.ne.jp stable/contrib Packages [48.4kB]                 
99% [1 Packages gzip 1429504] [ヘッダの待機中です]                   287kB/s 取得:8 http://ring.so-net.ne.jp stable/contrib Release [101B]                    
取得:9 http://ring.so-net.ne.jp stable/non-free Packages [46.9kB]                
99% [1 Packages gzip 3268608] [ヘッダの待機中です]                   287kB/s 取得:10 http://ring.so-net.ne.jp stable/non-free Release [102B]                  
取得:11 http://ring.so-net.ne.jp stable/main Sources [1322kB]                    
99% [ヘッダの待機中です]                                             295kB/s 取得:12 http://ring.so-net.ne.jp stable/main Release [97B]                       
99% [11 Sources gzip 0] [ヘッダの待機中です]                         295kB/s 取得:13 http://ring.so-net.ne.jp stable/contrib Sources [24.8kB]                 
取得:14 http://ring.so-net.ne.jp stable/contrib Release [100B]                   
取得:15 http://ring.so-net.ne.jp stable/non-free Sources [23.5kB]                
99% [11 Sources gzip 1363968] [ヘッダの待機中です]                   295kB/s 取得:16 http://ring.so-net.ne.jp stable/non-free Release [101B]                  
取得:17 http://ring.so-net.ne.jp stable-jp/main Packages [4668B]                 
取得:18 http://ring.so-net.ne.jp stable-jp/main Release [90B]                    
取得:19 http://ring.so-net.ne.jp stable-jp/contrib Packages [1834B]              
取得:20 http://ring.so-net.ne.jp stable-jp/contrib Release [93B]                 
取得:21 http://ring.so-net.ne.jp stable-jp/non-free Packages [2611B]             
取得:22 http://ring.so-net.ne.jp stable-jp/non-free Release [94B]                
取得:23 http://ring.so-net.ne.jp stable-jp/main Sources [3732B]                  
99% [11 Sources gzip 2527232] [ヘッダの待機中です]                   295kB/s 無視 http://ring.so-net.ne.jp stable-jp/main Release                             
取得:24 http://ring.so-net.ne.jp stable-jp/contrib Sources [638B]                
無視 http://ring.so-net.ne.jp stable-jp/contrib Release                          
取得:25 http://ring.so-net.ne.jp stable-jp/non-free Sources [1280B]              
99% [11 Sources gzip 3072000] [ヘッダの待機中です]                   295kB/s 無視 http://ring.so-net.ne.jp stable-jp/non-free Release                         
4758kB を 16s で取得しました (286kB/s)                                                 
パッケージリストを読みこんでいます... 完了%
paraches@debian:/etc/apt$ 

ここまでは OK。
で、今度は apt-spy をインストール。

paraches@debian:/etc/apt$ sudo apt-get install apt-spy
パッケージリストを読みこんでいます... 完了0%
依存関係ツリーを作成しています... 完了%     
以下のパッケージが新たにインストールされます:
  apt-spy
アップグレード: 0 個、新規インストール: 1 個、削除: 0 個、保留: 1 個。
29.8kB のアーカイブを取得する必要があります。
展開後に追加で 193kB のディスク容量が消費されます。
取得:1 http://ring.so-net.ne.jp stable/main apt-spy 3.1-13 [29.8kB]
29.8kB を 0s で取得しました (95.5kB/s)
未選択パッケージ apt-spy を選択しています。
(データベースを読み込んでいます... 現在 41646 個のファイルとディレクトリがインストールされています。)
(.../apt-spy_3.1-13_powerpc.deb から) apt-spy を展開しています...
apt-spy (3.1-13) を設定しています ...

paraches@debian:/etc/apt$ 

さて、これで apt-spy が自分に近いサーバを探してくれるはず。早速起動だ!

paraches@debian:/etc/apt$ sudo apt-spy -d stable -s JP

SERVER: ftp2.jp.debian.org
Benchmarking FTP...
                Error: 〓?〓7〓〓
Benchmarking HTTP...
                Error: The requested URL returned error: 404
<長いので省略>
SERVER: www.ring.gr.jp
Benchmarking FTP...
                Downloaded 4437370 bytes in 22.98 seconds
                Download speed: 188.54 kB/sec
Benchmarking HTTP...
                Downloaded 4055966 bytes in 25.40 seconds
                Download speed: 155.95 kB/sec
Writing new sources.list file: /etc/apt/sources.list 
paraches@debian:/etc/apt$ 

というわけで、新しい sources.list ファイルができた!
早速中身を確認!

paraches@debian:/etc/apt$ cat sources.list
# sources.list generated by apt-spy v3.1
deb ftp://ring.hosei.ac.jp/pub/linux/debian/debian/ stable main
deb-src ftp://ring.hosei.ac.jp/pub/linux/debian/debian/ stable main
deb http://security.debian.org/ stable/updates main
paraches@debian:/etc/apt$ 

なるほど、法政大学なのね。なんか意外な感じ。
で、sources.list ファイルが新しくなったので、apt-get update しておく。

paraches@debian:/etc/apt$ sudo apt-get update
取得:1 ftp://ring.hosei.ac.jp stable/main Packages [3276kB]
取得:2 http://security.debian.org stable/updates/main Packages [218kB]           
取得:3 ftp://ring.hosei.ac.jp stable/main Release [98B]                          
取得:4 ftp://ring.hosei.ac.jp stable/main Sources [1322kB]                       
取得:5 http://security.debian.org stable/updates/main Release [113B]             
99% [4 Sources gzip 0] [問い合わせ]                                  291kB/s 取得:6 ftp://ring.hosei.ac.jp stable/main Release [97B]                          
4816kB を 17s で取得しました (280kB/s)                                                 
パッケージリストを読みこんでいます... 完了%
paraches@debian:/etc/apt$ 

これで、今後は apt-get でサーバに繋がらないってこともほぼ無くなってくれるんだろうな〜。
めでたしめでたし?