8
6

More than 5 years have passed since last update.

vagrant up時のエラー&ハマったこと【SSL_ERROR_SYSCALL, errno 10054とVBoxManage.exe: error】

Last updated at Posted at 2019-05-22

前提と背景

ドットインストールでローカル開発環境の構築[Windows編]を進めていて、2つハマった点があったので、同じ悲劇を繰り返さないためにも(半分自分のために)まとめておきます。

前提として、

  • Windows10
  • ドットインストールの動画通りに行っているので、一部インストールしているバージョンが古いです(CentOS6.8 / PHP5.6)
  • Vagrant 2.2.4 / PuTTY 0.70 / VirtualBox 6.0.8 / Cyberduck 6.9.4
  • 動画の 【 VirtualBox / Vagrantのインストール ~ vagrant init bento/centos-6.8、vagrantfileのローカルIPアドレスの記述を非コメント化 】 まではエラーなく完了しています。

vagrant upが終わらない

Vagrant,VirtualBoxを起動するために、
vagrant up
を実行。

5分くらい待つと、

PS C:\Users\user-\MyVagrant\MyCentOS> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'bento/centos-6.8' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'bento/centos-6.8'
    default: URL: https://vagrantcloud.com/bento/centos-6.8
==> default: Adding box 'bento/centos-6.8' (v2.3.4) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/bento/boxes/centos-6.8/versions/2.3.4/providers/virtualbox.box
==> default: Box download is resuming from prior download progress
    default: Download redirected to host: vagrantcloud-files-production.s3.amazonaws.com
    default: Progress: 0% (Rate: 0/s, Estimated time remaining: 9:19:26)

ここで止まっている。

まぁ重たいのインストールしてるのかな~と思い、そのまま10分くらい待つと

OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054

この表示が出て、中断してしまう。

調べた結果、ダウンロードするファイルが重たいのに回線が弱いのが原因っぽい。

参考:
https://gist.github.com/Buravo46/ebeaf29c0f74e42ad6b359413afe8aa7
より、主な解決方法は以下の2つ。

  • boxをローカルにダウンロードし、ローカルから参照する方法
  • boxの追加コマンドに、URLがHTTPSの場合はSSL証明書を検証しないオプションと古いtmpファイルを削除するオプションを付けて実行する方法

まぁOSのファイルをダウンロードするんだからそりゃ重たいよなー、と思いつつ、
まずはboxのローカルダウンロードがやりやすそうなのでそっちから。

Vagrantで仮想環境構築入門
を参考に、bento/centos-6.8をaddします。

PS C:\Users\user-\MyVagrant\MyCentOS> vagrant box add bento/centos-6.8
==> box: Loading metadata for box 'bento/centos-6.8'
    box: URL: https://vagrantcloud.com/bento/centos-6.8
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) parallels
2) virtualbox
3) vmware_desktop

Enter your choice: 2
==> box: Adding box 'bento/centos-6.8' (v2.3.4) for provider: virtualbox
    box: Downloading: https://vagrantcloud.com/bento/boxes/centos-6.8/versions/2.3.4/providers/virtualbox.box
==> box: Box download is resuming from prior download progress
    box: Download redirected to host: vagrantcloud-files-production.s3.amazonaws.com
    box: Progress: 59% (Rate: 0/s, Estimated time remaining: 0:08:21):56)
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 10054

途中でプロパイダ聞かれるので、、インストールしたVirtualBoxを選択。

しかしこれでも59%で止まってしまい、先程と同じエラー内容が出てしまいました。
ただ、「回線が弱いだけなので何回かaddコマンドを実行すれば出来る」と色んな記事に書いてあったのでめげずにやりまくる。(前回中断した時点からインストール再開してくれるっぽい)

==> box: Adding box 'bento/centos-6.8' (v2.3.4) for provider: virtualbox
    box: Downloading: https://vagrantcloud.com/bento/boxes/centos-6.8/versions/2.3.4/providers/virtualbox.box
==> box: Box download is resuming from prior download progress
    box: Download redirected to host: vagrantcloud-files-production.s3.amazonaws.com
    box: Progress: 100% (Rate: 88989/s, Estimated time remaining: --:--:--)
==> box: Successfully added box 'bento/centos-6.8' (v2.3.4) for 'virtualbox'!

6回目くらいでやっとadd成功!

listでboxが追加されているか確認して、upしてみます

PS C:\Users\user-\MyVagrant\MyCentOS> vagrant box list
bento/centos-6.8 (virtualbox, 2.3.4)

ちゃんと追加されてますね。
ってことで、いよいよvagrant upにチャレンジ!

PS C:\Users\user-\MyVagrant\MyCentOS> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'bento/centos-6.8'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bento/centos-6.8' version '2.3.4' is up to date...
==> default: Setting the name of the VM: MyCentOS_default_1558342412074_19344
Vagrant is currently configured to create VirtualBox synced folders with
the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual:

  https://www.virtualbox.org/manual/ch04.html#sharedfolders

This option can be disabled globally with an environment variable:

  VAGRANT_DISABLE_VBOXSYMLINKCREATE=1

or on a per folder basis within the Vagrantfile:

  config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false
==> default: Clearing any previously set network interfaces...

…と進んでいくので、何か聞かれたら適宜OKする。

が、次に新たなエラーが。。。

VirtualBox起動時にエラー

==> default: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "1eade055-2f48-44b4-8fe9-49d5ba9440fd", "--type", "headless"]

Stderr: VBoxManage.exe: error: Failed to open/create the internal network 'HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter' (VERR_INTNET_FLT_IF_NOT_FOUND).
VBoxManage.exe: error: Failed to attach the network LUN (VERR_INTNET_FLT_IF_NOT_FOUND)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole

ここまではうまくいくので、「Booting VM...」つまりVirtualBox起動時に何かがおかしいらしい。
エラーを読む限り原因はネットワーク周りっぽいですが、とりあえず調べます。

  1. ドットインストールの質問通りに処理(セキュリティソフトは後回し)
    ・ 仮想マシンが正常に終了せず、異常停止している場合があるため、vagrant halt で仮想マシンを確実に終了させ、その後 vagrant up を試す
    ・ セキュリティソフトが原因でエラーとなるケースもあるため、セキュリティソフトの停止もしくはアンインストール

  2. それでも直らないので VirtualBox で Failed to open/create the internal network 'HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter' が出た時の対処 を参考に設定
    ネットワークと共有センター > アダプターの設定の変更 で

    VirtualBox Host-Only Network #N" のプロパティを開く
    "VirtualBox NDIS6 Bridged Networking Driver" にチェックを入れる
    "インターネットプロトコル バージョン6(TCP/IPv6)" のチェックを外す
    [OK] を押し、プロパティウィンドウを閉じる
    "VirtualBox Host-Only Network #N" の右クリックメニューで「無効」にする
    再度、「有効」にし直す

3. それでも直らないのでVirtualBox,Vagrant全てアンインストール&再インストール、動画通りに再構築

まず、wifiを強い回線に繋ぎ直して全てをアンインストール&インストール。
長いのでトイレ休憩でもしながら待ちます。

それができたら、vagrant up
この時点で速度が全く違う…!
エラーなしでbox追加まで成功。

からの、VirtualBox起動時のエラーはやはり同じみたい…。

==> default: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "9981c9ae-65d3-4461-9f92-cb56cb53671c", "--type", "headless"]

Stderr: VBoxManage.exe: error: Failed to open/create the internal network 'HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter #2' (VERR_INTNET_FLT_IF_NOT_FOUND).
VBoxManage.exe: error: Failed to attach the network LUN (VERR_INTNET_FLT_IF_NOT_FOUND)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole

「'HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter #2'のネットワークを開けません」と言われているので、そこが原因なのは分かるんだけど…

エラー文を細分化して調べても、色んな記事で「アダプター設定のチェックボックスを入れて有効・無効にすればOK」としか書かれていないので、もう一度やってみます。

参考:
Windows10でVirtualBoxのホストオンリーアダプターがエラー
Failed to open/create the internal network Vagrant on Windows10

Host-Onlyのイーサネットアダプター全てを設定し直すことで解決!

コントロールパネル>ネットワークと共有センター>アダプター設定の変更
で、
「VirtualBox Host-Only Ethernet...」と書かれているイーサネット2のプロパティを開く
→チェックボックス
→インストール
→サービス
→Oracle~を選択
→OKして無効化
→有効化
を試します。(上に挙げた「Windows10でVirtualBoxのホストオンリーアダプターがエラー」の記事と同様)

キャプチャ.PNG

やっぱりそれでも変わらなかったので、隣にあった「 Host-Only... 」と書いてあるアダプター3も同じようにやってみるかぁ~と思い、プロパティを開く。

すると、この表記。
キャプチャ2.PNG

「接続の方法:Adapter#2」ってあるやんけ・・・
なんかこれっぽいぞ・・・

2と同様に設定し直すと、案の定エラー無くvagrant upで立ち上がりました。

アダプター2つとも同じ処理をしなければならなかったようです。
というわけで、アダプターが複数ある場合は全てのアダプターで設定し直してみましょう!

これで半日くらいハマってしまったのでまた同じことを繰り返さないよう、ここに残しておきます。。。

8
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
6