解决Parallels Tools在kali2020.2中安装报错

在kali2020.2最新版的系统中安装虚拟机工具Parallels Tools(版本15.1.4)会报如下错误:

Start compile prl_tg...
make -C /lib/modules/5.6.0-1-amd64/build M=/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg SRCROOT=/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg CC=cc modules
make[2]: Entering directory '/usr/src/linux-headers-5.6.0-1-amd64'
1: /lib/modules/5.6.0-1-amd64/build
2: /usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg
3: 20200508
4: 1.7.0
  CC [M]  /usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.o
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c: In function 'prltg_proc_create_data':
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c:405:46: error: passing argument 4 of 'proc_create_data' from incompatible pointer type [-Werror=incompatible-pointer-types]
  405 |  return proc_create_data(name, mode, parent, fops, data);
      |                                              ^~~~
      |                                              |
      |                                              struct file_operations *
In file included from /usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c:10:
/usr/src/linux-headers-5.6.0-1-common/include/linux/proc_fs.h:59:31: note: expected 'const struct proc_ops *' but argument is of type 'struct file_operations *'
   59 | extern struct proc_dir_entry *proc_create_data(const char *, umode_t,
      |                               ^~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[4]: *** [/usr/src/linux-headers-5.6.0-1-common/scripts/Makefile.build:273: /usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.o] Error 1
make[3]: *** [/usr/src/linux-headers-5.6.0-1-common/Makefile:1696: /usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-5.6.0-1-amd64'
make[2]: *** [/usr/src/linux-headers-5.6.0-1-common/Makefile:180: sub-make] Error 2
make[1]: Leaving directory '/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg'
make[1]: *** [Makefile:42: prl_tg] Error 2
make: Leaving directory '/usr/lib/parallels-tools/kmods'
make: *** [Makefile.kmods:31: compile] Error 2
Error: could not build kernel modules
Error during report about failed installation of parallels tools.
Error: failed to upgrade Parallels Guest Tools!
2020-05-08T10:10:04+0800: Started installation of Parallels Guest Tools version '15.1.4.47270'
Error during report about start installation of parallels tools.

原因在于新的linux内核修改了一个参数的名字,详情见内核修改清单,导致编译时无法调用参数里的结构体。按以下步骤修改文件重新打包编译后可正常安装。

  1. 挂载Parallels Tools CD,并复制所有文件到一个新建的目录
mkdir /usr/local/pt
cd /usr/local/pt
cp -r /media/cdrom0/* .
  1. 解压kmods目录的prl_mod.tar.gz
cd kmods
tar -xzf prl_mod.tar.gz
  1. 把以下文件中的“file_operations”修改为“proc_ops”
    prl_fs/SharedFolders/Guest/Linux/prl_fs/
    –prlfs_compat.h
    –super.c
    prl_fs_freeze/Snapshot/Guest/Linux/prl_freeze
    –prl_fs_freeze.c
    –prlfs_freeze_compat.h
    prl_tg/Toolgate/Guest/Linux/prl_tg
    –prltg_common.h
    –prltg.c
    prl_vid/Video/Guest/Linux/kmod
    –prlvtg.c
    修改过程中,可以在每个文件夹中运行一下make命令,检验是否有修改错误。检验完毕后用make clean清理一下。
  2. 重新打包
rm prl_mod.tar.gz
tar -zcvf prl_mod.tar.gz .
  1. 运行install脚本。

修改时需要注意,结构体的方法名也要做相应修改,否则会报错;.owner = THIS_MODULE,这个方法要删除掉
在这里插入图片描述
本文受https://forum.parallels.com/threads/unable-to-reinstall-parallels-tools-on-debian-bullseye.349865/#post-866677 启发进行操作。

你可能感兴趣的:(linux)