Skip to content

Instantly share code, notes, and snippets.

@xiaozhuai
Last active April 16, 2023 09:00
Show Gist options
  • Star 20 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save xiaozhuai/3383c5415abd71f3cfb2d0d103774e3f to your computer and use it in GitHub Desktop.
Save xiaozhuai/3383c5415abd71f3cfb2d0d103774e3f to your computer and use it in GitHub Desktop.
fix parallels tools install issue

install log

cd prl_fs/SharedFolders/Guest/Linux/prl_fs && make CC=cc
make[1]: Entering directory '/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs'
make -C /lib/modules/5.0.0-25-generic/build M=/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs CC=cc
make[2]: Entering directory '/usr/src/linux-headers-5.0.0-25-generic'
  CC [M]  /usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.o
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c: In function 'prlfs_remount':
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c:119:21: error: 'MS_RDONLY' undeclared (first use in this function); did you mean 'IS_RDONLY'?
  if ( (!((*flags) & MS_RDONLY) && PRLFS_SB(sb)->readonly) ||
                     ^~~~~~~~~
                     IS_RDONLY
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c:119:21: note: each undeclared identifier is reported only once for each function it appears in
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c:120:21: error: 'MS_MANDLOCK' undeclared (first use in this function); did you mean 'IS_MANDLOCK'?
         ((*flags) & MS_MANDLOCK) )
                     ^~~~~~~~~~~
                     IS_MANDLOCK
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c:123:12: error: 'MS_SYNCHRONOUS' undeclared (first use in this function); did you mean 'SB_SYNCHRONOUS'?
  *flags |= MS_SYNCHRONOUS; /* silently don't drop sync flag */
            ^~~~~~~~~~~~~~
            SB_SYNCHRONOUS
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c: In function 'prlfs_fill_super':
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c:277:17: error: 'MS_NOATIME' undeclared (first use in this function); did you mean 'S_NOATIME'?
  sb->s_flags |= MS_NOATIME | MS_SYNCHRONOUS;
                 ^~~~~~~~~~
                 S_NOATIME
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c:277:30: error: 'MS_SYNCHRONOUS' undeclared (first use in this function); did you mean 'SB_SYNCHRONOUS'?
  sb->s_flags |= MS_NOATIME | MS_SYNCHRONOUS;
                              ^~~~~~~~~~~~~~
                              SB_SYNCHRONOUS
scripts/Makefile.build:284: recipe for target '/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.o' failed
make[3]: *** [/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.o] Error 1
Makefile:1606: recipe for target '_module_/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs' failed
make[2]: Leaving directory '/usr/src/linux-headers-5.0.0-25-generic'
make[2]: *** [_module_/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs] Error 2
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/Makefile.v26:13: recipe for target 'all' failed
make[1]: Leaving directory '/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs'
make[1]: *** [all] Error 2
Makefile.kmods:49: recipe for target 'compile' failed
make: Leaving directory '/usr/lib/parallels-tools/kmods'
make: *** [compile] Error 2
Error: could not build kernel modules
Error during report about failed installation of parallels tools.
Error: failed to install Parallels Guest Tools!
2019-08-27T11:19:22+0800: Started installation of Parallels Guest Tools version '14.1.3.45485'

Error during report about start installation of parallels tools.
Tue Aug 27 11:19:19 CST 2019
Start installation or upgrade of Guest Tools
Makefile:223: ================= WARNING ================
Makefile:224: 'SUBDIRS' will be removed after Linux 5.3
Makefile:225: Please use 'M=' or 'KBUILD_EXTMOD' instead
Makefile:226: ==========================================
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c: In function 'prlfs_remount':
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c:119:21: error: 'MS_RDONLY' undeclared (first use in this function); did you mean 'IS_RDONLY'?
  if ( (!((*flags) & MS_RDONLY) && PRLFS_SB(sb)->readonly) ||
                     ^~~~~~~~~
                     IS_RDONLY
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c:119:21: note: each undeclared identifier is reported only once for each function it appears in
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c:120:21: error: 'MS_MANDLOCK' undeclared (first use in this function); did you mean 'IS_MANDLOCK'?
         ((*flags) & MS_MANDLOCK) )
                     ^~~~~~~~~~~
                     IS_MANDLOCK
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c:123:12: error: 'MS_SYNCHRONOUS' undeclared (first use in this function); did you mean 'SB_SYNCHRONOUS'?
  *flags |= MS_SYNCHRONOUS; /* silently don't drop sync flag */
            ^~~~~~~~~~~~~~
            SB_SYNCHRONOUS
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c: In function 'prlfs_fill_super':
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c:277:17: error: 'MS_NOATIME' undeclared (first use in this function); did you mean 'S_NOATIME'?
  sb->s_flags |= MS_NOATIME | MS_SYNCHRONOUS;
                 ^~~~~~~~~~
                 S_NOATIME
/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c:277:30: error: 'MS_SYNCHRONOUS' undeclared (first use in this function); did you mean 'SB_SYNCHRONOUS'?
  sb->s_flags |= MS_NOATIME | MS_SYNCHRONOUS;
                              ^~~~~~~~~~~~~~
                              SB_SYNCHRONOUS
make[3]: *** [/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs/super.o] Error 1
make[2]: *** [_module_/usr/lib/parallels-tools/kmods/prl_fs/SharedFolders/Guest/Linux/prl_fs] Error 2
make[1]: *** [all] Error 2
make: *** [compile] Error 2
Error: could not build kernel modules
Error during report about failed installation of parallels tools.
Error: failed to install Parallels Guest Tools!
2019-08-27T11:19:22+0800: execCmd: ./install --install [167]
2019-08-27T11:19:22+0800: Error: An error occurred when installing Parallels Tools. Please go to /var/log/parallels-tools-install.log for more information.
2019-08-27T11:20:01+0800: Exiting with code 1
2019-08-27T11:23:11+0800: 
  1. Mount parallels tools disk
  2. Run script bellow
    #!/usr/bin/env bash
    
    MEDIA_PATH="/media/$(whoami)/Parallels Tools"
    FIXED_PATH="/tmp/parallels_fixed"
    
    if [[ ! -d "${MEDIA_PATH}" ]]; then
        echo "Please mount parallels tools disk before install"
        exit
    fi
    echo "Copy install files to ${FIXED_PATH}"
    cp -rf "${MEDIA_PATH}" "${FIXED_PATH}"
    chmod -R 755 "${FIXED_PATH}"
    cd "${FIXED_PATH}/kmods"
    echo "Unpack prl_mod.tar.gz"
    tar -xzf prl_mod.tar.gz
    rm prl_mod.tar.gz
    echo "Patch prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c"
    sed '1i\#include <uapi/linux/mount.h>' -i prl_fs/SharedFolders/Guest/Linux/prl_fs/super.c
    echo "Repack prl_mod.tar.gz"
    tar -zcvf prl_mod.tar.gz . dkms.conf Makefile.kmods > /dev/null
    cd "${FIXED_PATH}"
    echo "Start install"
    sudo ./install
    echo "Remove ${FIXED_PATH}"
    rm -rf "${FIXED_PATH}"

Above script works on most distributions, and may broken on some others.

Check your media path, if not /media/$(whoami)/Parallels Tools, you will need to modify the script.

See @YadinF 's experience on CentOS 8. gistcomment-3902136

And if you have trouble get the script into your VM, see @Mathadon 's trick. gistcomment-4126105

@t3ll0
Copy link

t3ll0 commented Oct 4, 2019

Thank you very much i succeeded in ubuntu 18.04 19.04 and KALI Linux 2019.3

@xiaozhuai
Copy link
Author

@ t3ll0 You are welcome~

@xnianq
Copy link

xnianq commented Oct 15, 2019

老哥 你也太强了,很稳

@whlsxl
Copy link

whlsxl commented Nov 27, 2019

It worked! THX

@notDavid
Copy link

👍

@Jane42070
Copy link

THX, problem solved!

@ccravens
Copy link

Amazing!! THANK YOU! A+++++

@ymm135
Copy link

ymm135 commented Jun 30, 2021

Great!

@Uffi64
Copy link

Uffi64 commented Sep 21, 2021

Thank you so much. Worked perfect for me as well!

@YadinF
Copy link

YadinF commented Sep 23, 2021

Script doesn't work as is on CentOS 8, needs modification. Actual media path is /run/media/ and you have to hard add your username as the whoami syntax does not work. Change those two lines to a valid path and then this script will work. Of course you still have to install a bunch of things manually first because their prereq installing doesn't work. Likely because they need dkms and that's not in the normal repos so you have to add extras epel-release.
Nice job finding a fix for their broken installer. So much for a commercial solution making vms easier.

@xiaozhuai
Copy link
Author

@YadinF Thanks for your feedback! Have a good day!

@mcdonaldzachary
Copy link

Thanks bro it worked awesome. the only thing I had to change was the path to parallel tools "media/cdrom0" in a couple places

@Mathadon
Copy link

Mathadon commented Apr 8, 2022

Script doesn't work as is on CentOS 8, needs modification. Actual media path is /run/media/ and you have to hard add your username as the whoami syntax does not work. Change those two lines to a valid path and then this script will work. Of course you still have to install a bunch of things manually first because their prereq installing doesn't work. Likely because they need dkms and that's not in the normal repos so you have to add extras epel-release.
Nice job finding a fix for their broken installer. So much for a commercial solution making vms easier.

Worked for me too. I had some trouble to get the script in my VM though. Copy/paste did not work (since parallels tools is broken) and internet does not work either. Instead of manually typing the code I did the following:

  • copy the code to a .sh file in a folder
  • use disk utility to create a DVD/CDROM image of that folder (.cdr extension)
  • convert the .cdr to .iso: hdiutil makehybrid -iso -joliet -o diskimage.iso diskimage.cdr
  • mount the iso in parallels on the cd drive using Device> ..
  • copy the script form the CD
  • eject the cd
  • mount parallels tools again
  • run the script

@sergani
Copy link

sergani commented Apr 15, 2023

Thanks @xiaozhuai for the script, @YadinF for the CentOS 8 fix, and @Mathadon for the .iso trick to avoid retyping the whole thing on the VM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment