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

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

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

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

Q&A

解決済

1回答

861閲覧

vagrant upができず、エラーが発生します。

Toshihisa

総合スコア3

Vagrant

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

0グッド

0クリップ

投稿2022/10/11 03:38

前提

「ビジネスサイトを作って学ぶ WordPressの教科書 Ver.5.x対応版」
https://wpbook-pacificmall.work/correction/
初版第3刷の19頁で、記述通りに「$ vagrant up」コマンドを実行すると、以下のエラーが出てしまいます(私はMacbookProを使用しています)。

実現したいこと

Vagrantの起動

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

Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'prime-strategy/kusanagi-wp5'... ==> default: Matching MAC address for NAT networking... ==> default: Checking if box 'prime-strategy/kusanagi-wp5' version '1.0' is up to date... ==> default: Setting the name of the VM: pacificmall_default_1664842834838_77882 ==> default: Clearing any previously set network interfaces... The IP address configured for the host-only network is not within the allowed ranges. Please update the address used to be within the allowed ranges and run the command again. Address: 192.168.33.10 Ranges: 192.168.56.0/21 Valid ranges can be modified in the /etc/vbox/networks.conf file. For more information including valid format see: https://www.virtualbox.org/manual/ch06.html#network_hostonly

試したこと

Googleで検索して、以下のサイトに辿り着きました。
https://ja.stackoverflow.com/questions/83555/vagrant%E3%81%A8virtualbox%E3%81%A7%E3%81%AE%E4%BB%AE%E6%83%B3%E3%83%9E%E3%82%B7%E3%83%B3%E3%81%AE%E4%BD%9C%E6%88%90%E6%99%82%E3%81%AB-poweroff-virtualbox-%E3%81%A8%E8%A1%A8%E7%A4%BA%E3%81%95%E3%82%8C%E3%81%A6%E3%81%97%E3%81%BE%E3%81%86

この質問に対する回答の通りに、Vagrantfileの

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

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

に変更し、再び「$ vagrant up」コマンドを実行すると、以下のエラーが出ます。

Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'prime-strategy/kusanagi-wp5'... ==> default: Matching MAC address for NAT networking... ==> default: Checking if box 'prime-strategy/kusanagi-wp5' version '1.0' is up to date... ==> default: Setting the name of the VM: pacificmall_default_1664843061986_43319 ==> default: Clearing any previously set network interfaces... There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below. Command: ["hostonlyif", "create"] Stderr: 0%... Progress state: NS_ERROR_FAILURE VBoxManage: error: Failed to create the host-only adapter VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg *)" at line 95 of file VBoxManageHostonly.cpp

どうすればVagrantを起動できるのでしょうか?

補足情報(FW/ツールのバージョンなど)

ここにより詳細な情報を記載してください。

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

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

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

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

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

kazto

2022/10/11 04:23

Vagrantfileの内容を提示してください。
Toshihisa

2022/10/11 04:46

Kazto様、ありがとうございます。以下にVagrantfileの内容を提示します。 # -*- 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 = "prime-strategy/kusanagi-wp5" config.vm.box_version = "1.0" # Disable automatic box update checking. If you disable this, then # boxes will only be checked for updates when the user runs # `vagrant box outdated`. This is not recommended. # config.vm.box_check_update = false # 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.56.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 # Ansible, Chef, Docker, Puppet and Salt 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
guest

回答1

0

ベストアンサー

まず、ホストの環境はなんでしょうか?
Mac、特にM1では問題が多いように見受けられます。

エラー文からは、

VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory

の一文が原因であるように読めます。

vboxnetctl No such file or directory」で検索してみました。

原因はいくつかあるようです。

今回のケースがどれに当たるのか定かでないですが、いろんな原因で起こりうるようなので、ひとつずつ潰していくしかなさそうです。

投稿2022/10/11 05:30

kazto

総合スコア7196

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

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

kazto

2022/10/11 07:29

> intel Macです。 承知しました。いずれにせよ、私の申し上げられることは変わらず、上記を試していただくこと、になります。
Toshihisa

2022/10/11 08:52

ありがとうございます。
Toshihisa

2022/10/13 09:56

解決できました。 ・セキュリティとプライバシーの設定で許可する必要がある https://it-jog.com/khow/vag/vagnotup に書かれている内容を実行後、Vagrantfileの config.vm.network "private_network", ip: "192.168.33.10" を config.vm.network "private_network", ip: "192.168.56.10" に変更後、再び「$ vagrant up」コマンドを実行しましたら、無事、vagrant upできました!! 本当にありがとうございました!!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.41%

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

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

質問する

関連した質問