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

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

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

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Vagrant

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

Q&A

解決済

1回答

4194閲覧

Vagrant initの後、vagrant upをするとエラーが出て全く進めません。

Toto-Koya

総合スコア10

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Vagrant

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

0グッド

1クリップ

投稿2019/10/13 03:20

編集2019/10/20 10:36

前提・実現したいこと

VagrantとVirtialBoxで仮想環境をWindows上で作りたいと思い、インストールはしたのですが
cmdにてvagrant upを行いますがファイルのダウンロードが途中で止まり、エラーが出て進めません。
設定等に詳しい方いらっしゃいましたら、ご教示頂けますと大変有難いです。
よろしくお願いします。

PC環境は、Windows10 64bit です。

■■な機能を実装中に以下のエラーメッセージが発生しました。

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

C:\Users\about>vagrant up Binging machine default' up with 'virtualbox' provider... ==> default: Box 'precise64' could not be found. Attempting to find and install... default: Box Proyider: virtualbox default: Box Version: >= 0 ==> default: Box file was not detected as metadata. Adding it directry... ==> default: Adding box 'precise64' (v0) for provider: virtualbox default: Downlording: http://files.vagrantup.com/precise64.box default: Downlord redirected to host: hashicorp-files.hashicorp.com default: An error occurred while downloading the remote file. The error message, if any, is reproduced below. Please fix this error and try again. Failed to connect to hashicorp-files.hashicorp.com port 443: Timed out C:\Users\about>

該当のソースコード

``

-- mode: ruby --

vi: set ft=ruby :

All Vagrant configuration is done below. The "2" in Vagrant.configure

configures the configuration version (we support older styles for

backwards compatibility). Please don't change it unless you know what

you're doing.

Vagrant.configure("2") do |config|

The most common configuration options are documented and commented below.

For a complete reference, please see the online documentation at

https://docs.vagrantup.com.

Every Vagrant development environment requires a box. You can search for

boxes at https://vagrantcloud.com/search.

config.vm.box = "precise64"

The url from where the 'config.vm.box' box will be fetched if it

doesn't already exist on the user's system.

config.vm.box_url = "http://files.vagrantup.com/precise64.box"

Create a forwarded port mapping which allows access to a specific port

within the machine from a port on the host machine. In the example below,

accessing "localhost:8080" will access port 80 on the guest machine.

NOTE: This will enable public access to the opened port

config.vm.network "forwarded_port", guest: 80, host: 8080

Create a forwarded port mapping which allows access to a specific port

within the machine from a port on the host machine and only allow access

via 127.0.0.1 to disable public access

config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"

Create a private network, which allows host-only access to the machine

using a specific IP.

config.vm.network "private_network", ip: "192.168.33.10"

Create a public network, which generally matched to bridged network.

Bridged networks make the machine appear as another physical device on

your network.

config.vm.network "public_network"

Share an additional folder to the guest VM. The first argument is

the path on the host to the actual folder. The second argument is

the path on the guest to mount the folder. And the optional third

argument is a set of non-required options.

config.vm.synced_folder "../data", "/vagrant_data"

Provider-specific configuration so you can fine-tune various

backing providers for Vagrant. These expose provider-specific options.

Example for VirtualBox:

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

# Display the VirtualBox GUI when booting the machine

vb.gui = true

# Customize the amount of memory on the VM:

vb.memory = "1024"

end

View the documentation for the provider you are using for more

information on available options.

Enable provisioning with a shell script. Additional provisioners such as

Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the

documentation for more information about their specific syntax and use.

config.vm.provision "shell", inline: <<-SHELL

apt-get update

apt-get install -y apache2

SHELL

end

### 試したこと C:\Users\tae-t>vagrant init hashicorp/precise64 A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant. C:\Users\tae-t>vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Box 'hashicorp/precise64' could not be found. Attempting to find and install... default: Box Provider: virtualbox default: Box Version: >= 0 ==> default: Loading metadata for box 'hashicorp/precise64' default: URL: https://vagrantcloud.com/hashicorp/precise64 ==> default: Adding box 'hashicorp/precise64' (v1.1.0) for provider: virtualbox default: Downloading: https://vagrantcloud.com/hashicorp/boxes/precise64/versions/1.1.0/providers/virtualbox.box default: Download redirected to host: vagrantcloud-files-production.s3.amazonaws.com default: ==> default: Successfully added box 'hashicorp/precise64' (v1.1.0) for 'virtualbox'! ==> default: Importing base box 'hashicorp/precise64'... ==> default: Matching MAC address for NAT networking... ==> default: Checking if box 'hashicorp/precise64' version '1.1.0' is up to date... ==> default: Setting the name of the VM: tae-t_default_1571564319711_43280 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... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat ==> default: Forwarding ports... default: 22 (guest) => 2222 (host) (adapter 1) ==> 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", "390a3469-4996-4547-bc15-7af2c360f6c7", "--type", "headless"] Stderr: VBoxManage.exe: error: Not in a hypervisor partition (HVP=0) (VERR_NEM_NOT_AVAILABLE). VBoxManage.exe: error: AMD-V is disabled in the BIOS (or by the host OS) (VERR_SVM_DISABLED) VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole C:\Users\tae-t>vagrant ssh VM must be running to open SSH connection. Run `vagrant up` to start the virtual machine. ### 補足情報(FW/ツールのバージョンなど) ここにより詳細な情報を記載してください。

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

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

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

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

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

gouf

2019/10/13 04:44

「Vagrantの黒い画面」とは何を指しますか? 最初の操作では cmd.exe ないし PowerShell を立ち上げていますか? (= その上での操作の話ですか) 可能であれば Gyazo などを用いたスクリーンショットないし、短い時間の動画を撮影、アップロードできますか?
asm

2019/10/13 05:28

何を行った結果黒い画面が表示され、消えるのか詳細にお願いします。
Toto-Koya

2019/10/13 07:12

goufさま ご連絡ありがとうございます。 説明が悪く、申し訳ありません。cmdから入力で、vagrant up コマンドを入力すると途中にエラーが出て、文末に Timed out とプロンプトにでて 必要な要素がDLされません。そのキャプチャをこの投稿にアップしたいのですが、上手くいかずアップロードできません。すいません。 「実践 Vagrant」という書籍も買ってみながらやっているのですが、この時点で進めずにおります。何が問題なのでしょうか・・・。
Toto-Koya

2019/10/13 07:13

asmさま ご連絡ありがとうございます。 cmdで、vagrant up コマンドを入力すると途中にエラーが出て、文末に Timed out とプロンプトにでて必要な要素がDLされません。そのキャプチャをこの投稿にアップしたいのですが、上手くいかずアップロードできません。申し訳ありません。。 いったい何が問題なのでしょうか・・・。
asm

2019/10/14 05:55

boxのダウンロード中という事でしょうか? 古いvagrantというわけではなく2.2.5を使用しているんですよね? Proxyが必要な環境という訳ならば環境変数を利用する事になりますが・・・心当たりはありますでしょうか? Vagrantfileは提示できますか?
Toto-Koya

2019/10/14 09:27

asmさま ご連絡ありがとうございます。 version2.2.5を使用しています。Vagrantファイルを提示というのは、このテンプレートに張り付ける?という事でしょうか?このサイトの使い方があまり分かっておらず、申し訳ないのですがご指示いただければ出来ると思います。
Toto-Koya

2019/10/15 11:47

goufさま ご連絡ありがとうございます。 そんな古い更新になっているのでしょうか?ダウンロードしたのはつい数日前だったのですが・・。 取り合えず、新規の更新を行ってみます。ありがとうございました。
guest

回答1

0

ベストアンサー

同様の質問がすでにありました 追記: 書籍というキーワードから同じことやってるのかと思ったが微妙に違うので削除

簡単に言うと、Vagrantfileに書かれているURLが古いです。

おそらくvagrant init時に渡すオプションが古く、今となっては使えないものとなっています。

  1. Vagrantfileを消し
  2. vagrant init hashicorp/precise64 を実行しVagrantfileを生成
  3. vagrant up

にて、解消すると思います。

投稿2019/10/14 15:18

編集2019/10/19 23:41
asm

総合スコア15147

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

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

Toto-Koya

2019/10/15 11:49

asmさま ご回答ありがとうございます。 上手くいくことを願いつつ、 ひとまず、書き換えてみます。
Toto-Koya

2019/10/15 12:20

asmさま やってはみたのですが、vagrantfileは読み込めませんでした。 やはりcmdが、管理者モードですが認識していないメッセージが出てしまいます。上手く行かないです・・。折角アドバイス頂いたのですが、すいません。
asm

2019/10/15 14:01

そうですか これ以上は、Vagrantfile全文を把握できないと回答しようがないです。 Vagrantfile内のテキストを質問本文に貼り付けるか、gistやpastebinに投稿しリンクを貼っていただければ検証してみます。
Toto-Koya

2019/10/19 00:24

asmさま ご連絡ありがとうございます。Vagrantの中のテキストなのですが、どのディレクトリにあるのか見当がつきません。すいません。 Vagrant ⇒ embedded ⇒ ここから何を開いていけばtextファイルに たどり着けるのでしょうか。全くの初心者でしてご指示いただけましたら 有難いです。よろしくお願いします。
asm

2019/10/19 01:06

vagrant initやvagrant upを実行したディレクトリ内にあります。 提示されているログですと、C:\Users\about\ディレクトリですね。 vagrantはVagrant initを実行したディレクトリをVagrant projectディレクトリとみなし いくらかの設定ファイルを保存したり Vagrantfile次第ではありますが当該ディレクトリの中身をvagrant up時にアップロードしたりするため 新しくディレクトリを作成した方がよいように思います。
Toto-Koya

2019/10/19 07:00

asmさま このaboutは投稿の際、仮のユーザー名としてpassに入れたものです。 という事は、適当なディレクトリを作成してパスを通して、再度init, upを 行うという事で良いのでしょうか。
asm

2019/10/19 07:06

vagrant initからやり直すならば vagrant init hashicorp/precise64 で 解決する気がしますね。
Toto-Koya

2019/10/19 07:44

cmdにてこちらのコマンドを実行したら下記のようなメッセージが出ました。ディレクトトリの中に存在する。それを取り除けというメッセージが出てきました。一旦。ファイルを完全除去すれば良いのでしょうか? Vagrantfile already exists in this directory. Remove it before running vagrant init.
asm

2019/10/19 07:49

> 適当なディレクトリを作成してパスを通して、再度init, upを 適当なディレクトリを作成して cd /d ディレクトリへのパス vagrant init hashicorp/precise64 vagrant up こうですね
Toto-Koya

2019/10/19 08:15

やってみたのですが、パスが通りません。どうもcmdがいつも上手く行かないんです。「ファイル名、ディレクトリ名、またはボリュームラベルの構文が間違っています」と出てしまいます。名前類は間違いはないですが、ボリュームラベルの構文とは何なのでしょうか?
asm

2019/10/19 10:30

C:\directory\to\file というパスがあるとしてC:の部分をボリュームラベルと言います。 なぜ、上手くいかないかはあなたが出してる情報だけでは判断できかねます。
Toto-Koya

2019/10/19 10:54

asmさま ああ、そういう意味なんですか・・。初めて知りました。すいません。 今しがた、Vagrantfileのtextを更新しました。診ていただけますでしょうか。 よろしくお願いします。
asm

2019/10/19 23:43

回答を更新しました。 config.vm.box_url = "http://files.vagrantup.com/precise64.box" を消して config.vm.box = "hashicorp/precise64" を追加でもいい筈ですが、まぁVagrantfile生成しなおした方が楽です
Toto-Koya

2019/10/20 09:44

asmさま 大変ありがとうございます。今しがた、 ご指示の通りやってみましたら、VietualBoxのツールのところに一つユーザー名のものが出来ました。これで、繋がったのでしょうか?
Toto-Koya

2019/10/20 10:40

その後、vagrant sshコマンドを行ったのですが、専門書とかなり違う感じなのですがこれで良いのでしょうか。また、vagrant upのコマンド結果の広範囲エラーが3か所出ているのは何か上手く行っていないのでしょうか。(大きな太字は投稿編集時に失敗したものです)
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問