T-CREATOR

【解決方法】Vagrantを起動した際に発生するumount: /mnt: not mounted.の対処について

【解決方法】Vagrantを起動した際に発生するumount: /mnt: not mounted.の対処について
この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

Vagrantを起動した際に発生するumount: /mnt: not mounted.の解決手順をメモしました。

環境

  • Vagrant 2.2.16
  • VirtualBox 6.1.22 r144080

発生したエラー

実行ログ

vagrant upコマンドを実行したログになります。

terminal$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'centos/8' version '2011.0' is up to date...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> 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
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
[default] No Virtualbox Guest Additions installation found.
Last metadata expiration check: 0:00:02 ago on Mon 31 May 2021 02:20:24 AM UTC.
Package centos-linux-release-8.3-1.2011.el8.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
Last metadata expiration check: 0:00:03 ago on Mon 31 May 2021 02:20:24 AM UTC.
No match for argument: kernel-devel-4.18.0-240.1.1.el8_3.x86_64
Error: Unable to find a match: kernel-devel-4.18.0-240.1.1.el8_3.x86_64
Unmounting Virtualbox Guest Additions ISO from: /mnt
umount: /mnt: not mounted.
==> default: Checking for guest additions in VM...
    default: No guest additions were detected on the base box for this VM! Guest
    default: additions are required for forwarded ports, shared folders, host only
    default: networking, and more. If SSH fails on this machine, please install
    default: the guest additions and repackage the box to continue.
    default: 
    default: This is not an error message; everything may continue to work properly,
    default: in which case you may ignore this message.
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

umount /mnt

Stdout from the command:

マウントできないエラー

エラーメッセージを確認すると
/mntがマウントできないというエラーが発生しているようです。

bashumount: /mnt: not mounted.

エラーの原因

エラーの原因はボックスを持ってきた後に
VM内のモジュールの最新化が行われていなかったことによるものでした。

VM内のモジュールを最新にして解決

一度VMにログインしモジュールを最新にすることで解決できました。

ゲストOSへログイン

vagrant sshでゲストOSへログインします。

terminal|ホストOS$ vagrant ssh

モジュールのアップデート

yum updateコマンドでモジュールをアップでします。

terminal|ゲストOS$ sudo yum update -y
Last metadata expiration check: 0:01:59 ago on Mon 31 May 2021 03:26:52 AM UTC.
Dependencies resolved.
=====================================================================================================
 Package                   Arch     Version                                        Repository   Size
=====================================================================================================
Installing:
// 中略
Installed:
  grub2-tools-efi-1:2.02-90.el8_3.1.x86_64        kernel-4.18.0-240.22.1.el8_3.x86_64               
  kernel-core-4.18.0-240.22.1.el8_3.x86_64        kernel-modules-4.18.0-240.22.1.el8_3.x86_64       

Complete!

ゲストOSからログアウト

ゲストOSからログアウトします。

shell$ exit

Vagrantを再リロード

vagrant reloadコマンドでvagrantをリロードします。

terminal|ホストOS$ vagrant reload
==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'centos/8' version '2011.0' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> 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
==> default: Machine booted and ready!
[default] No Virtualbox Guest Additions installation found.
Last metadata expiration check: 0:07:17 ago on Mon 31 May 2021 03:26:52 AM UTC.
Package bzip2-1.0.6-26.el8.x86_64 is already installed.
Dependencies resolved.
// 中略
Redirecting to /bin/systemctl start vboxadd.service
Redirecting to /bin/systemctl start vboxadd-service.service
Unmounting Virtualbox Guest Additions ISO from: /mnt
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Rsyncing folder: /Users/XXXX/workspace/app/ => /vagrant

無事起動することができました。

記事Article

もっと見る