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

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

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

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

Vagrant

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

Q&A

解決済

1回答

6770閲覧

vagrant upでエラーが出る

vnsa7221

総合スコア348

VirtualBox

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

Vagrant

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

0グッド

0クリップ

投稿2016/11/10 05:44

###前提・実現したいこと
dotinstallのローカル開発環境の構築レッスンを受講中。
仮想マシンの立ち上げを行うとエラーが出力され、その後vagrant sshを打ち込むとログインすることができない

###発生している問題・エラーメッセージ

vagrant upを入力した際のメッセージ Bringing machine 'default' up with 'virtualbox' provider... ==> default: Checking if box 'bento/centos-6.8' is up to date... ==> default: VirtualBox VM is already running. Inoues-MacBook-Pro:PHPCentOS Inoue$ vagrant reload ==> 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... ==> default: Checking if box 'bento/centos-6.8' is up to date... ==> default: Clearing any previously set forwarded ports... ==> 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: 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 ここまで出力
エラーメッセージ 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 sshを入力すると以下のメッセージが表記 ssh_exchange_identification: Connection closed by remote host

###試したこと
vi Vagrantfileコマンドにてconfig.vm.boot_timeout = 600と入力し、:wqで上書き保存済み

vagrant upコマンドでエラーが出た後vagrant statusを打ち込むとrunning (virtualbox)と表記はされる。
そのあとにvagrant sshを打ち込むとログインできない状態となっている。

###補足情報(言語/FW/ツール等のバージョンなど)
private keyの部分で止まっているのでkeyがうまく設定できていないのかなと思うのですが、素人のためどのように訂正をすれば良いのか全くわからない状態でございます。
大変申し訳ありませんが、分かりやすいアドバイスよろしくお願いいたします。

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

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

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

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

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

imutakaoru

2016/11/10 06:36

ホストOSはなんでしょう?あとVagrantとVirtualboxのバージョンを教えてください。
vnsa7221

2016/11/10 06:41

ホストOSはMacで使用しております。またVagrantは1.8.1、Virtualboxは5.0.16r105871となっています。
imutakaoru

2016/11/10 07:19

VirtualBoxマネージャGUIで、表示(緑色の矢印)を押してGUIコンソールが起動できますか?GUIコンソールになにか表示されますか?
vnsa7221

2016/11/10 07:57

すみません。素人のためVirtualBoxマネージャGUIがどれなのかが全くわからないのですが・・・。どのようにアクセスすればよろしいのでしょうか・・・
vnsa7221

2016/11/10 08:00

すみません。わかりました。表示を押したら黒い画面が出たのですが、何も表示されない状態となっています。
imutakaoru

2016/11/10 08:06

その黒い画面が出ている状態で、Enterキーなどを押しても反応がない状態でしょうか。
vnsa7221

2016/11/10 08:39

enterをクリックするとCentOS release 6.8 (Final) Kernel 2.6.32-642.el6.×86_64 on an ×86_64 localhost loginと表記されました。
guest

回答1

0

ベストアンサー

追記ありがとうございます。
状況から、ゲストOSは正常に起動していて、ただ、sshによるリモートログインができない状態であると
考えられます。

GUIコンソールからログインID:vagrant パスワード:vagrantでログインできますので、ログインしたら、
cd .ssh
でsshのキーファイルのあるディレクトリに移動してください。
そこで
ls -l
とコマンドをたたいて、authorized_keysファイルの状態を確認してください。

[vagrant@localhost .ssh]$ ls -l total 4 -rw------- 1 vagrant vagrant 389 Sep 28 10:23 authorized_keys

このような状態が正しい状態となります。GUI環境でログインしてご確認ください。

※ただ、VirtualBoxもvagrantもバージョンが古いのが気になります。
VirtualBox5.18 Vagrant1.8.6の環境をお勧めします。

投稿2016/11/10 08:56

imutakaoru

総合スコア356

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

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

vnsa7221

2016/11/10 09:23

回答ありがとうございます。 imutakaoruさんのご提示いただいた手順に沿って確認いたしましたところ、 ``` [vagrant@localhost .ssh]$ ls -l total 4 -rw-------. 1 vagrant root 409 Oct 1 11:50 authorized_keys ``` と表記されました。おそらく正しい状態なのかなと思います。 一度バージョンが古いということなので、アップデートしてみて同様に解決しないようであればまた解決方法を探してみたいと思います。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問