Vagrant OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 60

macOS Sierraで「OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 60」エラーが発生しました。

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'moonphase/amazonlinux2' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'moonphase/amazonlinux2'
    default: URL: https://vagrantcloud.com/moonphase/amazonlinux2
==> default: Adding box 'moonphase/amazonlinux2' (v2017.12.0.20180330) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/moonphase/boxes/amazonlinux2/versions/2017.12.0.20180330/providers/virtualbox.box
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: SSL_ERROR_SYSCALL, errno 60

一時ファイルを削除して、やり直してみます。

$ rm -rf ~/.vagrant.d/tmp/
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'moonphase/amazonlinux2' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'moonphase/amazonlinux2'
    default: URL: https://vagrantcloud.com/moonphase/amazonlinux2
==> default: Adding box 'moonphase/amazonlinux2' (v2017.12.0.20180330) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/moonphase/boxes/amazonlinux2/versions/2017.12.0.20180330/providers/virtualbox.box
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: SSL_ERROR_SYSCALL, errno 60

-cフラグ(Clean any temporary download files)でも試してみます。

$ vagrant box add -c moonphase/amazonlinux2
==> box: Loading metadata for box 'moonphase/amazonlinux2'
    box: URL: https://vagrantcloud.com/moonphase/amazonlinux2
==> box: Adding box 'moonphase/amazonlinux2' (v2017.12.0.20180330) for provider: virtualbox
    box: Downloading: https://vagrantcloud.com/moonphase/boxes/amazonlinux2/versions/2017.12.0.20180330/providers/virtualbox.box
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: SSL_ERROR_SYSCALL, errno 60

–insecureフラグ(Do not validate SSL certificates)を試してみます。

$ vagrant box add --insecure moonphase/amazonlinux2
==> box: Loading metadata for box 'moonphase/amazonlinux2'
    box: URL: https://vagrantcloud.com/moonphase/amazonlinux2
==> box: Adding box 'moonphase/amazonlinux2' (v2017.12.0.20180330) for provider: virtualbox
    box: Downloading: https://vagrantcloud.com/moonphase/boxes/amazonlinux2/versions/2017.12.0.20180330/providers/virtualbox.box
==> box: Box download is resuming from prior download progress
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: SSL_ERROR_SYSCALL, errno 60

httpを指定してみます。

$ vagrant box add -c -insecure moonphase/amazonlinux2 http://vagrantcloud.com/moonphase/amazonlinux2
==> box: Loading metadata for box 'http://vagrantcloud.com/moonphase/amazonlinux2'
==> box: Adding box 'moonphase/amazonlinux2' (v2017.12.0.20180330) for provider: virtualbox
    box: Downloading: https://vagrantcloud.com/moonphase/boxes/amazonlinux2/versions/2017.12.0.20180330/providers/virtualbox.box
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: SSL_ERROR_SYSCALL, errno 60

そもそもダウンロードが遅いので、Chromeで直接ファイルをダウンロードしてみました。なぜか失敗しました。

Windows10(有線)でダウンロードしたところ、なんと1分でダウンロードできました。
無線かMacが原因でしょうか?とりあえずWindowsでダウンロードしたファイルを指定してみます。

$ vagrant box add moonphase/amazonlinux2 file://104a31ec-b021-4876-95c3-c129054036e9
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'moonphase/amazonlinux2' (v0) for provider:
    box: Unpacking necessary files from: file://104a31ec-b021-4876-95c3-c129054036e9
==> box: Successfully added box 'moonphase/amazonlinux2' (v0) for 'virtualbox'!

立ち上がりました!

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'moonphase/amazonlinux2'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: defaulthost
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...

MacでS3からのダウンロードができないことが原因でした。