質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ubuntu

Ubuntuは、Debian GNU/Linuxを基盤としたフリーのオペレーティングシステムです。

VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

Q&A

解決済

2回答

4117閲覧

vagrant upを実行してもTime outになってしまう

Gr.

総合スコア89

Ubuntu

Ubuntuは、Debian GNU/Linuxを基盤としたフリーのオペレーティングシステムです。

VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

0グッド

0クリップ

投稿2019/03/19 04:33

編集2019/03/19 07:24

vagrant upを実行してもTime outになってしまいます。
考えられる原因と解決策を具体的に教えていただきたいです。

症状

以下、全てwindowsコマンドプロンプトに打っています。
VMはUbuntuです。

C:\Users\hoge\vagrant>vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Checking if box 'ubuntu/trusty32' version '20181022.0.0' is up to date... ==> default: A newer version of the box 'ubuntu/trusty32' is available and already ==> default: installed, but your Vagrant machine is running against ==> default: version '20181022.0.0'. To update to version '20190305.0.0', ==> default: destroy and recreate your machine. ==> default: Clearing any previously set forwarded ports... ==> default: Vagrant has detected a configuration issue which exposes a ==> default: vulnerability with the installed version of VirtualBox. The ==> default: current guest is configured to use an E1000 NIC type for a ==> default: network adapter which is vulnerable in this version of VirtualBox. ==> default: Ensure the guest is trusted to use this configuration or update ==> default: the NIC type using one of the methods below: ==> default: ==> default: https://www.vagrantup.com/docs/virtualbox/configuration.html#default-nic-type ==> default: https://www.vagrantup.com/docs/virtualbox/networking.html#virtualbox-nic-type ==> 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: 3000 (guest) => 3000 (host) (adapter 1) default: 22 (guest) => 2222 (host) (adapter 1) ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key

default: SSH auth method: private keyから進まなくなり、しばらくしたのち以下のようなエラー文が出ます。

==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key Timed out while waiting for the machine to boot. This means that Vagrant was unable to communicate with the guest machine within the configured ("config.vm.boot_timeout" value) time period. If you look above, you should be able to see the error(s) that Vagrant had when attempting to connect to the machine. These errors are usually good hints as to what may be wrong. If you're using a custom box, make sure that networking is properly working and you're able to connect to the machine. It is a common problem that networking isn't setup properly in these boxes. Verify that authentication configurations are also setup properly, as well. If the box appears to be booting properly, you may want to increase the timeout ("config.vm.boot_timeout") value.

この状態でvagrant statusを確認すると、

C:\Users\hoge\vagrant>vagrant status Current machine states: default running (virtualbox) The VM is running. To stop this VM, you can run `vagrant halt` to shut it down forcefully, or you can run `vagrant suspend` to simply suspend the virtual machine. In either case, to restart it again, simply run `vagrant up`.

VMは起動しているようです。
しかし、ssh接続ができません。
vagrant ssh

C:\Users\hoge\vagrant>vagrant ssh ssh_exchange_identification: read: Connection reset

vagrant haltを打つと次のようなメッセージが出ます。

C:\Users\hoge\vagrant>vagrant halt ==> default: Attempting graceful shutdown of VM... default: Guest communication could not be established! This is usually because default: SSH is not running, the authentication information was changed, default: or some other networking issue. Vagrant will force halt, if default: capable. ==> default: Forcing shutdown of VM...

the authentication information was changed or some other networking issue

この場合の変更してしまった可能性のあるauthentication informationとは主に何であるケースが多いでしょうか。

自力で調べた原因と結果

<原因>
0. 単にタイムアウトまでの時間が短い
0. 仮想化支援機構(Virtualization)が無効になっている
0. private keyの場所が間違っている
0. セキュリティソフト/ファイアウォールに引っかかっている
0. Virtual Boxのアダプターでケーブル接続のチェックが外れている
0. Wi-Fiに問題がある

<結果>
0. Vagrantfileを修正し時間を伸ばしてみたが変化なし。
0. 「有効」になっている。
0. vagrant ssh-configで参照場所を確かめ、そこにちゃんとあるのを確認。
0. セキュリティソフトを一時的に無効化し再度試みたが変化なし。
0. チェックしてある。
0. 普段使っているWi-Fiから別のもの(スマホのテザリング)に変更したが変化なし。

<試してみたがよくわからなかった解決策>

GUIコンソールからログインし…
→Vagrantfileの以下の部分のコメントアウトを外し、vagrant upと同時に自動でGUIコンソールを開くも、何も打ち込めないところで止まる。

config.vm.provider "virtualbox" do |vb|
vb.gui = true
end

Vagrantfileに以下を追記する…
→以下を追記し再起動するも変化なし。

config.vm.provider "virtualbox" do |vb|

vb.customize ["modifyvm", :id, "--cableconnected1", "on"]

end

自力では手詰まりです。
考えうる原因とその解決策を具体的に教えて下さい。

参考

vagrant ssh-config

C:\Users\hoge\vagrant>vagrant ssh-config Host default HostName 127.0.0.1 User vagrant Port 2222 UserKnownHostsFile /dev/null StrictHostKeyChecking no PasswordAuthentication no IdentityFile C:/Users/hoge/vagrant/.vagrant/machines/default/virtualbox/private_key IdentitiesOnly yes LogLevel FATAL

質問文に不足があれば以下に追記します。

C:\Users\hoge\vagrant>vagrant version Installed Version: 2.2.4 Latest Version: 2.2.4

VirtualBox version: 5.2.6
Windows10

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

xenbeat

2019/03/19 04:55

os, vagrantとvirtualboxのバージョンを追記ください。
Stan_Dma

2019/03/19 04:56

This problem may be known to be related to variety of reasons, and you have tried some to resolve it. I would like to say that your ubuntu/trusty32 virtual box is a little bit older than the latest.
t_obara

2019/03/19 05:01

http://stupiddog.jp/note/archives/466 ssh接続時のログをご提示ください。「Connection reset」の場合、sshdとは違うサービスに接続しようとした場合が多いかと。
Stan_Dma

2019/03/19 05:05

Issuing "vagrant up --debug" is also useful to get more information.
Gr.

2019/03/19 05:05

xenbeatさん virtualboxのバージョンの調べ方がよくわかりません。 文中にある'ubuntu/trusty32' version '20181022.0.0'のことで合ってますか?
Gr.

2019/03/19 05:09

Stan_Dmaさん "vagrant up --debug"を打ってみたらデバグの情報が延々と出ました。とめどなく出るので途中で強制キャンセルしましたが、いったいどこをどう見ればよいのでしょうか…
Stan_Dma

2019/03/19 05:16 編集

Sometimes do like "vagrant up --debug >debug.txt 2>&1" and see debug.txt using the Explorer. You may cancel any time on the command prompt by hitting Ctrl+C. Many information includes many clues to solve it.
Gr.

2019/03/19 05:15

t_obaraさん ssh接続自体ができないのですが、以下を入力してみたところしばらく待ってから何も表示されずにタイムアウトしました。 vagrant ssh -- -v -E sample.log
Stan_Dma

2019/03/19 05:25 編集

FYI, the debug.txt I explained above would read the VirtualBox version included, like "DEBUG subprocess: stdout: 6.0.4r128413".
Gr.

2019/03/19 05:24

xenbeatさん VirtualBoxのversionは5.2.6でした。
kazto

2019/03/19 05:32

ホストマシンのメモリ容量、およびvagrantで割り当てているメモリ容量はいかほどでしょうか。
t_obara

2019/03/19 05:34

vagrant ssh -- -v -E sample.log のコマンドであれば、ログは表示されず、sample.logに出力されます。
Gr.

2019/03/19 05:41

kaztoさん ホストマシンは実装RAM 8.00GB Vagranfileには vb.memory = "1024"とあります。
Gr.

2019/03/19 05:47

"vagrant up --debug" を入力すると、はじめの方に WARN global: resolv replacement has not been enabled! と出ますが関係あるのでしょうか?
Stan_Dma

2019/03/19 06:32 編集

There was a bug in the VirtualBox about networking, causing to display message like "Vagrant has detected a configuration issue... configured to use an E1000 NIC type...". I am not sure that is for version 5.2.20 or lower. see https://github.com/hashicorp/vagrant/issues/10481 . How about updating the VirtualBox to 6.0 if posibble. (ps. I am not totally sure.)
guest

回答2

0

自己解決

rails new から作り直すことで解決しました。

投稿2019/06/04 01:56

Gr.

総合スコア89

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

仮想化支援機構を有効にすることで解決するのではないかと思います。
こちらの記事を参考に設定してみてください。

投稿2019/03/19 04:46

xenbeat

総合スコア4258

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Gr.

2019/03/19 04:47

xenbeatさん 回答ありがとうございます。 質問文に書いた通り、仮想化支援機構は有効になっています。
yoorwm

2019/03/19 05:32

windowsで仮想化支援機構が有効になっているということは、Hyper-Vマネージャを起動してみるとどうですか?
Gr.

2019/03/19 05:57

yoorwmさん windows 10 Homeエディションを使っています。
xenbeat

2019/03/19 07:47

> 質問文に書いた通り、仮想化支援機構は有効になっています。 見落とし失礼しました。 こちらで同環境を用意できないのでおそらくになりますがVirtualBoxとboxの相性が悪いように思います。 問題を切り分けるために、一度destroyしてboxを「ubuntu/trusty32」から「bento/ubuntu-16.04」とかに変更してみてはいかがでしょうか。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問