web-dev-qa-db-ja.com

Vagrant error:Linuxゲストにフォルダをマウントできませんでした

私はVagrant共有フォルダにいくつか問題があります、私の基本システムはUbuntu 13.10デスクトップです。

なぜこのエラーが正しく設定されていないのかを理解できません。 NFSの問題ですか、それともVirtualbox Guest Additionsですか?私はいろいろな箱を試してみましたが、同じ問題です。

Failed to mount folders in Linux guest. This is usually because
    the "vboxsf" file system is not available. Please verify that
    the guest additions are properly installed in the guest and
    can work properly. The command attempted was:

    mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` /vagrant /vagrant
    mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` /vagrant /vagrant

これがvagrant upの後の完全なプロセスです。

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'u131032'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: vagrant_default_1396020504136_46442
==> 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 => 2222 (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
    default: Error: Connection timeout. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
    default: Error: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
GuestAdditions versions on your Host (4.3.10) and guest (4.2.16) do not match.
 * Stopping VirtualBox Additions
   ...done.
Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
  dkms libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libfontenc1
  libgl1-mesa-dri libglapi-mesa libice6 libllvm3.3 libpciaccess0 libpixman-1-0
  libsm6 libtxc-dxtn-s2tc0 libxaw7 libxcomposite1 libxdamage1 libxfixes3
  libxfont1 libxkbfile1 libxmu6 libxpm4 libxrandr2 libxrender1 libxt6
  x11-common x11-xkb-utils xfonts-base xfonts-encodings xfonts-utils
  xserver-common xserver-xorg-core
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  virtualbox-guest-dkms* virtualbox-guest-utils* virtualbox-guest-x11*
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
After this operation, 11.1 MB disk space will be freed.
(Reading database ... 65615 files and directories currently installed.)
Removing virtualbox-guest-dkms ...

-------- Uninstall Beginning --------
Module:  virtualbox-guest
Version: 4.2.16
Kernel:  3.11.0-18-generic (i686)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

vboxguest.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.11.0-18-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


vboxsf.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.11.0-18-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


vboxvideo.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.11.0-18-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod....

DKMS: uninstall completed.

------------------------------
Deleting module version: 4.2.16
completely from the DKMS tree.
------------------------------
Done.
Removing virtualbox-guest-x11 ...
Purging configuration files for virtualbox-guest-x11 ...
Removing virtualbox-guest-utils ...
Purging configuration files for virtualbox-guest-utils ...
Processing triggers for ureadahead ...
Processing triggers for man-db ...
Reading package lists...
Building dependency tree...
Reading state information...
dkms is already the newest version.
dkms set to manually installed.
linux-headers-3.11.0-18-generic is already the newest version.
linux-headers-3.11.0-18-generic set to manually installed.
The following packages were automatically installed and are no longer required:
  libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libfontenc1 libgl1-mesa-dri
  libglapi-mesa libice6 libllvm3.3 libpciaccess0 libpixman-1-0 libsm6
  libtxc-dxtn-s2tc0 libxaw7 libxcomposite1 libxdamage1 libxfixes3 libxfont1
  libxkbfile1 libxmu6 libxpm4 libxrandr2 libxrender1 libxt6 x11-common
  x11-xkb-utils xfonts-base xfonts-encodings xfonts-utils xserver-common
  xserver-xorg-core
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Copy iso file /usr/share/virtualbox/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
mount: block device /tmp/VBoxGuestAdditions.iso is write-protected, mounting read-only
Installing Virtualbox Guest Additions 4.3.10 - guest version is 4.2.16
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.10 Guest Additions for Linux............
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox DKMS kernel modules ...done.
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules ...done.
Doing non-kernel setup of the Guest Additions ...done.
Starting the VirtualBox Guest Additions ...done.
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
An error occurred during installation of VirtualBox Guest Additions 4.3.10. Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Exporting NFS shared folders...
==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
nfsd running
Sudo: /usr/bin/exportfs: command not found
==> default: Mounting NFS shared folders...
==> default: Mounting shared folders...
    default: /vagrant => /home/me/Documents/Work/project/vagrant
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` /vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` /vagrant /vagrant

私のVagrantfile設定は:

# -*- mode: Ruby -*-
# vi: set ft=Ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

personalization = File.expand_path("../Personalization", __FILE__)
load personalization

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = $base_box
  config.vm.box_url = $base_box_url

  config.vm.hostname = $vhost + ".dev"

  config.hostsupdater.aliases = ["api." + $vhost + ".dev", "mysql." + $vhost + ".dev"]
  config.hostsupdater.remove_on_suspend = true

  # set auto_update to ture to check the correct 
  # additions version when booting the machine
  config.vbguest.auto_update = true
  config.vbguest.auto_reboot = true

  config.vm.network :private_network, ip: $ip

  config.vm.synced_folder "../", "/srv/www/vhosts/" + $vhost + ".dev", type: "nfs"

  config.vm.provider :virtualbox do |v|
    v.customize ["modifyvm", :id, "--memory", 2048]
    v.customize ["modifyvm", :id, "--cpus", "1"]
    v.customize ["modifyvm", :id, "--cpuexecutioncap", "100"]
    v.customize ["modifyvm", :id, "--ioapic", "off"]
    v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  end

  config.vm.provision "Shell" do |s|
    s.path = "vagrant-bootstrap.sh"
    s.args = $vhost + " " + $mysql_password + " " + $application_database
  end
end

パーソナライズファイルは次のとおりです。

# Name of the vhost to create
$vhost = "project"

# Use the Ubunut 32bit or 64bit
$base_box_url = "http://cloud-images.ubuntu.com/vagrant/saucy/current/saucy-server-cloudimg-i386-vagrant-disk1.box"

# VM IP
$ip = "192.168.7.7"

# Base box name
$base_box = "u131032"

# MySQL
$mysql_password = "admin"
$application_database = "project"

Vagrantでは、以下のプラグインが有効になっています。

$ vagrant plugin list
vagrant-hostsupdater (0.0.11)
vagrant-login (1.0.1, system)
vagrant-share (1.0.1, system)
vagrant-vbguest (0.10.0)
273
Ek Kosmos

プラグインvagrant-vbguest GitHubRubyGems 私の問題を解決しました:

$ vagrant plugin install vagrant-vbguest

出力:

$ vagrant reload
==> default: Attempting graceful shutdown of VM...
...
==> default: Machine booted and ready!
GuestAdditions 4.3.12 running --- OK.
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Exporting NFS shared folders...
==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
==> default: Mounting NFS shared folders...
==> default: VM already provisioned. Run `vagrant provision` or use `--provision` to force it

VirtualBoxの最新バージョンを実行していることを確認してください。

354
karlingen

私はこの問題がここで対処されているのを見つけました vagrantの問題 それをする2つの方法:

  1. ゲストでこれを実行します(つまり、vagrant sshを介してvboxにSSHでログインした後)

    Sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
    

    その後、vagrant reloadを実行してフォルダを正しくマウントします。

  2. @klangが指摘したように、あなたのMac上のVBoxGuestAdditions.isoファイルを更新する:

    wget https://www.virtualbox.org/download/testcase/VBoxGuestAdditions_4.3.11-93070.iso‌​
    Sudo cp VBoxGuestAdditions_4.3.11-93070.iso /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso
    

アップデート(16年5月16日)

Isoは利用できなくなったので、4.3.12の( http://dlc.Sun.com.edgesuite.net/virtualbox/4.3.12/VBoxGuestAdditions_4.3.12を使用できます。 iso

注意:os X用のバイナリvbox 4.3.3は現時点では利用できません

231
kenzie

私はこのページにたどり着き、同じエラーメッセージを探しました。私にとっては、原因が異なっていました。新しいカーネルをインストールしたシステムでyum updateを実行しました。ゲストがどこで期限切れになって追加されたため、ロードできませんでした。

私はそれらを再構築しました

Sudo /etc/init.d/vboxadd setup 

そしてvagrant reload後に私のゲストは再び稼働していました。

私がしたのと同じ方法で他の誰かがここに来た場合に備えて、ここに追加するだけです。

編集(KCDのコメントによる):
次のようなエラーが表示される可能性があります。

現在実行中のカーネルのヘッ​​ダが見つかりませんでした

これはkernel-develをインストールすることで解決できます(yum install kernel-devel

48
Blizz

ステップバイステップの修正:

Vbguestプラグインがない場合は、インストールしてください。

$ vagrant plugin install vagrant-vbguest

Vagrantを実行する

エラーを表示しています。

$ vagrant up

VMにログイン

$ vagrant ssh

修正してください!

ゲスト内(VMログ).

$ Sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions

ホストに戻り、Vagrantをリロードします。

$ vagrant reload
28
Dadaso Zanzane

2016年2月に更新

これは私が独立して解くのに何時間もかかりました。はい、最新のVagrantとVirtual Boxをインストールしてもこの問題は解決しません。

△  vagrant -v
Vagrant 1.8.1
△  vboxmanage -v
5.0.14r105127

私にとっての症状は、次のようなメッセージでした。

Checking for guest additions in VM... The guest additions on this VM do not match the installed version of VirtualBox!

続いてNFSドライブのマウントに失敗しました。

1)。 vagrant-vbguestプラグインをインストールしてください。

使用しているVagrantのバージョンに応じて、以下のいずれかのコマンドを発行してください。

# For vagrant < 1.1.5
$ vagrant gem install vagrant-vbguest

# For vagrant 1.1.5+
$ vagrant plugin install vagrant-vbguest

次にvagrant haltを実行し、続いてvagrant upを実行します - まだ問題がある可能性があります。

2)。ゲストにSSH接続して、正しいバージョンのGuest Additions(ここでは5.0.14)へのソフトリンクを設定します。

$ vagrant ssh

$ Sudo ln -s /opt/VBoxGuestAdditions-5.0.14/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
$ exit

$ vagrant reload

あなたはすべて良いはずです。デフォルトでは、ゲストにマウントされているドライブは/vagrantにあります。

最後のコメント:

それでもNFSドライブのマウントに関連した問題があるのであれば、これが私のために働いた回避策です。私は次のような設定のvagrantfileを持っていました:

単にmount type 情報を削除し、 mount_options 設定をスリムにするだけです。彼らは普遍的に働いています。 Vagrantはあなたの環境に最適な同期フォルダオプションを自動的に選択します。

14
arcseldon

このコマンドを実行してvagrant-vbguestプラグインをインストールします。

vagrant plugin install vagrant-vbguest
12
ngonidzashe

私はCentos 7で同じ問題を経験しました、私はVirtualBoxのアップデートされたバージョンと組み合わせた古いカーネルのせいであると思います。 Blizzのアップデートに基づいて、これは私にとってうまくいったものです(vagrant-vbguestプラグインは既にインストールされています):

vagrant ssh
Sudo yum -y install kernel-devel
Sudo yum -y update
exit
vagrant reload --provision
6
user3006381

私にとって、VBoxGuestAdditions 5.1.20では、問題は/sbin/mount.vboxsfが間違った場所を指していたことです。

Sudo ln -sf /opt/VBoxGuestAdditions-5.1.20/lib/VBoxGuestAdditions/mount.vboxsf /sbin/mount.vboxsf

私のためにそれを修正しました

5
bartv

Vagrant issue#3341 で述べたように、これは Virtualbox bug#12879 でした。

これはVirtualBox 4.3.10にのみ影響し、4.3.12で完全に修正されました。

4
tsusanka

念のため、Vagrant 1.7.4とVirtualBox 5.0.10 r104061を使用して、/に共有フォルダーを作成し、ホームフォルダーへのシンボリックリンクを作成したときに、この問題が発生しました。このようなもの:

/folder
~/folder -> /folder

明らかに、この操作はセキュリティ上の理由からVagrantによって許可されておらず、説明されているエラーをスローします。

/home/vagrant/folderのように、目的のフォルダを私のホームディレクトリに直接プロビジョニングすることで解決しました。

3
Matheus Portela

私はこれが今最も更新された答えであると思います、そしてそれは私のために働きました(Guest Additions Version: 5.0.6VirtualBox Version: 4.3.16Ubuntu 14.04 LTS

https://github.com/mitchellh/vagrant/issues/3341#issuecomment-144271026

基本的に私は言う:

Simple and Quick Solution for Failed to mount folders in Linux guest issue.

Add the following line to your Homestead/Vagrantfile:

config.vbguest.auto_update = false
Your Homestead/Vagrantfile should looks like this:

/...

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

   # To avoid install and uninstall VBoxGuessAdditions during vagrant provisioning.
    config.vbguest.auto_update = false

.../
Save it and execute

$ vagrant destroy --force
$ vagrant up
3
psychok7

以前のUbuntu 16.04イメージで私の場合、エラーは別のvagrantイメージのためにvagrant-vbguestをインストールしてからUbuntu VMを起動した後に始まりました。それはゲスト追加を5.1.20にアップグレードし、それ以来、マウントは失敗し始めました。 apt update + upgradeと同じボックスを更新し、vbguestは新しいバージョン5.1.20をインストールします。

手動で実行することで解決しました:

Sudo apt-get update
Sudo apt-get install virtualbox-guest-dkms 

また、このVMに対して:config.vbguest.auto_update = falseを無効にします(必要ではないかもしれません)。

2
Nico

WindowsがHostでlinuxがguestの設定では、別の場所で同じ問題の解決策を見つけました。

エラーメッセージは「Linuxゲストにフォルダをマウントできませんでした。これは通常、「vboxsf」ファイルシステムが利用できないためです。」 (...)

これは、ゲストシステムの内部で/ vagrantから/ home/vagrant/vagrantへのシンボリックリンクを作成したために間違えたためです。重要なのは、ディレクトリ/ vagrantはシンボリックリンクを持っている通常のLinuxディレクトリだからです(でも大丈夫ですが)。シンボリックリンク。 WindowsホストはLinuxシンボリックリンクをサポートしていません。

そのため、あなたができることは、ゲストにSSH接続し、シンボリックリンクを持っている場所ならどこでもシンボリックリンクを削除し、そしてmachineをリロードすることです。

私の設定では、Vagrant 1.7.2、VBoxGuestAdditions 4.3.28、およびVBox 4.3.28でした。

1
BartoszK

これは2017年です。念のために誰かが同じ問題に直面しています。

Bento/centos-6.7では、同じエラーになりました。それはプラグインvagrant-vbguest(0.13.0)を追加することによって解決されました。 c:> vagrantプラグインインストールvagrant-vbguest

ボックスのURL: http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-7.0_chef-provisionerless.box

このcentos-7バージョンは私に同じエラーを与えていました

エラー:

==> build: Mounting shared folders...
    build: /vagrant => C:/projects/
Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:

mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant

The error output from the command was:

/sbin/mount.vboxsf: mounting failed with the error: No such device

私の設定:

C:\projects>vagrant -v
Vagrant 1.9.1

C:\projects> vboxmanage -v
5.0.10r104061

C:\projects>vagrant plugin list
vagrant-cachier (1.2.1)
vagrant-hostmanager (1.8.5)
vagrant-hosts (2.8.0)
vagrant-omnibus (1.5.0)
vagrant-share (1.1.6, system)
vagrant-vbguest (0.13.0)
vagrant-vbox-snapshot (0.0.10)

私はすでにvagrant-vbguestプラグインを持っているので、それが異なったバージョンのVBGuestAdditionsがホスト5.0.10とゲスト4.3.20にインストールされているのを見ると、それはcentos-7でVBoxGuestAdditionsを更新しようとします。

シンボリックリンクが存在することを確認しました。

[root@build VBoxGuestAdditions]# ls -lrt /usr/lib
lrwxrwxrwx.  1 root root   53 Jan 14 12:06 VBoxGuestAdditions -> /opt/VBoxGuestAdditions-5.0.10/lib/VBoxGuestAdditions
[root@build VBoxGuestAdditions]# mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant
/sbin/mount.vboxsf: mounting failed with the error: No such device

これは、user3006381で提案されているようには機能しませんでした

vagrant ssh
Sudo yum -y install kernel-devel
Sudo yum -y update
exit
vagrant reload --provision

centos-7のための解決策:psychok7が与えたように

信頼できる自動更新。 config.vbguest.auto_update = falseそしてvagrant destroy --forcevagrant up

結果:

javareport: Guest Additions Version: 4.3.20
javareport: VirtualBox Version: 5.0
==> javareport: Setting hostname...
==> javareport: Configuring and enabling network interfaces...
==> javareport: Mounting shared folders...
javareport: /vagrant => C:/projects

C:\project>
1

今ではマウントはいくつかのマシン(ubuntu)で動作し、いくつかは動作しません(centos 7)が、プラグインをインストールすることで解決します

vagrant plugin install vagrant-vbguest

その上で他に何もする必要はなく、ただ

vagrant reload
1

(上記の私のコメントから)

それが根底にある問題をたどる:、これを言っているコメント内の部分:特に

wget https://www.virtualbox.org/download/testcase/VBoxGuestAdditions_4.3.11-93070.iso‌​ 
Sudo cp VBoxGuestAdditions_4.3.11-93070.iso /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso

それが終わったら、私はすべての仮想マシン(そしてもちろん現在のVagrantfiles)を使っていつもどおりビジネスを行っています。

動作させるために、新しく作成した仮想マシンで何かをしなければならない場合、何かが間違っています。

1
klang

これはvbguest vagrantプラグインと最新バージョンのvagrantとの非互換性のためと思われます。それはゲスト追加を更新しようとしていて、それを完全に/適切にしていません。

0
Hickeroar

私はVirtualBox 5.1.XでVagrantを実行していて、VirtualBox 5.0.40にダウングレードし、この問題を解決するためにvbguestプラグインをインストールする必要がありました。

私のステップは次のとおりです。

  • VirtualBox 5.1.Xをアンインストールします。
  • インストール Vagrant 5.0.40
  • 私のマシンを再起動
  • 私の浮浪者のためにvagrant upを実行してください。失敗するでしょう。
  • Vagrantプラグインをインストールするために、私のVMの実行中にvagrant plugin install vagrant-vbguestを実行してください。これにより、ホストとゲスト間でVirtualBox Guestのバージョンを同期できます。
  • vagrant reloadを実行して仮想マシンをリロードします
  • 魔法!
0
Brad Parks

あなたのログはexportfsを見つけられないことについて不平を言います:Sudo: /usr/bin/exportfs: command not found

Exportfsは、ローカルディレクトリをNFSクライアントがマウントできるようにします。

0
kenzie

それを試してみてください。

vagrant plugin install vagrant-vbguest

Vagrantfileに以下を追加してください。

config.vbguest.iso_path = "http://download.virtualbox.org/virtualbox/VERSION/VBoxGuestAdditions_VERSION.iso"
config.vbguest.auto_update = false
config.vbguest.installer_arguments = %w{--nox11 -- --force}

実行します。

vagrant vbguest --do install -f -b

vagrant reload
0
user8034098