解決共享文件夾不顯示以及VMware-tools的重裝問題

環境:

Win10
VMware Workstation 12
虛擬機:Xubuntu 14.04 (內核4.4)

問題:

之前虛擬機中安裝過VMware-tools,可能沒有安裝完整導致現在開啓共享文件夾設置後在虛擬機中無法顯示(沒有hgfs/目錄)。

檢查虛擬機發現:
/usr/lib/vmware-tools目錄沒有;
vmware-config-tools.pl和vmware-uninstall-tools.pl腳本指令也都沒有;
但命令行下運行vmware-hgfsclient命令能輸出我自己設置的共享文件夾名稱。

解決方法

首先,su - root進入到root用戶。
其次,以下三個選項更改了默認選項:

For kernels >= 4.0.0, open-vm-tools need to be of version 10.0.0 or higher for VMware Host Guest Filessystem (vmhgfs) to function with VMware Tools. Please upgrade open-vm-tools and rerun this installer, or uninstall open-vm-tools. Alternatively, you can disable using the vmhgfs when VMware Tools are configured.
Enter yes to proceed. [no] yes
這一步選擇了yes

The VMware Host-Guest Filesystem allows for shared folders between the host OS and the guest OS in a Fusion or Workstation virtual environment. Do you wish to enable this feature? [no] yes
這一步選擇了yes

Would you like to enable VMware automatic kernel modules? [no] yes
這一步選擇了yes

具體選項與執行信息如下:

root@ubuntu:/home/jeremy/disk2/xx/vmware-tools-distrib# ./vmware-install.pl
The installer has detected an existing installation of open-vm-tools on this 
system and will not attempt to remove and replace these user-space 
applications. It is recommended to use the open-vm-tools packages provided by 
the operating system. If you do not want to use the existing installation of 
open-vm-tools and attempt to install VMware Tools, you must uninstall the 
open-vm-tools packages and re-run this installer.
The packages that need to be removed are:
open-vm-dkms
open-vm-tools
The installer will next check if there are any missing kernel drivers. Type yes
if you want to do this, otherwise type no [yes] 

For kernels >= 4.0.0, open-vm-tools need to be of version 10.0.0 or higher for 
VMware Host Guest Filessystem (vmhgfs) to function with VMware Tools. Please 
upgrade open-vm-tools and rerun this installer, or uninstall open-vm-tools. 
Alternatively, you can disable using the vmhgfs when VMware Tools are 
configured.

Enter yes to proceed. [no] yes

Creating a new VMware Tools installer database using the tar4 format.

Installing VMware Tools.

In which directory do you want to install the binary files? 
[/usr/bin] 

What is the directory that contains the init directories (rc0.d/ to rc6.d/)? 
[/etc] 

What is the directory that contains the init scripts? 
[/etc/init.d] 

In which directory do you want to install the daemon files? 
[/usr/sbin] 

In which directory do you want to install the library files? 
[/usr/lib/vmware-tools] 

The path "/usr/lib/vmware-tools" does not exist currently. This program is 
going to create it, including needed parent directories. Is this what you want?
[yes] 

In which directory do you want to install the documentation files? 
[/usr/share/doc/vmware-tools] 

The path "/usr/share/doc/vmware-tools" does not exist currently. This program 
is going to create it, including needed parent directories. Is this what you 
want? [yes] 

The installation of VMware Tools 10.0.6 build-3595377 for Linux completed 
successfully. You can decide to remove this software from your system at any 
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".

Before running VMware Tools for the first time, you need to configure it by 
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want 
this program to invoke the command for you now? [yes] 

The file /usr/bin/vmware-hgfsclient that this program was about to install 
already exists.  Overwrite? [no] 

The file /sbin/mount.vmhgfs that this program was about to install already 
exists.  Overwrite? [no] yes

Initializing...

Making sure services for VMware Tools are stopped.

The module vmci has already been installed on this system by another installer 
or package and will not be modified by this installer.

The module vsock has already been installed on this system by another installer
or package and will not be modified by this installer.

The module vmxnet3 has already been installed on this system by another 
installer or package and will not be modified by this installer.

The module pvscsi has already been installed on this system by another 
installer or package and will not be modified by this installer.

The module vmmemctl has already been installed on this system by another 
installer or package and will not be modified by this installer.

The VMware Host-Guest Filesystem allows for shared folders between the host OS 
and the guest OS in a Fusion or Workstation virtual environment.  Do you wish 
to enable this feature? [no] yes

The vmxnet driver is no longer supported on kernels 3.3 and greater. Please 
upgrade to a newer virtual NIC. (e.g., vmxnet3 or e1000e)

VMware automatic kernel modules enables automatic building and installation of
VMware kernel modules at boot that are not already present. This feature can
be enabled/disabled by re-running vmware-config-tools.pl.

Would you like to enable VMware automatic kernel modules?
[no] yes

Thinprint provides driver-free printing. Do you wish to enable this feature? 
[yes] 

Creating a new initrd boot image for the kernel.
update-initramfs: Generating /boot/initrd.img-4.4.0-137-generic
vmware-tools start/running
vmware-tools-thinprint start/running
The configuration of VMware Tools 10.0.6 build-3595377 for Linux for this 
running kernel completed successfully.

Enjoy,

--the VMware team

root@ubuntu:/home/jeremy/disk2/xx/vmware-tools-distrib# 

現在就可以看到自己設置的共享文件夾Share了:

jeremy@ubuntu:~$ ll /mnt/hgfs/
total 9
dr-xr-xr-x 1 root root 4192 Feb 25 03:34 ./
drwxr-xr-x 3 root root 4096 Feb 25 02:51 ../
drwxrwxrwx 1 root root    0 Feb 24 23:20 Share/

參考

  1. 虛擬機找不到/mnt/hgfs掛載目錄

  2. 解決用vmhgfs-fuse .host:/ /mnt/hgfs掛載後需要超級用戶才能ls hgfs的問題

    $sudo vmhgfs-fuse .host:/winshare /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other,nonemptybb
    其中winshare 是win7下的共享目錄,如果不是直接對應到具體的目錄就用
    $sudo vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other,nonemptybb

  3. VMware中Linux虛擬機掛載主機共享文件夾的方法

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章