mkubecek / vmware-host-modules

Patches needed to build VMware (Player and Workstation) host modules against recent kernels
GNU General Public License v2.0
2.31k stars 374 forks source link

Can't compile modules for Fedora 40 - Kernel 6.9.7-200.fc40.x86_64 & workstaion 17.5.2 #260

Closed ZheDude closed 4 months ago

ZheDude commented 4 months ago

System:

OS: Fedora Linux 40 (KDE Plasma) x86_64
Kernel: 6.9.7-200.fc40.x86_64
Memory: 3060MiB / 13789MiB 

the first script used to work perfectly up until i updated to the kernel versions 6.9.6+ from 6.8.11

I tried running both of these Scripts i found online & in this issue -> #257 https://github.com/mkubecek/vmware-host-modules/issues/257#issuecomment-2198321399 :

Script 1:

VMWARE_VERSION=workstation-17.5.1
TMP_FOLDER=/tmp/patch-vmware
rm -fdr $TMP_FOLDER
mkdir -p $TMP_FOLDER
cd $TMP_FOLDER
git clone https://github.com/mkubecek/vmware-host-modules.git
cd $TMP_FOLDER/vmware-host-modules
git checkout $VMWARE_VERSION
git fetch
make
sudo make install
sudo rm /usr/lib/vmware/lib/libz.so.1/libz.so.1
sudo ln -s /lib/x86_64-linux-gnu/libz.so.1 /usr/lib/vmware/lib/libz.so.1/libz.so.1

#sudo mkdir -p /misc/sign-vmware-modules

#sudo chmod 777 /misc/sign-vmware-modules

cd /misc/sign-vmware-modules
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=MSI/"
chmod 600 MOK.priv

sudo mokutil --import MOK.der
sudo /misc/sign-vmware-modules/signingscript

Error Output at make:

make[2]: Entering directory '/usr/src/kernels/6.9.7-200.fc40.x86_64'
  CC [M]  /tmp/patch-vmware/vmware-host-modules/vmnet-only/driver.o
  CC [M]  /tmp/patch-vmware/vmware-host-modules/vmnet-only/hub.o
  CC [M]  /tmp/patch-vmware/vmware-host-modules/vmnet-only/userif.o
  CC [M]  /tmp/patch-vmware/vmware-host-modules/vmnet-only/netif.o
  CC [M]  /tmp/patch-vmware/vmware-host-modules/vmnet-only/bridge.o
In file included from ./include/linux/spinlock.h:305,
                 from ./include/linux/sched.h:2138,
                 from /tmp/patch-vmware/vmware-host-modules/vmnet-only/bridge.c:25:
/tmp/patch-vmware/vmware-host-modules/vmnet-only/bridge.c: In function ‘VNetBridgeReceiveFromVNet’:
/tmp/patch-vmware/vmware-host-modules/vmnet-only/vmnetInt.h:44:39: error: ‘dev_base_lock’ undeclared (first use in this function); did you mean ‘device_lock’?
   44 | #define dev_lock_list()    read_lock(&dev_base_lock)
      |                                       ^~~~~~~~~~~~~
./include/linux/rwlock.h:56:48: note: in definition of macro ‘read_lock’
   56 | #define read_lock(lock)         _raw_read_lock(lock)
      |                                                ^~~~
/tmp/patch-vmware/vmware-host-modules/vmnet-only/bridge.c:587:4: note: in expansion of macro ‘dev_lock_list’
  587 |    dev_lock_list();
      |    ^~~~~~~~~~~~~
/tmp/patch-vmware/vmware-host-modules/vmnet-only/vmnetInt.h:44:39: note: each undeclared identifier is reported only once for each function it appears in
   44 | #define dev_lock_list()    read_lock(&dev_base_lock)
      |                                       ^~~~~~~~~~~~~
./include/linux/rwlock.h:56:48: note: in definition of macro ‘read_lock’
   56 | #define read_lock(lock)         _raw_read_lock(lock)
      |                                                ^~~~
/tmp/patch-vmware/vmware-host-modules/vmnet-only/bridge.c:587:4: note: in expansion of macro ‘dev_lock_list’
  587 |    dev_lock_list();
      |    ^~~~~~~~~~~~~
/tmp/patch-vmware/vmware-host-modules/vmnet-only/bridge.c: In function ‘VNetBridgeUp’:
/tmp/patch-vmware/vmware-host-modules/vmnet-only/vmnetInt.h:44:39: error: ‘dev_base_lock’ undeclared (first use in this function); did you mean ‘device_lock’?
   44 | #define dev_lock_list()    read_lock(&dev_base_lock)
      |                                       ^~~~~~~~~~~~~
./include/linux/rwlock.h:56:48: note: in definition of macro ‘read_lock’
   56 | #define read_lock(lock)         _raw_read_lock(lock)
      |                                                ^~~~
/tmp/patch-vmware/vmware-host-modules/vmnet-only/bridge.c:902:4: note: in expansion of macro ‘dev_lock_list’
  902 |    dev_lock_list();
      |    ^~~~~~~~~~~~~
make[4]: *** [scripts/Makefile.build:244: /tmp/patch-vmware/vmware-host-modules/vmnet-only/bridge.o] Error 1
make[3]: *** [/usr/src/kernels/6.9.7-200.fc40.x86_64/Makefile:1930: /tmp/patch-vmware/vmware-host-modules/vmnet-only] Error 2
make[2]: *** [Makefile:252: __sub-make] Error 2
make[2]: Leaving directory '/usr/src/kernels/6.9.7-200.fc40.x86_64'
make[1]: *** [Makefile:117: vmnet.ko] Error 2
make[1]: Leaving directory '/tmp/patch-vmware/vmware-host-modules/vmnet-only'
make: *** [Makefile:21: vmnet-only] Error 2
[10:49:45] [mehmet@fedora] vmware-host-modules$ 

Script 2:

TMP_FOLDER=/tmp/patch-vmware
rm -fdr $TMP_FOLDER
mkdir -p $TMP_FOLDER
cd $TMP_FOLDER

git clone -b tmp/workstation-17.5.2-k6.9.1 https://github.com/nan0desu/vmware-host-modules.git
cd vmware-host-modules/
sudo make tarballs && sudo cp -v vmmon.tar vmnet.tar /usr/lib/vmware/modules/source/
sudo vmware-modconfig --console --install-all

Error Message:

Cloning into 'vmware-host-modules'...
remote: Enumerating objects: 4802, done.
remote: Counting objects: 100% (1613/1613), done.
remote: Compressing objects: 100% (283/283), done.
remote: Total 4802 (delta 1516), reused 1375 (delta 1330), pack-reused 3189
Receiving objects: 100% (4802/4802), 1.84 MiB | 1.77 MiB/s, done.
Resolving deltas: 100% (3703/3703), done.
[sudo] password for mehmet: 
git archive -o vmmon.tar --format=tar HEAD vmmon-only
git archive -o vmnet.tar --format=tar HEAD vmnet-only
'vmmon.tar' -> '/usr/lib/vmware/modules/source/vmmon.tar'
'vmnet.tar' -> '/usr/lib/vmware/modules/source/vmnet.tar'
[AppLoader] GLib does not have GSettings support.
Stopping vmware (via systemctl):                           [  OK  ]
make: Entering directory '/tmp/modconfig-D7faaz/vmmon-only'
Using kernel build system.
/usr/bin/make -C /lib/modules/6.9.7-200.fc40.x86_64/build/include/.. M=$PWD SRCROOT=$PWD/. \
  MODULEBUILDDIR= modules
make[1]: Entering directory '/usr/src/kernels/6.9.7-200.fc40.x86_64'
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/linux/driver.o
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/linux/driverLog.o
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/linux/hostif.o
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/common/apic.o
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/common/comport.o
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/common/cpuid.o
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/common/crosspage.o
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/common/memtrack.o
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/common/moduleloop.o
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/common/phystrack.o
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/common/sharedAreaVmmon.o
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/common/statVarsVmmon.o
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/common/task.o
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/common/vmx86.o
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/bootstrap/bootstrap.o
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/bootstrap/monLoader.o
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/bootstrap/monLoaderVmmon.o
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/bootstrap/vmmblob.o
  LD [M]  /tmp/modconfig-D7faaz/vmmon-only/vmmon.o
  MODPOST /tmp/modconfig-D7faaz/vmmon-only/Module.symvers
  CC [M]  /tmp/modconfig-D7faaz/vmmon-only/vmmon.mod.o
  LD [M]  /tmp/modconfig-D7faaz/vmmon-only/vmmon.ko
  BTF [M] /tmp/modconfig-D7faaz/vmmon-only/vmmon.ko
Skipping BTF generation for /tmp/modconfig-D7faaz/vmmon-only/vmmon.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/kernels/6.9.7-200.fc40.x86_64'
/usr/bin/make -C $PWD SRCROOT=$PWD/. \
  MODULEBUILDDIR= postbuild
make[1]: Entering directory '/tmp/modconfig-D7faaz/vmmon-only'
make[1]: 'postbuild' is up to date.
make[1]: Leaving directory '/tmp/modconfig-D7faaz/vmmon-only'
cp -f vmmon.ko ./../vmmon.o
make: Leaving directory '/tmp/modconfig-D7faaz/vmmon-only'
make: Entering directory '/tmp/modconfig-D7faaz/vmnet-only'
Using kernel build system.
/usr/bin/make -C /lib/modules/6.9.7-200.fc40.x86_64/build/include/.. M=$PWD SRCROOT=$PWD/. \
  MODULEBUILDDIR= modules
make[1]: Entering directory '/usr/src/kernels/6.9.7-200.fc40.x86_64'
  CC [M]  /tmp/modconfig-D7faaz/vmnet-only/driver.o
  CC [M]  /tmp/modconfig-D7faaz/vmnet-only/hub.o
  CC [M]  /tmp/modconfig-D7faaz/vmnet-only/userif.o
  CC [M]  /tmp/modconfig-D7faaz/vmnet-only/netif.o
  CC [M]  /tmp/modconfig-D7faaz/vmnet-only/bridge.o
  CC [M]  /tmp/modconfig-D7faaz/vmnet-only/procfs.o
  CC [M]  /tmp/modconfig-D7faaz/vmnet-only/smac_compat.o
  CC [M]  /tmp/modconfig-D7faaz/vmnet-only/smac.o
  CC [M]  /tmp/modconfig-D7faaz/vmnet-only/vnetEvent.o
  CC [M]  /tmp/modconfig-D7faaz/vmnet-only/vnetUserListener.o
  LD [M]  /tmp/modconfig-D7faaz/vmnet-only/vmnet.o
  MODPOST /tmp/modconfig-D7faaz/vmnet-only/Module.symvers
  CC [M]  /tmp/modconfig-D7faaz/vmnet-only/vmnet.mod.o
  LD [M]  /tmp/modconfig-D7faaz/vmnet-only/vmnet.ko
  BTF [M] /tmp/modconfig-D7faaz/vmnet-only/vmnet.ko
Skipping BTF generation for /tmp/modconfig-D7faaz/vmnet-only/vmnet.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/kernels/6.9.7-200.fc40.x86_64'
/usr/bin/make -C $PWD SRCROOT=$PWD/. \
  MODULEBUILDDIR= postbuild
make[1]: Entering directory '/tmp/modconfig-D7faaz/vmnet-only'
make[1]: 'postbuild' is up to date.
make[1]: Leaving directory '/tmp/modconfig-D7faaz/vmnet-only'
cp -f vmnet.ko ./../vmnet.o
make: Leaving directory '/tmp/modconfig-D7faaz/vmnet-only'
Starting vmware (via systemctl):  Job for vmware.service failed because the control process exited with error code.
See "systemctl status vmware.service" and "journalctl -xeu vmware.service" for details.
                                                           [FAILED]
Unable to start services
[10:54:38] [mehmet@fedora] vmware-host-modules$ 

logs:

[10:54:38] [mehmet@fedora] vmware-host-modules$ journalctl -xeu vmware.service
Jul 04 10:54:38 fedora systemd[1]: vmware.service: This usually indicates unclean termination of a previous run, or s>
Jul 04 10:54:38 fedora systemd[1]: Starting vmware.service - SYSV: This service starts and stops VMware services...
░░ Subject: A start job for unit vmware.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit vmware.service has begun execution.
░░ 
░░ The job identifier is 3982.
Jul 04 10:54:38 fedora vmware[8574]: Starting VMware services:
Jul 04 10:54:38 fedora vmware[8574]:    Virtual machine monitor[FAILED]
Jul 04 10:54:38 fedora vmware[8574]:    Virtual machine communication interface[  OK  ]
Jul 04 10:54:38 fedora vmware[8574]:    VM communication interface socket family[  OK  ]
Jul 04 10:54:38 fedora vmware[8574]:    Virtual ethernet[FAILED]
Jul 04 10:54:38 fedora vmware[8574]:    VMware Authentication Daemon[  OK  ]
Jul 04 10:54:38 fedora systemd[1]: vmware.service: Control process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ An ExecStart= process belonging to unit vmware.service has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 1.
Jul 04 10:54:38 fedora systemd[1]: vmware.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ The unit vmware.service has entered the 'failed' state with result 'exit-code'.
Jul 04 10:54:38 fedora systemd[1]: vmware.service: Unit process 1091 (vmware-authdlau) remains running after unit sto>
Jul 04 10:54:38 fedora systemd[1]: vmware.service: Unit process 8611 (vmware-authdlau) remains running after unit sto>
Jul 04 10:54:38 fedora systemd[1]: vmware.service: Unit process 8612 (logger) remains running after unit stopped.
Jul 04 10:54:38 fedora systemd[1]: vmware.service: Unit process 8615 (sh) remains running after unit stopped.
Jul 04 10:54:38 fedora systemd[1]: vmware.service: Unit process 8617 (sh) remains running after unit stopped.
Jul 04 10:54:38 fedora systemd[1]: Failed to start vmware.service - SYSV: This service starts and stops VMware servic>
░░ Subject: A start job for unit vmware.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit vmware.service has finished with a failure.
░░ 
░░ The job identifier is 3982 and the job result is failed.
ZheDude commented 4 months ago

fixed the issue after using my brain for a little while. going to close this now

the fix:

TMP_FOLDER=/tmp/patch-vmware
rm -fdr $TMP_FOLDER
mkdir -p $TMP_FOLDER
cd $TMP_FOLDER

git clone -b tmp/workstation-17.5.2-k6.9.1 https://github.com/nan0desu/vmware-host-modules.git
cd vmware-host-modules/

make
sudo make install
sudo rm /usr/lib/vmware/lib/libz.so.1/libz.so.1
sudo ln -s /lib/x86_64-linux-gnu/libz.so.1 /usr/lib/vmware/lib/libz.so.1/libz.so.1

#sudo mkdir -p /misc/sign-vmware-modules

#sudo chmod 777 /misc/sign-vmware-modules

cd /misc/sign-vmware-modules
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=MSI/"
chmod 600 MOK.priv

sudo mokutil --import MOK.der
sudo /misc/sign-vmware-modules/signingscript

signingscript:

#!/bin/bash
for modfile in $(modinfo -n vmmon vmnet); do
  echo "Signing $modfile"
  /usr/src/kernels/$(uname -r)/scripts/sign-file sha256 \
                                /misc/sign-vmware-modules/MOK.priv \
                                /misc/sign-vmware-modules/MOK.der "$modfile"
done