aoishiの備忘録

備忘録

CobblerでCentOS7のextrasリポジトリのミラーリングに失敗していたので原因調査してみた

CobblerでCentOS7の各種リポジトリをローカルにミラーリングしているが、extrasリポジトリミラーリングに失敗していたので、原因調査してみた。

先に結論を述べると、エラーとなっていたパッケージをローカルから削除して再度ミラーリングしたところ事象解決した。

環境

  • OS: CentOS 7.4
  • Cobbler: 2.8.2

調査

下記がCobblerでCentOS7のextraリポジトリミラーリングした際に出力されたメッセージ全文である。

# cobbler reposync --only=c7-extras
task started: 2018-02-10_081700_reposync
task started (id=Reposync, time=Sat Feb 10 08:17:00 2018)
hello, reposync
run, reposync, run!
creating: /var/www/cobbler/repo_mirror/c7-extras/config.repo
creating: /var/www/cobbler/repo_mirror/c7-extras/.origin/c7-extras.repo
running: /usr/bin/reposync -l -n -d --config=/var/www/cobbler/repo_mirror/c7-extras/.origin/c7-extras.repo --repoid=c7-extras --download_path=/var/www/cobbler/repo_mirror -a x86_64
received on stdout: Repository epel is listed more than once in the configuration
Repository epel-debuginfo is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
3.1 kB     00:00     
3.4 kB     00:00     
7.1 kB     00:00     
2.5 kB     00:00     
2.4 kB     00:00     
2.5 kB     00:00     
2.4 kB     00:00     
2.9 kB     00:00     
1.3 kB     00:00     
2.5 kB     00:00     
python-itsdangerous-0.23-2.el7 FAILED                                          
python-itsdangerous-0.23-2.el7.noarch: [Errno 256] No more mirrors to try.

received on stderr: 
Exception occured: <class 'cobbler.cexceptions.CX'>
Exception value: 'cobbler reposync failed'
Exception Info:
  File "/usr/lib/python2.7/site-packages/cobbler/utils.py", line 106, in die
    raise CX(msg)

Exception occured: <class 'cobbler.cexceptions.CX'>
Exception value: 'cobbler reposync failed'
Exception Info:
  File "/usr/lib/python2.7/site-packages/cobbler/action_reposync.py", line 119, in run
    self.sync(repo)
   File "/usr/lib/python2.7/site-packages/cobbler/action_reposync.py", line 163, in sync
    return self.yum_sync(repo)
   File "/usr/lib/python2.7/site-packages/cobbler/action_reposync.py", line 431, in yum_sync
    utils.die(self.logger,"cobbler reposync failed")
   File "/usr/lib/python2.7/site-packages/cobbler/utils.py", line 114, in die
    raise CX(msg)

reposync failed, tries left: 0
reposync failed, retry limit reached, skipping
running: chown -R root:apache /var/www/cobbler/repo_mirror/c7-extras
received on stdout: 
received on stderr: 
running: chmod -R 755 /var/www/cobbler/repo_mirror/c7-extras
received on stdout: 
received on stderr: 
Exception occured: <class 'cobbler.cexceptions.CX'>
Exception value: 'overall reposync failed, at least one repo failed to synchronize'
Exception Info:
  File "/usr/lib/python2.7/site-packages/cobbler/utils.py", line 106, in die
    raise CX(msg)

Exception occured: <class 'cobbler.cexceptions.CX'>
Exception value: 'overall reposync failed, at least one repo failed to synchronize'
Exception Info:
  File "/usr/lib/python2.7/site-packages/cobbler/remote.py", line 82, in run
    rc = self._run(self)
   File "/usr/lib/python2.7/site-packages/cobbler/remote.py", line 243, in runner
    3), name=name, nofail=nofail, logger=self.logger)
   File "/usr/lib/python2.7/site-packages/cobbler/api.py", line 804, in reposync
    return reposync.run(name)
   File "/usr/lib/python2.7/site-packages/cobbler/action_reposync.py", line 148, in run
    utils.die(self.logger,"overall reposync failed, at least one repo failed to synchronize")
   File "/usr/lib/python2.7/site-packages/cobbler/utils.py", line 114, in die
    raise CX(msg)

!!! TASK FAILED !!!

下記のメッセージが気になった。

python-itsdangerous-0.23-2.el7 FAILED                                          
python-itsdangerous-0.23-2.el7.noarch: [Errno 256] No more mirrors to try.

調査したところ、関連がありそうな記事として下記が見つかった。

同じパッケージ名でエラーになっている方が何名かいるようだった。 ミラーリング元の原因も考えられるが、ミラーリング先であるローカル環境の問題もあるので、両面からアプローチしてみる。

centosfaq.org

centos.1050465.n5.nabble.com

対応

ミラーリング元を変更(解決せず)

Cobblerのリポジトリ設定で、ミラーリング元を変更してみた。

まずは、現状の設定を確認する。

# cobbler repo report --name=c7-extras
Name                           : c7-extras
Apt Components (apt only)      : 
Apt Dist Names (apt only)      : 
Arch                           : x86_64
Breed                          : yum
Comment                        : 
Createrepo Flags               : <<inherit>>
Environment Variables          : {}
Keep Updated                   : True
Mirror                         : http://ftp.iij.ad.jp/pub/linux/centos/7/extras/x86_64
Mirror locally                 : True
Owners                         : ['admin']
Priority                       : 99
External proxy URL             : 
RPM List                       : []
Yum Options                    : {}

次に、ミラーリング元を変更する。IIJから同じ国内である理研に変更してみる。

# cobbler repo edit --name=c7-extras --mirror=http://ftp.riken.jp/Linux/centos/7/extras/x86_64

設定を再度確認し、Mirrorが変更後のURLとなったことを確認する。

[root@ope01 ~]# cobbler repo report --name=c7-extras
Name                           : c7-extras
Apt Components (apt only)      : 
Apt Dist Names (apt only)      : 
Arch                           : x86_64
Breed                          : yum
Comment                        : 
Createrepo Flags               : <<inherit>>
Environment Variables          : {}
Keep Updated                   : True
Mirror                         : http://ftp.riken.jp/Linux/centos/7/extras/x86_64
Mirror locally                 : True
Owners                         : ['admin']
Priority                       : 99
External proxy URL             : 
RPM List                       : []
Yum Options                    : {}

この状態で、下記コマンドで再度extrasリポジトリミラーリングしてみたが、同じエラーメッセージが出力されてしまった。

# cobbler reposync --only=c7-extras

事象解決しなかったため、切り戻しとしてミラーリング元のリポジトリ理研からIIJに戻した。

# cobbler repo edit --name=c7-extras --mirror=http://ftp.iij.ad.jp/pub/linux/centos/7/extras/x86_64

ローカルのファイルを削除(解決した)

Cobblerのリポジトリでは内部的にreposyncコマンドでミラーリングしており、--download_pathオプションでローカルのミラーリングディレクトリを指定していた。

/usr/bin/reposync -l -n -d --config=/var/www/cobbler/repo_mirror/c7-extras/.origin/c7-extras.repo --repoid=c7-extras --download_path=/var/www/cobbler/repo_mirror -a x86_64

そこで、ローカルのミラーリングディレクトリを見てみる。

# ls -al /var/www/cobbler/repo_mirror/c7-extras
合計 204
drwxr-xr-x   7 root apache     98  2月 10 10:15 .
drwxr-xr-x. 10 root root      141  9月 19 00:16 ..
drwxr-xr-x   2 root apache     46  2月 10 10:15 .origin
drwxr-xr-x   2 root apache  16384  2月 10 10:15 Packages
drwxr-xr-x   2 root apache  28672  2月 10 10:15 cache
-rwxr-xr-x   1 root apache    120  2月 10 10:15 config.repo
drwxr-xr-x   2 root apache 118784  1月 30 19:18 drpms
drwxr-xr-x   2 root apache   4096  2月 10 10:15 repodata

ここからは、乱暴だが下記を実施して改善したことを確認した。 もしかしたら、cache, repodataディレクトリの中身の削除は不要かもしれない。

  1. cacheディレクトリの中身をすべて削除
  2. repodataディレクトリの中身をすべて削除
  3. Packages/python-itsdangerous-0.23-2.el7.noarch.rpm を削除

再度ミラーリングしたところ、下記の通り事象が解決したことを確認した。

# cobbler reposync --only=c7-extras
task started: 2018-02-10_101508_reposync
task started (id=Reposync, time=Sat Feb 10 10:15:08 2018)
hello, reposync
run, reposync, run!
creating: /var/www/cobbler/repo_mirror/c7-extras/config.repo
creating: /var/www/cobbler/repo_mirror/c7-extras/.origin/c7-extras.repo
running: /usr/bin/reposync -l -n -d --config=/var/www/cobbler/repo_mirror/c7-extras/.origin/c7-extras.repo --repoid=c7-extras --download_path=/var/www/cobbler/repo_mirror -a x86_64
received on stdout: Repository epel is listed more than once in the configuration
Repository epel-debuginfo is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
3.1 kB     00:00     
3.4 kB     00:00     
7.6 kB     00:00     
3.4 kB     00:00     
2.4 kB     00:00     
2.5 kB     00:00     
2.4 kB     00:00     
2.9 kB     00:00     
1.3 kB     00:00     
2.5 kB     00:00     
 24 kB   00:00     

received on stderr: 
running: createrepo  -c cache -s sha /var/www/cobbler/repo_mirror/c7-extras
received on stdout: Spawning worker 0 with 103 pkgs
Spawning worker 1 with 103 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

received on stderr: 
running: chown -R root:apache /var/www/cobbler/repo_mirror/c7-extras
received on stdout: 
received on stderr: 
running: chmod -R 755 /var/www/cobbler/repo_mirror/c7-extras
received on stdout: 
received on stderr: 
*** TASK COMPLETE ***