0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Windows11 24H2でvagrant upでエラー時の対応メモ

Last updated at Posted at 2025-02-07

はじめに

環境

  • Windows11 Home 24H2
  • VirtualBox 7.1.6 r167084(Qt6.5.3)
  • Vagrant 2.4.3
  • Almalinux8.9(ゲストOS)

この記事の目的

Windows11を24H2にupdateした後、vagrant upしたらエラーでゲストOSが起動できなくなった。
ネット検索していろいろやったら直ったのでメモとして記録。
Windows11 updateが原因かどうかは不明。

経緯

vagrant upでエラー

RedHat8系Linuxに関して確認したいことがあったので久しぶりにVM起動。
よくわからないエラーになった。

VirtulBoxバージョンアップ

VirtulBoxの最新バージョンがあったので6.1.xから7系にバージョンアップ。
Download VirtualBox

Vagrantバージョンup

VirtulBoxの最新化に合わせ、Vagrantもバージョンアップ
Install Vagrant
Windows再起動が必要。

エラー内容

VM起動中になんらかのシステムエラー

なんらかのエラーってなんやねん。でも悲しいかなわからない。
エラーメッセージは“The guest machine entered an invalid state”とありました。
stateはgurumeditation。「瞑想中」らしい。

VirtualBox上のステータス

「瞑想中」と表示されている画面
スクリーンショット 2025-02-07 220452.jpg

とりあえずやってみたこと

バージョンアップ

上記経緯を参照。VirtualBoxとVagrantを最新バージョンにしたがエラー解消せず。

Vagrant環境再作成

これで直るケースもあるので真っ先に実施。状況変わらず。

> vagrant destroy
> vagrant up

解決策

Hyper-Vを無効化

以前、VirtualBoxとHyper-Vがバッティングしてうまく動作しなかったことを思い出し、Hyper-Vを無効化してみたらビンゴ。
(参考URL)
VirtualBox E_FAIL (0x80004005)エラーを簡単に修復する方法3選
上記サイトの「方法1:CMDを使ってHyper-Vを無効にする」を試した。
管理者権限でコマンドプロンプトを起動して以下コマンドを実行。

> bcdedit /set hypervisorlaunchtype off

Windows再起動

コマンドプロンプトでHyper-Vを無効化した後はWindows再起動が必要。めんど。

vagrant up

vagrant upでVMが起動することを確認。
無事システム起動することができた。

> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'almalinux/8'...
(略)
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: C:/usr/local/vm/almalinux8.9 => /vagrant
PS C:\usr\local\vm\almalinux8.9>
PS C:\usr\local\vm\almalinux8.9> vagrant ssh
[vagrant@vbox ~]$ 

だがしかし

Hyper-Vを無効化すると

WSL2が使えないではないか(がーん)

WSL2 は、現在のマシン構成ではサポートされていません。

Hyper-Vを有効化

WSL2を使うときはHyper-Vを有効化する必要がある。
以下のコマンドを管理者権限のコマンドプロンプトで実行し、Windows再起動。めんど。

> bcdedit /set hypervisorlaunchtype on

おわりに

現状はvagrant(VirtualBox)とWSL2が共存できないという悲しい状況ですが、そのうちWindows updateで共存できるようになることを期待する。(前はできていた)

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?