[patch] Support for kernel 5.18 (Parallel Tools 17.1.4.51567)

@JP_7 https://forum.parallels.com/threads/tools-patch-procedure.351669/
These are the detailed instructions kindly provided by Mark Fine with full disclaimers. This was never intended for an end-user to DIY. It is literally editing your kernel. The good news is you can take a Snapshot beforehand and do this as many times as it takes. I was successful but it took me several hours because this was the 1st time I ever attempted such a thing. Granted I could do it much faster next time- but there is no way I could guide someone via text in a forum. Best of luck.
 
Somehow for me the patch is getting stuck after successfully applying a few hunks, not sure what's happening there:
Code:
    parallels-iso.fedora-parallels-arm64: patching file prl_fs/Toolgate/Guest/Linux/prl_tg/prltg_call.c
    parallels-iso.fedora-parallels-arm64: Using Plan A...
    parallels-iso.fedora-parallels-arm64: Hunk #1 succeeded at 76.
    parallels-iso.fedora-parallels-arm64: Hunk #2 succeeded at 92.
    parallels-iso.fedora-parallels-arm64: Hunk #3 succeeded at 137.
    parallels-iso.fedora-parallels-arm64: Hunk #4 succeeded at 156.
    parallels-iso.fedora-parallels-arm64: Hunk #5 succeeded at 192.
    parallels-iso.fedora-parallels-arm64: Hunk #6 succeeded at 209.
    parallels-iso.fedora-parallels-arm64: Hunk #7 succeeded at 227.
    parallels-iso.fedora-parallels-arm64: Hunk #8 succeeded at 292.
    parallels-iso.fedora-parallels-arm64: Hunk #9 succeeded at 406.
    parallels-iso.fedora-parallels-arm64: Hunk #10 succeeded at 441.
    parallels-iso.fedora-parallels-arm64: Hunk #11 succeeded at 500.
    parallels-iso.fedora-parallels-arm64: Hmm...  The next patch looks like a unified diff to me...
    parallels-iso.fedora-parallels-arm64: The text leading up to this was:
    parallels-iso.fedora-parallels-arm64: --------------------------
    parallels-iso.fedora-parallels-arm64: |diff -puNr 1/parallels-tools-17.1.4.51567.orig/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c parallels-tools-17.1.4.51567/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c
    parallels-iso.fedora-parallels-arm64: |--- 1/parallels-tools-17.1.4.51567.orig/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c    2022-05-30 20:22:14.000000000 +0000
    parallels-iso.fedora-parallels-arm64: |+++ parallels-tools-17.1.4.51567/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c    2022-06-03 01:39:47.387571647 +0000
    parallels-iso.fedora-parallels-arm64: --------------------------
    parallels-iso.fedora-parallels-arm64: patching file prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c
    parallels-iso.fedora-parallels-arm64: Using Plan A...
At this point it doesn't continue, I waited for ~30 minutes. I'm applying it like this, was anyone else having this issue?
Code:
$ cd /opt/mnt/kmods
$ tar xvpf prl_mod.tar.gz
$ rm -f prl_mod.tar.gz
$ patch -p1 --verbose < /tmp/parallels-fix.patch
 
Looks like you're trying to patch the iso mount point, which really should be read only and won't amount to a hill of beans.

Per step 5 in the path procedure: What I recommend is to create a new directory and make a copy of what's mounted first, then patch that. There are several reasons for doing that, the main one being that once it's patched, it stays patched. If the kernel is updated again and it breaks something else, you will have fewer things to deal with.

Also, make sure you're using the patch file from this post.
 
No, I unpacked the ISO first, sorry for not posting that step. But yeah, I think I used the wrong patch. Thanks!
Right, but my point is: Usually when you exit the VM the mount point disappears and won't reappear the next time you start it and re-mount the iso. So if you've mounted the iso, expanded it there, then applied the patch to that, your patched kernel code baseline will also disappear. If there's any additional follow-on patches or other fixes that are needed, it won't work until you've re-applied this patch to the iso before anything else is done.
 
Thank you sharing man! I'm also interested in when there will be a offical patch from parallel?
It's been more than one month already. Lots of people are still facing the issue.
 
Thank to everyone involved in patching the kernel and for supplying the code. I'm new to parallels after moving from VirtualBox. Was stumped when the tools didn't first install and glad I stumbled on this thread. I'm running Fedora 36 on intel with kernel 5.18.11. I applied the patches manually to each file, but I'm not sure I have the most recent version of the patch. It is working and I can see all my native files from OSX. Much appreciated. A bit dismayed that there is no official patch for this.
 
Just a FYI, the patch I made still works with the 5.19.0 kernel that was released today (at least it does for me).

No kernel update for my x86_64 FC36 as yet, but I've applied the changes to inode.c as a preemptive strike. I'll let you know the results when it finally hits.
 
On my Macbook M1 Pro using https://github.com/wegank/nixos-con...56e/hardware/parallels-unfree/prl-tools.patch with Kali kernel 5.18 works like a charm. The other one shared is for Intel and got directory path that don't exist for ARM Parallels Tools.
Using the patch you must use the directory name "prl-tools-build", put the Parallels Tools in there and looks like this:

/home/<user>/prl-tools-build/install
/home/<user>/prl-tools-build/installer
/home/<user>/prl-tools-build/install-gui
/home/<user>/prl-tools-build/kmods
/home/<user>/prl-tools-build/prl-tools.patch
/home/<user>/prl-tools-build/tools
/home/<user>/prl-tools-build/version

/home/<user>/prl-tools-build/patch -p1 < prl-tools.patch
 
On my Macbook M1 Pro using https://github.com/wegank/nixos-con...56e/hardware/parallels-unfree/prl-tools.patch with Kali kernel 5.18 works like a charm. The other one shared is for Intel and got directory path that don't exist for ARM Parallels Tools.
Using the patch you must use the directory name "prl-tools-build", put the Parallels Tools in there and looks like this:

/home/<user>/prl-tools-build/install
/home/<user>/prl-tools-build/installer
/home/<user>/prl-tools-build/install-gui
/home/<user>/prl-tools-build/kmods
/home/<user>/prl-tools-build/prl-tools.patch
/home/<user>/prl-tools-build/tools
/home/<user>/prl-tools-build/version

/home/<user>/prl-tools-build/patch -p1 < prl-tools.patch

Thanks for that! works for me with MBP M1. finally :)
If it helps even better, here are copy-paste commands to do the patch & install parallels tools for kernel 5.18 on m1 (For kali 2022.2).
Steps by @DerekE2 and @SPX
Code:
mkdir ~/prl-tools-build
cd ~/prl-tools-build
cp -r /media/cdrom/* .
wget https://raw.githubusercontent.com/wegank/nixos-config/7b89b4c6d1a87c83f10aa5d0f96fe0229795056e/hardware/parallels-unfree/prl-tools.patch
cd kmods
tar zxf prl_mod.tar.gz
patch -p1 < prl-tools.patch
cd kmods
mv prl_mod.tar.gz prl_mod.tar.gz.orig
mv prl_mod.tar.gz.orig ../
tar zcf prl_mod.tar.gz *
cd ..
./install
 
Hello all, gosh I'm stuck on this thing since 3 days ^^
Exact same config with a fresh install of Kali Bare metal installer for Mac M1 on a MBP M1
The patch works smoothly but the install keeps failing, if someone has a clue !
Code:
2022-08-09T11:37:17+0200:

Parallels Tools 1.7.3-23546 Installer started.
2022-08-09T11:37:17+0200: Failed to setup console printk level.
2022-08-09T11:37:26+0200: execCmd: ./install --check [0]
2022-08-09T11:37:26+0200: execCmd: ./installer/detect-xserver.sh -v >/dev/null 2>&1 [0]
2022-08-09T11:37:34+0200: execCmd: ./installer/pm.sh --check gtools [0]
Started installation of Parallels Guest Tools version '1.7.3.23546'
modprobe: FATAL: Module prl_tg not found in directory /lib/modules/5.18.0-kali5-arm64

Tue Aug 9 11:37:34 CEST 2022
Start installation or upgrade of Guest Tools
Installed Guest Tools were not found
Register service to install new Guest Tools
Perform installation into the /usr/lib/parallels-tools directory
make: Entering directory '/usr/lib/parallels-tools/kmods'
awk: cmd. line:1: warning: regexp escape sequence `\#' is not a known regexp operator
Will use compiler CC="cc".
Compiler version "cc (Debian 11.3.0-5) 11.3.0"
cd prl_tg/Toolgate/Guest/Linux/prl_tg && make CC=cc
make[1]: Entering directory '/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg'
1: /lib/modules/5.18.0-kali5-arm64/build
2: /usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg
3: 20220809
4: 1.10.0
Start compile prl_tg...
make -C /lib/modules/5.18.0-kali5-arm64/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.18.0-kali5-arm64'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc-11 (Debian 11.3.0-3) 11.3.0
  You are using:           cc (Debian 11.3.0-5) 11.3.0
1: /lib/modules/5.18.0-kali5-arm64/build
2: /usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg
3: 20220809
4: 1.10.0
  CC [M]  /usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.o
In file included from /usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c:23:
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg_common.h: In function 'tg_out':
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg_common.h:179:14: warning: assignment to 'long unsigned int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
  179 |         port += dev->base_addr;
      |              ^~
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg_common.h:183:24: warning: passing argument 2 of 'iowrite64' makes pointer from integer without a cast [-Wint-conversion]
  183 |         iowrite64(val, port);
      |                        ^~~~
      |                        |
      |                        long unsigned int
In file included from /usr/src/linux-headers-5.18.0-kali5-common/arch/arm64/include/asm/io.h:185,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/io.h:13,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/irq.h:20,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/asm-generic/hardirq.h:17,
                 from /usr/src/linux-headers-5.18.0-kali5-common/arch/arm64/include/asm/hardirq.h:17,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/hardirq.h:11,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/interrupt.h:11,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/pci.h:38,
                 from /usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c:7:
/usr/src/linux-headers-5.18.0-kali5-common/include/asm-generic/io.h:769:64: note: expected 'volatile void *' but argument is of type 'long unsigned int'
  769 | static inline void iowrite64(u64 value, volatile void __iomem *addr)
      |                                         ~~~~~~~~~~~~~~~~~~~~~~~^~~~
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c: In function 'prl_tg_write':
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c:252:30: error: implicit declaration of function 'PDE_DATA'; did you mean 'NODE_DATA'? [-Werror=implicit-function-declaration]
  252 |         struct tg_dev *dev = PDE_DATA(FILE_DENTRY(filp)->d_inode);
      |                              ^~~~~~~~
      |                              NODE_DATA
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c:252:30: warning: initialization of 'struct tg_dev *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
In file included from /usr/src/linux-headers-5.18.0-kali5-common/include/asm-generic/bug.h:22,
                 from /usr/src/linux-headers-5.18.0-kali5-common/arch/arm64/include/asm/bug.h:26,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/bug.h:5,
                 from /usr/src/linux-headers-5.18.0-kali5-common/arch/arm64/include/asm/cpufeature.h:19,
                 from /usr/src/linux-headers-5.18.0-kali5-common/arch/arm64/include/asm/hwcap.h:9,
                 from /usr/src/linux-headers-5.18.0-kali5-common/arch/arm64/include/asm/arch_timer.h:12,
                 from /usr/src/linux-headers-5.18.0-kali5-common/arch/arm64/include/asm/timex.h:8,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/timex.h:67,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/time32.h:13,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/time.h:60,
                 from /usr/src/linux-headers-5.18.0-kali5-common/arch/arm64/include/asm/stat.h:12,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/stat.h:6,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/module.h:13,
                 from /usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c:5:
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c: In function 'prl_tg_probe_common':
2022-08-09T11:37:34+0200: Started installation of Parallels Guest Tools version '1.7.3.23546'
modprobe: FATAL: Module prl_tg not found in directory /lib/modules/5.18.0-kali5-arm64

Tue Aug 9 11:37:34 CEST 2022
Start installation or upgrade of Guest Tools
awk: cmd. line:1: warning: regexp escape sequence `\#' is not a known regexp operator
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc-11 (Debian 11.3.0-3) 11.3.0
  You are using:           cc (Debian 11.3.0-5) 11.3.0
In file included from /usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c:23:
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg_common.h: In function 'tg_out':
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg_common.h:179:14: warning: assignment to 'long unsigned int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
  179 |         port += dev->base_addr;
      |              ^~
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg_common.h:183:24: warning: passing argument 2 of 'iowrite64' makes pointer from integer without a cast [-Wint-conversion]
  183 |         iowrite64(val, port);
      |                        ^~~~
      |                        |
      |                        long unsigned int
In file included from /usr/src/linux-headers-5.18.0-kali5-common/arch/arm64/include/asm/io.h:185,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/io.h:13,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/irq.h:20,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/asm-generic/hardirq.h:17,
                 from /usr/src/linux-headers-5.18.0-kali5-common/arch/arm64/include/asm/hardirq.h:17,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/hardirq.h:11,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/interrupt.h:11,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/pci.h:38,
                 from /usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c:7:
/usr/src/linux-headers-5.18.0-kali5-common/include/asm-generic/io.h:769:64: note: expected 'volatile void *' but argument is of type 'long unsigned int'
  769 | static inline void iowrite64(u64 value, volatile void __iomem *addr)
      |                                         ~~~~~~~~~~~~~~~~~~~~~~~^~~~
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c: In function 'prl_tg_write':
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c:252:30: error: implicit declaration of function 'PDE_DATA'; did you mean 'NODE_DATA'? [-Werror=implicit-function-declaration]
  252 |         struct tg_dev *dev = PDE_DATA(FILE_DENTRY(filp)->d_inode);
      |                              ^~~~~~~~
      |                              NODE_DATA
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c:252:30: warning: initialization of 'struct tg_dev *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
In file included from /usr/src/linux-headers-5.18.0-kali5-common/include/asm-generic/bug.h:22,
                 from /usr/src/linux-headers-5.18.0-kali5-common/arch/arm64/include/asm/bug.h:26,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/bug.h:5,
                 from /usr/src/linux-headers-5.18.0-kali5-common/arch/arm64/include/asm/cpufeature.h:19,
                 from /usr/src/linux-headers-5.18.0-kali5-common/arch/arm64/include/asm/hwcap.h:9,
                 from /usr/src/linux-headers-5.18.0-kali5-common/arch/arm64/include/asm/arch_timer.h:12,
                 from /usr/src/linux-headers-5.18.0-kali5-common/arch/arm64/include/asm/timex.h:8,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/timex.h:67,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/linux/time32.h:13,
                 from /usr/src/linux-headers-5.18.0-kali5-common/include/l/usr/src/linux-headers-5.18.0-kali5-common/include/linux/kern_levels.h:5:25: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'void *' [-Wformat=]
    5 | #define KERN_SOH        "\001"          /* ASCII Start Of Header */
      |                         ^~~~~~
/usr/src/linux-headers-5.18.0-kali5-common/include/linux/printk.h:418:25: note: in definition of macro 'printk_index_wrap'
  418 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
      |                         ^~~~
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c:516:9: note: in expansion of macro 'printk'
  516 |         printk(KERN_INFO "detected %s, base addr %08lx, IRQ %d\n",
      |         ^~~~~~
/usr/src/linux-headers-5.18.0-kali5-common/include/linux/kern_levels.h:14:25: note: in expansion of macro 'KERN_SOH'
   14 | #define KERN_INFO       KERN_SOH "6"    /* informational */
      |                         ^~~~~~~~
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c:516:16: note: in expansion of macro 'KERN_INFO'
  516 |         printk(KERN_INFO "detected %s, base addr %08lx, IRQ %d\n",
      |                ^~~~~~~~~
/usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux
cc1: some warnings being treated as errors
make[3]: *** [/usr/src/linux-headers-5.18.0-kali5-common/scripts/Makefile.build:293: /usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.o] Error 1
make[2]: Leaving directory '/usr/src/linux-headers-5.18.0-kali5-arm64'
make[2]: *** [/usr/src/linux-headers-5.18.0-kali5-common/Makefile:1858: /usr/lib/parallels-tools/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg] Error 2
 
Thanks for that! works for me with MBP M1. finally :)
If it helps even better, here are copy-paste commands to do the patch & install parallels tools for kernel 5.18 on m1 (For kali 2022.2).
Steps by @DerekE2 and @SPX
Code:
mkdir ~/prl-tools-build
cd ~/prl-tools-build
cp -r /media/cdrom/* .
wget https://raw.githubusercontent.com/wegank/nixos-config/7b89b4c6d1a87c83f10aa5d0f96fe0229795056e/hardware/parallels-unfree/prl-tools.patch
cd kmods
tar zxf prl_mod.tar.gz
patch -p1 < prl-tools.patch
cd kmods
mv prl_mod.tar.gz prl_mod.tar.gz.orig
mv prl_mod.tar.gz.orig ../
tar zcf prl_mod.tar.gz *
cd ..
./install
Hmm weird.. when I try to patch the files, I keep getting errors that it can't find the file:

can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -puNr prl-tools-build/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c prl-tools-build/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c
|--- prl-tools-build/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c
|+++ prl-tools-build/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 16
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -puNr prl-tools-build/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg_call.c prl-tools-build/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg_call.c
|--- prl-tools-build/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg_call.c
|+++ prl-tools-build/kmods/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg_call.c
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
11 out of 11 hunks ignored
can't find file to patch at input line 118
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -puNr prl-tools-build/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/inode.c prl-tools-build/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/inode.c
|--- prl-tools-build/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/inode.c
|+++ prl-tools-build/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/inode.c
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
3 out of 3 hunks ignored​
 
It sucks I can't edit my message.. guess it's not the year 2022 yet at Parallels HQ. Anyways, I noticed what I did wrong.. and applying the patch did work but still getting the same error when running the installer.. prl_tg not found.
 
Back
Top