Vagrant起動時に発生するumount: /mnt: not mounted.エラーの対処方法

Vagrant起動時に発生するumount: /mnt: not mounted.エラーの対処方法
2023年02月08日2023年10月10日

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

起動ログ

vagrant upコマンドを実行した時のログです。

C:\vagrant\centos74>vagrant init
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

C:\vagrant\centos74>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'bento/centos-7.4'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bento/centos-7.4' version '201803.24.0' is up to date...
==> default: Setting the name of the VM: centos74_default_1675779649288_11810
==> 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: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    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] GuestAdditions versions on your host (7.0.6) and guest (5.2.6) do not match.
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.jaist.ac.jp
 * extras: ftp.jaist.ac.jp
 * updates: ftp.jaist.ac.jp
Resolving Dependencies
--> Running transaction check
---> Package centos-release.x86_64 0:7-4.1708.el7.centos will be updated
---> Package centos-release.x86_64 0:7-9.2009.1.el7.centos will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch        Version                     Repository    Size
================================================================================
Updating:
 centos-release      x86_64      7-9.2009.1.el7.centos       updates       27 k

Transaction Summary
================================================================================
Upgrade  1 Package

Total download size: 27 k
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : centos-release-7-9.2009.1.el7.centos.x86_64                  1/2
  Cleanup    : centos-release-7-4.1708.el7.centos.x86_64                    2/2
  Verifying  : centos-release-7-9.2009.1.el7.centos.x86_64                  1/2
  Verifying  : centos-release-7-4.1708.el7.centos.x86_64                    2/2

Updated:
  centos-release.x86_64 0:7-9.2009.1.el7.centos

Complete!
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.jaist.ac.jp
 * extras: ftp.jaist.ac.jp
 * updates: ftp.jaist.ac.jp
No package kernel-devel-3.10.0-693.21.1.el7.x86_64 available.
Error: Nothing to do
Unmounting Virtualbox Guest Additions ISO from: /mnt
umount: /mnt: not mounted
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 5.2.6
    default: VirtualBox Version: 7.0
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:



Stderr from the command:

umount: /mnt: not mounted

マウントエラーが発生

起動時のログを確認すると最後にマウントできないエラーが出力されました。

umount: /mnt: not mounted

エラーの原因

新規でvagrant環境を構築しようと最初の立ち上げ時に発生しました。

どうやらVM内のモジュール類が古いのが原因のようです。最新にすることでエラーが解消されるようです。

解決方法:VM内のモジュールを最新にする

Vagrantにログイン

vagrant sshコマンドを実行してvagrantにログインします。

$ vagrant ssh
Last login: Tue Feb  7 14:22:51 2023 from 10.0.2.2
[vagrant@localhost ~]$

モジュールを最新にアップデートする

yum -y updateコマンドを実行してモジュールを最新にします。

[vagrant@localhost ~]$ sudo yum -y update
~ 中略 ~
Dependencies Resolved

========================================================================================================================
 Package                                Arch            Version                                  Repository        Size
========================================================================================================================
Installing:
 grub2                                  x86_64          1:2.02-0.87.0.2.el7.centos.11            updates           34 k
     replacing  grub2.x86_64 1:2.02-0.65.el7.centos.2
 grub2-tools                            x86_64          1:2.02-0.87.0.2.el7.centos.11            updates          1.8 M
     replacing  grub2-tools.x86_64 1:2.02-0.65.el7.centos.2
~ 中略 ~
  wget.x86_64 0:1.14-18.el7_6.1                               wpa_supplicant.x86_64 1:2.6-12.el7_9.2
  xfsprogs.x86_64 0:4.5.0-22.el7                              xz.x86_64 0:5.2.2-2.el7_9
  xz-libs.x86_64 0:5.2.2-2.el7_9                              yum.noarch 0:3.4.3-168.el7.centos
  yum-plugin-fastestmirror.noarch 0:1.1.31-54.el7_8           zlib.x86_64 0:1.2.7-20.el7_9

Replaced:
  grub2.x86_64 1:2.02-0.65.el7.centos.2                   grub2-tools.x86_64 1:2.02-0.65.el7.centos.2

Complete!
[vagrant@localhost ~]$

アップデートに5分程度かかります。

Vagrantからログアウト

vagrantから一旦ログアウトします。

[vagrant@localhost ~]$ exit

 Vagrantを再読み込み

vagrant reloadコマンドを実行してモジュールを最新にします。

$ vagrant reload
==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'bento/centos-7.4' version '201803.24.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...
~ 中略 ~
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: Mounting shared folders...
    default: /vagrant => C:/vagrant/centos74
    default: /vagrant_data => C:/source
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.

$

先ほどのエラーは解消され無事立ち上げることができました。

最後に

この記事では「Vagrant起動時に発生するumount: /mnt: not mounted.エラーの対処方法」について解説しました。

 

コメント

コメントを残す

お名前(任意)
コメント:新規