Solve the shared folder and copy and paste problems of VMware16.2's Ubuntu22.04 virtual machine at one time

Table of contents

1. Ask a question - Ubuntu22.04 is not fully compatible with the latest vmware tools

2. Analyze the problem - other versions of vmware tools have been installed

3. Solve the problem

3.1 First uninstall all installed vmtool or open-vm-tools

3.2 Install open-vm-tools and open-vm-tools-desktop again

3.3 Close the Ubuntu22.04 virtual machine, set up a shared folder, and remember the path name

3.4 Mount Folder

3.5 Set the startup

What follows (friendly reminder!)


1. Ask a question - Ubuntu22.04 is not fully compatible with the latest vmware tools

Recently, when using the Ubuntu22.04 virtual machine created by VMware16.2, I found that even if your vmware is the latest version, even if vmware tool is installed, file sharing and copying and pasting between the virtual machine and the host cannot be realized. The reason may be that Ubuntu22.04 is not fully compatible with the latest vmware tools.

2. Analyze the problem - other versions of vmware tools have been installed

Under the vmware official forum, a reference solution is given.

VMware tools with Ubuntu 22,04 copy and paste... https://communities.vmware.com/t5/VMware-Workstation-Pro/VMware-tools-with-Ubuntu-22-04-copy-and-paste-not -working/td-p/2913183 However, maybe you, like me, directly execute the following instructions, which have no effect at first.

sudo apt install open-vm-tools-desktop
sudo apt install open-vm-tools

The reason is that, most likely, you have previously installed the official vmtool or an older version of open-vm-tools before this .

3. Solve the problem

In memory of our wasted time, hereby document the correct and complete solution.

3.1 First uninstall all installed vmtool or open-vm-tools

sudo vmware-uninstall-tools.pl
sudo apt-get remove open-vm-tools
sudo apt-get remove --auto-remove open-vm-tools
sudo apt-get purge open-vm-tools
sudo apt-get purge --auto-remove open-vm-tools

3.2 Install open-vm-tools and open-vm-tools-desktop again

sudo apt install open-vm-tools*

3.3 Close the Ubuntu22.04 virtual machine, set up a shared folder, and remember the path name

(Here is VMshare, pay attention to distinguish it from the name of the folder)

3.4 Mount Folder

# 查询是否存在已挂载的文件夹,本例中返回VMshare,即上一步设置的共享路径的名称
vmware-hgfsclient

If hgfs has been mounted, you need to unmount it first, and then mount it again with the following command.

# 取消挂载
sudo umount /mnt/hgfs

# 在home目录下查询uid,gid和umask
id

# 重新挂载,注意:请根据上一步的查询结果,更新下一个命令中uid,gid和umask值。
sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other -o uid=1000 -o gid=1000 -o umask=022

# 如果提示fuse:mountpoint is not empty,更换成以下指令。
sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o nonempty -o allow_other -o uid=1000 -o gid=1000 -o umask=022

 After the execution is successful, query the permissions of the files under the /mnt path.

ll /mnt

Under normal circumstances, the owner of the hgfs folder becomes the current Linux user name for subsequent normal read and write access.

3.5 Set the startup

Restart and find that the permissions have changed back, you need to set the boot to automatically mount

#打开配置文件
sudo vim /etc/fstab

# 设置开机自动挂载
.host:/ /mnt/hgfs    fuse.vmhgfs-fuse   allow_other,uid=1000,gid=1000,umask=022   0 0

What follows (friendly reminder!)

The system enters emergency mode due to error-prone configuration of auto-mounted files.

It is best to back up the fstab file first, and take a snapshot of the virtual machine.

Even in emergency mode, you can search for solutions without any psychological burden.

Hope it helps you.

Guess you like

Origin blog.csdn.net/slampai/article/details/128185055