ChefのChildConvergeErrorの対処法
VirtualboxとVagrantで立てた仮想UbuntuにChefを使い、自動設定しているときに、下記のエラーがでた。
Ubuntuのバージョンは13.04。
FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1) ERROR: RuntimeError: chef-solo failed. See output above.
ログを見てみると、ソフトに必要なパッケージが途中までインストールされて中断されていた。
そのため、Chefの設定の書式間違えではなく、処理のタイムアウトか、メモリなどのリソース 不足であると考えて、次のように対処した。
- 仮想サーバーに割り当てるメモリを増やす。
Vagrantfileの設定を変更することで、増やすことができる。
デフォルトは512Mだが、一時的に1024Mに増やす。
必要に応じて、無理のない範囲で行う。
config.vm.provider :virtualbox do |vb| # # Don't boot with headless mode # vb.gui = true # # # Use VBoxManage to customize the VM. For example to change memory: vb.customize ["modifyvm", :id, "--memory", "1024"] end
- apt-getでインストールするパッケージの取得元を変更する。
sources.listを確認するとarchive.ubuntu.comとかjp.archive.ubuntu.com、us.archive.ubuntu.comになっている。 これをhttp://ftp.jaist.ac.jp/pub/Linux/ubuntu に変更する。
$ cat /etc/apt/sources.list # /etc/apt/sources.list # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://ftp.jaist.ac.jp/pub/Linux/ubuntu raring main deb-src http://ftp.jaist.ac.jp/pub/Linux/ubuntu raring main ## Major bug fix updates produced after the final release of the ## distribution. deb http://ftp.jaist.ac.jp/pub/Linux/ubuntu raring-updates main deb-src http://ftp.jaist.ac.jp/pub/Linux/ubuntu raring-updates main ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://ftp.jaist.ac.jp/pub/Linux/ubuntu raring universe deb-src http://ftp.jaist.ac.jp/pub/Linux/ubuntu raring universe deb http://ftp.jaist.ac.jp/pub/Linux/ubuntu raring-updates universe deb-src http://ftp.jaist.ac.jp/pub/Linux/ubuntu raring-updates universe
変更するときは、sedコマンドを使うといい。
sudo sed -e 's/\/\/archive.ubuntu.com/\/\/ftp.jaist.ac.jp\/pub\/Linux\/ubuntu/g' /etc/apt/sources.list
後はapt-get updateして、読み込ませる。
これで、だいぶ処理が早くなり、正常に処理を完了する事ができた。