Vagrant を使用して VirtualBox VM を作成できないのはなぜですか?

Vagrant を使用して VirtualBox VM を作成できないのはなぜですか?

最近、「DevOps for the Desparate」という本を購入したのですが、Oracle Virtual Box で VM を作成するための第 1 章の演習を終えることができません。

第 1 章の初期セットアップ段階では、以下を作成します。

  1. Hyper-V Ubuntu VM
  2. Ubuntu VMでは、Vagrantを使用してOracle VirtualBoxに別のVMを作成しています。

私は何度も練習をしましたが、VMを作成するコマンドにたどり着いてからはあまりうまくいきませんでした。

vagrant up

作成に失敗しました。

以下のOSを試しました

  1. Ubuntu 18.04 LTS
  2. Ubuntu 20.04 LTS
  3. Ubuntu 22.04 LTS

画像

これは手順にはありませんでしたが、Hyper-V イメージを作成するときに、実行時にスペースが不足し続けるため、Hyper-V 設定でハード ドライブのサイズを 100 GB に変更しました。

$vagrant up

Hyper-V でハード ドライブのサイズを変更した後、Linux パーティションのサイズも変更する必要があることに気付き、次のようにしました。

growpart

画像

他のすべての手順は正常に完了しました。例:

ページ 14 Set-VMProcessor -VMName 'Ubuntu 20.04 LTS' -ExposeVirtualizationExtensions $true

ページ xxi $git clone https://github.com/bradleyd/devops_for_the_desperate/

ページ4 Vagrantをインストール

ページ 7 Ansible をインストールしました

9 ページ目に進むと、次のエラーが発生します。

$ vagrant up

これまでさまざまなエラーが発生していましたが、今回は次のエラーが発生しています。

$ vagrant up

Bringing machine 'default' up with 'virtualbox' provider...

==> default: Importing base box 'ubuntu/focal64'...

==> default: Matching MAC address for NAT networking...

==> default: Checking if box 'ubuntu/focal64' version '20230719.0.0' is up to date...

==> default: Setting the name of the VM: dftd

==> 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", "ipconfig", "vboxnet2", "--ip", "172.28.128.1", "--netmask", "255.255.255.0"]

Stderr: VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not     available)

VBoxManage: error: Context: "EnableStaticIPConfig(Bstr(pszIp).raw(), Bstr(pszNetmask).raw())" at line 242 of file VBoxManageHostonly.cpp**

前もって感謝します。

関連情報