Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

Parallels 10 在 Ubuntu 14.04.4 裝不上 Parallels Tools?改兩處源碼就搞定

這個問題折騰了我好一陣子,最後總算解決。我長年在 Mac 上用 Parallels 跑 Ubuntu,買的是正版,可惜官方對這類版本相容性問題的態度實在不敢恭維。

原本那台 Ubuntu 14.04 虛擬機因為做了一次版本升級,結果直接登不進系統,索性刪掉重裝。重裝之後卻無論如何都裝不上 Parallels Tools,只丟出一句模糊的錯誤提示,官網也查不到任何說明。換成 Ubuntu 16.04 一樣失敗。最後是在官方論壇的討論串裡找到答案:

https://forum.parallels.com/threads/parallels-10-ubuntu-14-04-tools-will-not-install.336252/

採用該串第 8 樓的方案後就完全正常了。以下用中文把流程記錄一遍。

步驟一:掛載鏡像並把內容複製出來

開一個終端機,逐條執行下面的指令。請務必走命令列,不要拿圖形介面工具代打,否則會冒出各種莫名其妙的錯誤(我第一次就踩了一堆)。

[code]cd /media/<username>/Parallels\ Tools/
mkdir ~/Desktop/tools
cp -pr * ~/Desktop/tools
cd ~/Desktop/tools
chmod -R 777 kmods

步驟二:修改 prltg.c

用解壓縮工具打開 ~/Desktop/tools/kmods/prl_mod.tar.gz,在壓縮檔內以 gedit 編輯 ./prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c,在既有的 include 敘述後補上一行:

[code]#include <linux/vmalloc.h>

步驟三:改寫 inode.c 裡的 prlfs_follow_link

同樣在壓縮檔內用 gedit 開啟 ./prl_fs/SharedFolders/Guest/Linux/prl_fs/inode.c,找到大約第 650 行的 prlfs_follow_link,把整段(含 compat_follow_link_t 的定義)替換成:

[code]#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
#define compat_follow_link_t const char*
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
#define compat_follow_link_t void*
#else
#define compat_follow_link_t int
#endif

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
static compat_follow_link_t prlfs_follow_link(struct dentry *dentry, void **cookie)
#else
static compat_follow_link_t prlfs_follow_link(struct dentry *dentry, struct nameidata *nd)
#endif
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
	return do_read_symlink(dentry);
#else
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
	nd_set_link(nd, do_read_symlink(dentry));
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
	return NULL;
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
	return 0;
#else
	return vfs_follow_link(nd, do_read_symlink(dentry));
#endif
#endif
}

步驟四:執行安裝

在 ~/Desktop/tools 目錄下開一個終端機,執行:

[code]sudo ./install

核心模組編譯通過後,Parallels Tools 就能順利裝完,共享資料夾、剪貼簿與滑鼠整合都會恢復正常。

Copyright © Linux教程網 All Rights Reserved