LoginSignup
0
0

More than 1 year has passed since last update.

Vagrant で VirtualBox 用 Rocky Linux 8 が起動しなくなった

Last updated at Posted at 2022-12-21

WSL2 で Vagrant を使っていますが、VirtualBox 用 Rocky Linux 8 をアップデートしたら、起動できなくなりました。

$ vagrant up
Bringing machine 'node-1' up with 'virtualbox' provider...
==> node-1: Importing base box 'rockylinux/8'...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["import", "-n", "\\\\?\\c:\\Users\\tom-sato\\.vagrant.d\\boxes\\rockylinux-VAGRANTSLASH-8\\7.0.0\\virtualbox\\box.ovf"]

Stderr: 0%...VBOX_E_OBJECT_NOT_FOUND
VBoxManage.exe: error: Appliance read failed
VBoxManage.exe: error: Failed to open OVF file '\\?\c:\Users\tom-sato\.vagrant.d\boxes\rockylinux-VAGRANTSLASH-8\7.0.0\virtualbox\box.ovf' (VERR_FILE_NOT_FOUND)
VBoxManage.exe: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component ApplianceWrap, interface IAppliance
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleImportAppliance(struct HandlerArg *)" at line 510 of file VBoxManageAppliance.cpp

Rocky Linux のフォーラムに同じ問題が報告されていて、Vagrant Cloud で配布のボックス rockylinux/8 v7.0.0 に不備があるようです。

解決策は Vagrantfile でバージョンを指定して古いボックス v5.0.0 を使うか、

Vagrantfile
Vagrant.configure("2") do |config|
  config.vm.box = "rockylinux/8"
  config.vm.box_version = "5.0.0"
end

Rocky Linux で配布の最新のイメージを使ってボックスを追加します。

それには、まず、以下の内容でボックスのメタデータを作成し、

box-metadata.json
{
  "name" : "rockylinux/8",
  "description" : "Rocky Linux 8 7.0.0 Bugfix",
  "versions" : [
    {
      "version" : "7.0.1-20221213.0",
      "providers" : [
        {
          "name" : "virtualbox",
          "url" : "http://dl.rockylinux.org/pub/rocky/8/images/x86_64/Rocky-8-Vagrant-Vbox-8.7-20221213.0.x86_64.box"
        }
      ]
    }
  ]
}

そのメタデータを使ってボックスを追加します。

$ vagrant box add box-metadata.json
==> box: Loading metadata for box 'box-metadata.json'
    box: URL: file:///home/tom-sato/vagrant/box-metadata.json
==> box: Adding box 'rockylinux/8' (v7.0.1-20221213.0) for provider: virtualbox
    box: Downloading: http://dl.rockylinux.org/pub/rocky/8/images/x86_64/Rocky-8-Vagrant-Vbox-8.7-20221213.0.x86_64.box
==> box: Successfully added box 'rockylinux/8' (v7.0.1-20221213.0) for 'virtualbox'!

なお、最新のイメージでは UEFI が有効になっているので、Vagrantfile で VirtualBox の設定が必要です。

Vagrantfile
Vagrant.configure("2") do |config|
  config.vm.box = "rockylinux/8"
  config.vm.box_version = "7.0.0"
  config.vm.provider "virtualbox" do |vb|
    vb.customize ["modifyvm", :id, "--firmware", "efi"]
  end
end

これで、最新のバージョンで Rocky Linux 8 を起動できます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0