Fixing "The following VMware kernal modules have been found on your system that were not installed b

本文详细介绍了如何手动移除与VMware Tools冲突的内核模块,以解决安装过程中出现的错误。包括使用命令行工具进行移除操作,并提供了解决方案的步骤和注意事项。

Fixing "The following VMware kernal modules have been found on your system that were not installed by the VMware installer." If you are getting the following error when trying to install the tools:

"The following VMware kernal modules have been found on your system that were 
not installed by the VMware installer. Please remove them then run the installer again.

- vmblock
- vmmon
- vmnet

Execution aborted."


You are getting this error probably because you upgraded the kernel without removing VMware tools first, so now the modules are there and won't uninstall for some reason.

Run these commands to manually remove vmware tools (mostly):

sudo rm -rf /etc/vmware*
sudo rm -rf /usr/lib/vmware-tools
sudo rm -rf /lib/modules/$(uname -r)/misc/vm*


Now you should be able to run the installation again.

### 解决方案 用户 `xiexinxin` 不在 `sudoers` 文件中,因此无法使用 `sudo` 权限。以下是将用户添加到 `sudoers` 文件中的方法: #### 方法一:使用 `visudo` 编辑 `/etc/sudoers` `visudo` 是一个安全的编辑器,用于修改 `/etc/sudoers` 文件,确保语法正确[^4]。执行以下命令: ```bash sudo visudo ``` 在文件末尾添加以下内容: ```plaintext xiexinxin ALL=(ALL) NOPASSWD:ALL ``` 保存并退出。此配置允许用户 `xiexinxin` 以无密码方式执行所有 `sudo` 命令。 #### 方法二:将用户添加到 `sudo` 用户组 在某些 Linux 发行版中(如 Ubuntu),属于 `sudo` 组的用户自动具有管理员权限。可以通过以下命令将用户添加到该组: ```bash sudo usermod -aG sudo xiexinxin ``` 完成后,用户需要重新登录以使更改生效[^2]。 #### 方法三:检查文件权限 如果直接编辑 `/etc/sudoers` 文件时遇到权限问题,可以检查文件的所有者和权限: ```bash ls -l /etc/sudoers ``` 确保文件由 `root` 拥有,并且权限为 `440` 或更严格。若权限不正确,可通过以下命令修复: ```bash sudo chmod 440 /etc/sudoers sudo chown root:root /etc/sudoers ``` #### 方法四:解决 SELinux 引发的权限问题 如果系统启用了 SELinux,可能会限制对 `/etc/sudoers` 的访问。可以检查文件的安全上下文: ```bash ls -Z /etc/sudoers ``` 输出示例: ```plaintext system_u:object_r:etc_t:s0 /etc/sudoers ``` 如果上下文不正确,可以尝试修复: ```bash sudo restorecon /etc/sudoers ``` #### 示例代码 以下是一个完整的脚本,用于将用户 `xiexinxin` 添加到 `sudoers` 文件中: ```bash #!/bin/bash # 将用户添加到 sudo 组 if ! id "xiexinxin" &>/dev/null; then echo "User xiexinxin does not exist. Creating it..." sudo adduser xiexinxin fi # 将用户添加到 sudo 组 if ! groups xiexinxin | grep -q 'sudo'; then echo "Adding user xiexinxin to the sudo group..." sudo usermod -aG sudo xiexinxin fi # 使用 visudo 编辑 sudoers 文件 echo "Editing /etc/sudoers file..." sudo bash -c 'echo "xiexinxin ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers' # 检查 sudoers 文件语法 sudo visudo -c # 检查文件权限 CURRENT_PERMISSIONS=$(stat -c "%a" /etc/sudoers) if [ "$CURRENT_PERMISSIONS" != "440" ]; then echo "Fixing /etc/sudoers permissions..." sudo chmod 440 /etc/sudoers fi # 检查文件所有者 CURRENT_OWNER=$(stat -c "%U:%G" /etc/sudoers) if [ "$CURRENT_OWNER" != "root:root" ]; then echo "Fixing /etc/sudoers ownership..." sudo chown root:root /etc/sudoers fi echo "All checks completed." ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值