1
0

More than 1 year has passed since last update.

vagrant upできない時の対処方法

Last updated at Posted at 2022-01-12

 Vagrantを使いubuntuの仮想マシンを起動しようとしたところ、vagrant upのコマンドからエラーで進めなくなってしまった。
 ちなみにOSはWindows10 Home、Vagrantのバージョンは2.2.19、VirtualBoxのバージョンは6.1.30、Windows PowerShellを用いて操作。
 解消まで何日もかかったため、解消策のひとつとして書き留めておきたいと思う。

エラーコード

PS C:\Users\owner\vagrant> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/bionic64' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/bionic64'
    default: URL: https://vagrantcloud.com/ubuntu/bionic64
==> default: Adding box 'ubuntu/bionic64' (v20220104.0.0) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/ubuntu/boxes/bionic64/versions/20220104.0.0/providers/virtualbox.box
==> default: Box download is resuming from prior download progress
Download redirected to host: cloud-images.ubuntu.com
    default:
==> default: Successfully added box 'ubuntu/bionic64' (v20220104.0.0) for 'virtualbox'!
==> default: Importing base box 'ubuntu/bionic64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/bionic64' version '20220104.0.0' is up to date...
==> default: Setting the name of the VM: vagrant_default_1641474145738_8798
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 80 (guest) => 8080 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

試してみたこと

以下のサイトを参考に次の3つを行った。
 ・タイムアウト設定変更
 ・ネットワークアダプタの設定変更
 ・SSH接続用鍵ファイルの初期化
 (参照URL)
 https://mimirswell.ggnet.co.jp/blog-261

しかし、改善されず。
 ・vagrant upに--provisionオプションを付ける
 ・PCからVagrantをアンインストールし、再インストール

これでも改善されず。

解決方法

hyper-vの設定をオフにし 'vagrant reload' を行ったところ解消することができた。
(参照URL)
 https://qiita.com/kumokumo/items/78865c0aaed100e79feb
 https://qiita.com/masoo/items/b73dadb0e99f9be528fe

1
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
1
0