PCAN DKMS Ubuntu Jammy HWE Kernel Issue

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
mrroboto
Posts: 4
Joined: Thu 23. May 2024, 22:15

PCAN DKMS Ubuntu Jammy HWE Kernel Issue

Post by mrroboto » Thu 23. May 2024, 22:25

I'm looking at an issue where DKMS driver isn't installed after a new HWE kernel has been installed. It seems to be working with the default kernel however.

Below is using a test system, but on production system, we have other DKMS drivers and they don't exhibit this issue.

Steps to reproduce (ensure to start with a system with older kernel):

Code: Select all

ubuntu@jammy-build01:~/peak-linux-driver-8.18.0$ make CC=gcc-12 NET=NETDEV_SUPPORT ISA=NO_ISA_SUPPORT PCC=NO_PCCARD_SUPPORT PCIEC=NO_PCIEC_SUPPORT DKMS=DKMS_SUPPORT

ubuntu@jammy-build01:~/peak-linux-driver-8.18.0$ sudo make CC=gcc-12 install_with_dkms

ubuntu@jammy-build01:~/peak-linux-driver-8.18.0$ dkms status
peak-linux-driver/8.18.0, 6.5.0-28-generic, x86_64: installed

ubuntu@jammy-build01:~/peak-linux-driver-8.18.0$ sudo apt update && sudo apt upgrade

ubuntu@jammy-build01:~/peak-linux-driver-8.18.0$ dkms status
peak-linux-driver/8.18.0, 5.15.0-107-generic, x86_64: installed
peak-linux-driver/8.18.0, 6.5.0-28-generic, x86_64: installed
After reboot:

Code: Select all

ubuntu@jammy-build01:~$ uname -a
Linux jammy-build01 6.5.0-35-generic #35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May  7 09:00:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

ubuntu@jammy-build01:~$ dkms status
peak-linux-driver/8.18.0, 5.15.0-107-generic, x86_64: installed
peak-linux-driver/8.18.0, 6.5.0-28-generic, x86_64: installed

ubuntu@jammy-build01:~$ lsmod |grep pcan

ubuntu@jammy-build01:~$ modprobe pcan
modprobe: ERROR: ../libkmod/libkmod-module.c:838 kmod_module_insert_module() could not find module by name='pcan'
modprobe: ERROR: could not insert 'pcan': Unknown symbol in module, or unknown parameter (see dmesg)
modprobe: ERROR: ../libkmod/libkmod-module.c:990 command_do() Error running install command 'modprobe --ignore-install pcan' for module pcan: retcode 1
modprobe: ERROR: could not insert 'pcan': Invalid argument
It looks as if kernel 6.5.0-35 was completely ignored:

Code: Select all

root@jammy-build01:/var/lib/dkms/peak-linux-driver# ls *
8.18.0:
5.15.0-107-generic  6.5.0-28-generic  build  source

kernel-5.15.0-107-generic-x86_64:
log  module

kernel-6.5.0-28-generic-x86_64:
log  module

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: PCAN DKMS Ubuntu Jammy HWE Kernel Issue

Post by M.Heidemann » Fri 24. May 2024, 13:04

Hi,

please check the following:

Is dkms up to date?

Are the kernel headers for kernel 6.5.0-35 present?

Please let us know.
---
Marvin Heidemann
PEAK-Support Team

mrroboto
Posts: 4
Joined: Thu 23. May 2024, 22:15

Re: PCAN DKMS Ubuntu Jammy HWE Kernel Issue

Post by mrroboto » Fri 24. May 2024, 17:43

dkms is up to date as far as I can tell. Kernel headers are installed and looks like dkms is called when installing the new headers package. I looked back at apt upgrade logs and found the following. Looks like there's an error processing the module for the HWE kernel but not the updated standard kernel.

Code: Select all

Setting up linux-headers-6.5.0-35-generic (6.5.0-35.35~22.04.1) ...
/etc/kernel/header_postinst.d/dkms:
 * dkms: running auto installation service for kernel 6.5.0-35-generic

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...
make -j32 KERNELRELEASE=6.5.0-35-generic DKMS_KERNEL_DIR=/lib/modules/6.5.0-35-generic/build MOD=MODVERSIONS PAR=NO_PARPORT_SUBSYSTEM USB=USB_SUPPORT PCI=PCI_SUPPORT PCIEC=NO_PCIEC_SUPPORT ISA=NO_ISA_SUPPORT DNG=NO_DONGLE_SUPPORT PCC=NO_PCCARD_SUPPORT NET=NETDEV_SUPPORT RT=NO_RT...(bad exit status: 2)
ERROR (dkms apport): binary package for peak-linux-driver: 8.18.0 not found
Error! Bad return status for module build on kernel: 6.5.0-35-generic (x86_64)
Consult /var/lib/dkms/peak-linux-driver/8.18.0/build/make.log for more information.
   ...done.
Setting up linux-modules-6.5.0-35-generic (6.5.0-35.35~22.04.1) ...
Setting up linux-headers-generic-hwe-22.04 (6.5.0.35.35~22.04.1) ...
Setting up ubuntu-pro-client (31.2.3~22.04) ...
Setting up ubuntu-pro-client-l10n (31.2.3~22.04) ...
Setting up linux-headers-5.15.0-107-generic (5.15.0-107.117) ...
/etc/kernel/header_postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.15.0-107-generic

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...
make -j32 KERNELRELEASE=5.15.0-107-generic DKMS_KERNEL_DIR=/lib/modules/5.15.0-107-generic/build MOD=MODVERSIONS PAR=NO_PARPORT_SUBSYSTEM USB=USB_SUPPORT PCI=PCI_SUPPORT PCIEC=NO_PCIEC_SUPPORT ISA=NO_ISA_SUPPORT DNG=NO_DONGLE_SUPPORT PCC=NO_PCCARD_SUPPORT NET=NETDEV_SUPPORT RT=NO_RT........
cleaning build area...

pcan.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.15.0-107-generic/updates/dkms/

depmod...
   ...done.

mrroboto
Posts: 4
Joined: Thu 23. May 2024, 22:15

Re: PCAN DKMS Ubuntu Jammy HWE Kernel Issue

Post by mrroboto » Fri 24. May 2024, 19:31

Looks like the issue is gcc version mismatch. It's essentially the same GCC version and package but was using the symlink, which would be better for us as we have ARM systems in the pipeline. I'll see if I can make this work properly for with a workaround to our scripting and report back.

Code: Select all

DKMS make.log for peak-linux-driver-8.18.0 for kernel 6.5.0-35-generic (x86_64)
Fri May 24 05:18:09 PM UTC 2024
***
*** Making pcan driver in netdev mode
***
*** Host OS Release=Ubuntu v22.04
*** Host machine kernel version=6.5.0-35-generic
*** Driver kernel version=6.5.0-35-generic (6.5.0)
*** Path to kernel sources=/lib/modules/6.5.0-35-generic/build
*** use KBUILD=yes
*** use DKMS=
*** gcc version=11
***
make -C /lib/modules/6.5.0-35-generic/build  EXTRA_CFLAGS="-I/var/lib/dkms/peak-linux-driver/8.18.0/build -DNO_DEBUG -DMODVERSIONS -DNO_PARPORT_SUBSYSTEM -DUSB_SUPPORT -DPCI_SUPPORT -DNO_PCIEC_SUPPORT -DNO_ISA_SUPPORT -DNO_DONGLE_SUPPORT -DNO_PCCARD_SUPPORT -DNETDEV_SUPPORT -DNO_RT   -Wno-date-time" V=0 modules M=/var/lib/dkms/peak-linux-driver/8.18.0/build
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[1]: Entering directory '/usr/src/linux-headers-6.5.0-35-generic'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
  You are using:           gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
  CC [M]  /var/lib/dkms/peak-linux-driver/8.18.0/build/src/pcan_main.o
gcc: error: unrecognized command-line option ‘-ftrivial-auto-var-init=zero’
make[3]: *** [scripts/Makefile.build:251: /var/lib/dkms/peak-linux-driver/8.18.0/build/src/pcan_main.o] Error 1
make[2]: *** [/usr/src/linux-headers-6.5.0-35-generic/Makefile:2039: /var/lib/dkms/peak-linux-driver/8.18.0/build] Error 2
make[1]: *** [Makefile:234: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.5.0-35-generic'
make: *** [Makefile:523: all] Error 2

Code: Select all

root@jammy-build01:/var/lib/dkms/peak-linux-driver# ls -la /usr/bin/gcc-12
lrwxrwxrwx 1 root root 23 May 13  2023 /usr/bin/gcc-12 -> x86_64-linux-gnu-gcc-12

mrroboto
Posts: 4
Joined: Thu 23. May 2024, 22:15

Re: PCAN DKMS Ubuntu Jammy HWE Kernel Issue

Post by mrroboto » Fri 24. May 2024, 20:54

Unfortunately specifying "CC=x86_64-linux-gnu-gcc-12" in the make command does not resolve this as I had hoped.

It would appear that since the Makefile specifies CC=gcc, that it's actually not an issue of gcc-12 vs x86_64-linux-gnu-gcc-12 but rather in the log, we can see

Code: Select all

gcc version=11
even though it also says

Code: Select all

You are using:           gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
Once I change 'gcc' to 'gcc-12' in

Code: Select all

/var/lib/dkms/peak-linux-driver/8.17.0/source/Makefile
, I was able to successfully get DKMS to build the module for 6.5.0 kernel.

I just checked what would happen if I remove 'CC=gcc' from that same Makefile and looks like it works for all kernels installed. It looks like this Makefile is just a symlink back to where I did the original install, so looks like my workaround is to comment these out until it is fixed in a future release.

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: PCAN DKMS Ubuntu Jammy HWE Kernel Issue

Post by M.Heidemann » Mon 27. May 2024, 11:08

Hi,

Thanks for being so transparent with us on how you were able to resolve this
on your config. I'll relay this to our Linux Development Team for consideration.

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

Post Reply