From b42e9aef238bb04ab3ced4353b84d9d6a13fab22 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 29 Aug 2014 08:27:48 -0700 Subject: [PATCH] guests/linux: more verbose output when shared folder mount fails [GH-4403] --- CHANGELOG.md | 2 ++ .../guests/linux/cap/mount_virtualbox_shared_folder.rb | 10 ++++++++-- templates/locales/en.yml | 4 ++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 079392983..ba867482d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,8 @@ BUG FIXES: - guests/fedora: Fix networks on Fedora 20 with libvirt. [GH-4104] - guests/freebsd: Rsync install for rsync synced folders work on FreeBSD 10. [GH-4008] + - guests/linux: Show more verbose error when shared folder mount fails. + [GH-4403] - guests/redhat: NFS setup should use systemd for RH7+ [GH-4228] - guests/smartos: Use `pfexec` for rsync. [GH-4274] - guests/windows: Reboot after hostname change. [GH-3987] diff --git a/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb b/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb index dccfac54e..53f098e07 100644 --- a/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb +++ b/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb @@ -41,10 +41,15 @@ module VagrantPlugins while true success = true + stderr = "" mount_commands.each do |command| no_such_device = false + stderr = "" status = machine.communicate.sudo(command, error_check: false) do |type, data| - no_such_device = true if type == :stderr && data =~ /No such device/i + if type == :stderr + no_such_device = true if data =~ /No such device/i + stderr += data.to_s + end end success = status == 0 && !no_such_device @@ -56,7 +61,8 @@ module VagrantPlugins attempts += 1 if attempts > 10 raise Vagrant::Errors::LinuxMountFailed, - command: mount_commands.join("\n") + command: mount_commands.join("\n"), + output: stderr end sleep 2 diff --git a/templates/locales/en.yml b/templates/locales/en.yml index dbf50f258..7fb7dbb2f 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -750,6 +750,10 @@ en: can work properly. The command attempted was: %{command} + + The error output from the last command was: + + %{output} linux_nfs_mount_failed: |- Mounting NFS shared folders failed. This is most often caused by the NFS client software not being installed on the guest machine. Please verify