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

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

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

Microsoft Windows 7は過去にリリースされたMicrosoft WindowsのOSであり、Windows8の1代前です。2009年の7月にリリースされ販売されました。Windows7の前はWindowsVistaで、その更に3年前にリリースされました。

VirtualBox

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

Vagrant

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

Q&A

解決済

1回答

5327閲覧

vagrant up が 「SSH auth method: private key」で止まる

teityura

総合スコア84

Windows 7

Microsoft Windows 7は過去にリリースされたMicrosoft WindowsのOSであり、Windows8の1代前です。2009年の7月にリリースされ販売されました。Windows7の前はWindowsVistaで、その更に3年前にリリースされました。

VirtualBox

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

Vagrant

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

0グッド

0クリップ

投稿2019/05/18 05:07

したいこと

・仮想環境の構築イメージをなんとなく掴んでおきたい。
・今後のために、手軽にローカル開発環境を構築できるようになりたい。
・(もし、vagrantの仕様?バグ?で、毎度SSHの鍵登録・修正等が必要なら、
VirtualBox+Vagrant で作るのを諦めて、Docker等を使う予定です。
が、悔しいので、ある程度、原因を突き止めておきたい。)

実行環境

ともに最新バージョンのインストーラーを使いました。
Windows7 Ultimate 64bit
VirtualBox-6.0.8-130520-Win
vagrant_2.2.4_x86_64

VM起動手順と、タイムアウトになる様子

cd C:\Users\<username> mkdir vagrant cd vagrant mkdir ubuntu16 cd ubuntu16 vagrant init bento/ubuntu-16.04 # Vagrantfileをテキストエディタで編集 config.vm.network "private_network", ip: "192.168.2.1" # 追記 vagrant up PS C:\Users\<username>\vagrant\ubuntu16> vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Box 'bento/ubuntu-16.04' could not be found. Attempting default: Box Provider: virtualbox default: Box Version: >= 0 ==> default: Loading metadata for box 'bento/ubuntu-16.04' default: URL: https://vagrantcloud.com/bento/ubuntu-16.04 ==> default: Adding box 'bento/ubuntu-16.04' (v201812.27.0) for prov default: Downloading: https://vagrantcloud.com/bento/boxes/ubunt x default: Download redirected to host: vagrantcloud-files-product default: Progress: 100% (Rate: 1498k/s, Estimated time remaining ==> default: Successfully added box 'bento/ubuntu-16.04' (v201812.27 ==> default: You assigned a static IP ending in ".1" to this machine ==> default: This is very often used by the router and can cause the ==> default: network to not work properly. If the network doesn't wo ==> default: properly, try changing this IP. ==> default: Importing base box 'bento/ubuntu-16.04'... ==> default: Matching MAC address for NAT networking... ==> default: You assigned a static IP ending in ".1" to this machine ==> default: This is very often used by the router and can cause the ==> default: network to not work properly. If the network doesn't wo ==> default: properly, try changing this IP. ==> default: Checking if box 'bento/ubuntu-16.04' version '201812.27 ==> default: Setting the name of the VM: ubuntu16_default_1558153258 ==> 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 minute 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.

VM自体は起動していて、VirtualBoxでGUI経由で見ると、
ログインプロンプトが立ち上がっていて、ログインもできました。

ここを参考に4つほど試しました。

Windows7にVagrantを導入 - 失敗した事

1. 切り分けのため、GUIで起動

・VMが起動しているか
・BIOS設定で仮想化機能が有効になってないメッセージが出ないか
を確認

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

2. ケーブル接続が外れているのを修正

・VirtualBoxの設定でケーブル接続されていなかったとき?
そもそもVirtualBoxで見たとき、「ケーブル接続」にチェック入っていました。

config.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--cableconnected1", "on"] end

3. VirtualBox, Vagrant バージョンを落とす

VirtualBox DLページ
Vagrant DLページ
・VirtualBox-5.1.38-122592-Win
・vagrant_1.9.6_x86_64
で試すも再発。。

4. boxを消して、他の新しいboxで試す

・bento/centos-6.8
・bento/centos-7.2
・bento/ubuntu-16.04
再発。。。

# 確認 vagrant box list vagrant global-status # 削除 vagrant box remove bento/centos-6.8 vagrant destroy <対象のVMid> cd .. Remove-Item -Recurse -Force .\centos-6.8

他の確認項目や試すべきことなどあれば教えてください。
よろしくお願いします。

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

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

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

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

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

guest

回答1

0

ベストアンサー

こんばんは。
SSHがうまくいかない場合ですが、Vagrantfileのあるディレクトリは、使いまわしていますでしょうか?
もし、綺麗にやりなおしたい場合ですが、vagrant destroy をした後、同じディレクトリに .vagrant/ というディレクトリがあれば、いったん削除(もしくはリネームで退避)してみてください。

あとは、Windowsということでこちらももし参考になれば。
https://qiita.com/RyutaKojima/items/81c47ad085ccb7c69a90

投稿2019/05/21 11:40

suama

総合スコア1997

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

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

teityura

2019/06/01 15:10

VagrantディレクトリはVM作成時にできた、 使いまわしてない状態になります。 参考リンクありがとうございます! こちら参考にさせていただきます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問