vagrantでcentos7をインストールしようと思い、こちらを参考にcentos7のboxをインストール。
% vagrant box add centos/7
しかし、上記コマンド実行後にOpenSSL SSL_read: Connection reset by peer, errno 54
というエラーが出た。
% vagrant box add centos/7
==> box: Loading metadata for box 'centos/7'
box: URL: https://vagrantcloud.com/centos/7
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.
1) hyperv
2) libvirt
3) virtualbox
4) vmware_desktop
Enter your choice: 3
==> box: Adding box 'centos/7' (v1905.1) for provider: virtualbox
box: Downloading: https://vagrantcloud.com/centos/boxes/7/versions/1905.1/providers/virtualbox.box
box: Download redirected to host: cloud.centos.org
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
OpenSSL SSL_read: Connection reset by peer, errno 54
原因
ダウンロード関係のファイル等が格納されている~/.vagrant.d/tmp
フォルダに、ダウンロードに失敗したゴミファイルが残ってしまっているのが原因だった。
% ls ~/.vagrant.d/tmp
box2105a8feebeaa01a32d7ed5e2fdbadf5b94181a5
解決方法
ゴミファイルを削除。
% rm ~/.vagrant.d/tmp/*
zsh: sure you want to delete the only file in /Users/username/.vagrant.d/tmp [yn]? y
remove /Users/username/.vagrant.d/tmp/box2105a8feebeaa01a32d7ed5e2fdbadf5b94181a5?
これで再度vagrant add
を実行したら無事インストールされた。
% vagrant box add centos/7
==> box: Loading metadata for box 'centos/7'
box: URL: https://vagrantcloud.com/centos/7
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.
1) hyperv
2) libvirt
3) virtualbox
4) vmware_desktop
Enter your choice: 3
==> box: Adding box 'centos/7' (v1905.1) for provider: virtualbox
box: Downloading: https://vagrantcloud.com/centos/boxes/7/versions/1905.1/providers/virtualbox.box
==> box: Box download is resuming from prior download progress
box: Download redirected to host: cloud.centos.org
==> box: Successfully added box 'centos/7' (v1905.1) for 'virtualbox'!