解决VMware虚拟机中Ubuntu 22.04无法联网, 安装VMwareTools失败,未发现软件包open-vm-dkms,open-vm-tools问题解决

Posted qq_735754647

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决VMware虚拟机中Ubuntu 22.04无法联网, 安装VMwareTools失败,未发现软件包open-vm-dkms,open-vm-tools问题解决相关的知识,希望对你有一定的参考价值。

尝试了网上很多教程,都是在Windows上修改网络属性,然而都没能解决,后来找到了解决方法。发现虚拟机里Ubuntu22.04系统桌面右上角并没有有线网络图标,尝试删除网络缓存文件后,重启网络后问题就解决了。解决方法
删除NetworkManager缓存文件

sudo service NetworkManager stop 

sudo rm /var/lib/NetworkManager/NetworkManager.state 

sudo service NetworkManager start


打开Ubuntu火狐浏览器,发现可以正常上网啦。

  1. 看到官方支持的新命令,抛弃以往复杂的安装方式,只需要一行代码就能搞定
sudo apt-get install open-vm-tools open-vm-tools-desktop  open-vm-dkms
  1. 在命令行输入回车之后
    E: 未发现软件包open-vm-dkms
    E: 无法定位软件包 open-vm-dkms
    然后查百度,输入
sudo apt-get update

然而并没有什么X用!!!
报错显示

W: Some index files failed to download. They have been ignored, or old ones used instead.
  1. 百度了很多方法最后我决定换阿里云的源!!
    首先将/var/lib/apt/lists 的文件备份一下
    mkdir /var/lib/apt/list
    cp -r /var/lib/apt/lists/* /var/lib/apt/list
    然后删除/var/lib/apt/lists/文件夹下所有的文件
    sudo rm -rf /var/lib/apt/lists/*
    然后 打开/etc/apt/sources.list (emacs/vi/vim都可以用)

将里面的内容都删掉,替换成阿里云的源
因为换了几个源都发现还是会出现
index files failed to download的错误
所以我用了网上的几个源组合在一起

#deb包


deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse


##测试版源


deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse


# 源码


deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse


##测试版源


deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse


# 更新的源的内容


# deb http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse

# deb http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse

# deb http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse

# deb http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse

# deb http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse

# deb-src http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse

# deb-src http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse

# deb-src http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse

# deb-src http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse

# deb-src http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse

先复制好内容
vi linux命令行用d键删除行,用滚轮中键或shift+Insert来粘贴内容

  1. 重新配置DNS;
    sudo emacs/vi /etc/resolv.conf
    
    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
    #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
    nameserver 114.114.114.114
    naemserver 8.8.8.8
    #阿里的DNS
    nameserver 223.5.5.5  
    nameserver 223.6.6.6
    
  2. 之后再运行sudo apt-get update 就成功啦!
  3. sudo apt-get update

  4. sudo apt-get upgrade
  5. 运行
    sudo apt-get install open-vm-tools open-vm-tools-desktop open-vm-dkms
    成功安装VMwareTools
  6. 输入sudo reboot重新启动即可使用VMwareTools

以上是关于解决VMware虚拟机中Ubuntu 22.04无法联网, 安装VMwareTools失败,未发现软件包open-vm-dkms,open-vm-tools问题解决的主要内容,如果未能解决你的问题,请参考以下文章

解决VMware虚拟机中Ubuntu 22.04无法联网, 安装VMwareTools失败,未发现软件包open-vm-dkms,open-vm-tools问题解决

Ubuntu22.04 在 VMware 17 无法实现拖放复制操作解决办法

Ubuntu操作系统22.04版本安装教程-VMware虚拟机

解决Vmware虚拟机中没有网络连接Ubuntu无法上网

解决Vmware虚拟机中没有网络连接Ubuntu无法上网

解决Vmware虚拟机中没有网络连接Ubuntu无法上网