rocky9安装vmware-tools-distrib提示:What is the directory that contains the init directories (rc0.d/ to rc6.d/)?

目的

在rocky9上安装vmware-tools,提示(rc0.d/ to rc6.d/)?

f699d5d1417184208b3aaf36fa18abe2.png

env

  • rockylinux9
  • VMwareTools-10.3.26-22085142.tar.gz

日志

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
INPUT: []  default
The path "" is not an existing directory.
Invalid default answer!
Execution aborted.

意思是:

安装脚本在询问 Linux 的 SysV init 脚本目录(rc0.d ~ rc6.d),但检测不到路径,因此无法继续。


1.错误原因分析

VMware Tools 的 vmware-install.pl旧版安装器(tar4 格式),它默认认为系统使用 SysV init(/etc/rc.d/rc.d)* 方式。

但是在:

  • RockyLinux 8+/9+
  • CentOS 8+/Stream
  • RHEL 8+/9+
  • Ubuntu 20+/22+

这些系统已经全面使用 systemd,不再有 /etc/rc*.d/ 目录。
因此脚本检测不到该目录而退出,不支持rocky9部署(脚本没有判断出来系统)

8464777494809b7874effb6b49ec70c7.png


解决方式

方式1:手动指定 rc.d 路径

实际没成功

在提示输入时,手动输入:

/etc/rc.d

即可继续完成安装。

或者在静默安装中直接指定:

1
sudo ./vmware-install.pl -d --default --force-install

在执行前创建兼容目录:

1
sudo mkdir -p /etc/rc.d

方式2:改用 Open VM Tools(现代推荐)

为了虚拟机增强功能(如剪贴板、时间同步、网卡驱动),
建议直接用官方支持的 open-vm-tools 包,系统原生维护更稳定:

1
2
3
sudo dnf remove vmware-tools* -y
sudo dnf install open-vm-tools -y
sudo systemctl enable --now vmtoolsd

验证:

1
vmware-toolbox-cmd -v

💡 从 VMware ESXi 6.5+ 起,VM 官方推荐使用 open-vm-tools,因为:

  • 自动随系统更新;
  • 完美兼容 systemd;
  • 无需内核模块编译;
  • 免去上面这种安装麻烦。