折腾了一下Kali系统,安装VM-tools的时候出现了几个问题,最后终于解决了,写下来备用。

挂载硬盘,解压就不说了,直接说重点。

安装时会提示寻找linux-headers文件,直接apt-get安装时会提示找不到软件包,需要在apt源里添加两条源记录,如下:

编辑/etc/apt/sources.list文件,在末尾添加下面两条

deb http://http.kali.org/kali kali main non-free contrib
deb-src http://http.kali.org/kali kali main non-free contrib

然后执行

apt-get update

就可以安装linux-headers包了,命令为

apt-get install linux-headers-$(uname -r)

安装完了之后执行

ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/

这个问题就解决了。

在安装的最后一步,还有一个问题,在启动vmtools服务的时候,会出现以下提示:

blocking file system: failed
/etc/init.d/vmware-tools: 1185: local: ': bad variable name

编辑/etc/init.d/vmware-tools文件,837行,将get_version_integer整个函数改成

# Get the running kernel integer version
get_version_integer() {
  local version_uts
  local v1
  local v2
  local v3

  version_uts=`uname -r`

  # There is no double quote around the back-quoted expression on purpose
  # There is no double quote around $version_uts on purpose
  set `IFS='.'; echo $version_uts`
  v1="$1"
  v2="$2"
  v3="$3"
  # There is no double quote around the back-quoted expression on purpose
  # There is no double quote around $v3 on purpose
  if [ -z "$v1" ]; then
    v1="0"
  else
    set `IFS='-ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; echo $v1`
    v1="$1"
  fi
  if [ -z "$v2" ]; then
    v2="0"
  else
    set `IFS='-ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; echo $v2`
    v2="$1"
  fi
  if [ -z "$v3" ]; then
    v3="0"
  else
    set `IFS='-ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; echo $v3`
    v3="$1"
  fi

  kernel_version_integer "$v1" "$v2" "$v3"
}

然后运行vmtools-config-tools.pl,它位于解压出来的vmtools安装包的bin目录下,比如/tmp/vmware-tools-distrib/bin。

之后重启就OK了。


参考文献:

Kali虚拟机安装VMware Tools

Installing Kali Linux as a Virtual Machine in Virtual Box

Installing VMware Tools on Kali Linux and Some Debugging Basics

Logo

更多推荐