google-coral / edgetpu

Coral issue tracker (and legacy Edge TPU API source)
https://coral.ai
Apache License 2.0
410 stars 124 forks source link

Install gasket-dkms not supported on Linux kernel 6.0 #695

Open lamosty opened 1 year ago

lamosty commented 1 year ago

Description

Hi. Recently, I've built a PC with the newest Intel 13th gen CPU and Ubuntu 22.04. I had to switch to Linux kernel 6 for proper CPU and iGPU support.

Following the Get started m.2 guide, I was unable to install or build gasket-dkms. I tried to follow the steps from this issue but the result is that it's unsupported:

sudo dpkg -i *.deb
Selecting previously unselected package gasket-dkms.
(Reading database ... 266328 files and directories currently installed.)
Preparing to unpack gasket-dkms_1.0-18_all.deb ...
Unpacking gasket-dkms (1.0-18) ...
Setting up gasket-dkms (1.0-18) ...
Loading new gasket-1.0 DKMS files...
Building for 6.0.9-060009-generic
Building initial module for 6.0.9-060009-generic
ERROR (dkms apport): kernel package linux-headers-6.0.9-060009-generic is not supported
Error! Bad return status for module build on kernel: 6.0.9-060009-generic (x86_64)
Consult /var/lib/dkms/gasket/1.0/build/make.log for more information.
dpkg: error processing package gasket-dkms (--install):
 installed gasket-dkms package post-installation script subprocess returned error exit status 10
Errors were encountered while processing:
 gasket-dkms

Could you please update the gasket-driver to support Linux kernel 6?

Click to expand! ### Issue Type Build/Install ### Operating System Ubuntu ### Coral Device _No response_ ### Other Devices _No response_ ### Programming Language _No response_ ### Relevant Log Output _No response_
hjonnala commented 1 year ago

Hi @lamosty can you please share the gasker-driver build logs with Linux Kernel 6.

sigxcpu76 commented 11 months ago
Wed Jul 26 01:37:04 PM EEST 2023
make: Entering directory '/usr/src/linux-headers-6.4.5-x64v4-xanmod1'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc-12 (Debian 12.3.0-5~bpo12+1) 12.3.0
  You are using:           gcc (Ubuntu 12.1.0-2ubuntu1~22.04) 12.1.0
  CC [M]  /var/lib/dkms/gasket/1.0/build/gasket_core.o
  CC [M]  /var/lib/dkms/gasket/1.0/build/gasket_ioctl.o
  CC [M]  /var/lib/dkms/gasket/1.0/build/gasket_interrupt.o
  CC [M]  /var/lib/dkms/gasket/1.0/build/gasket_page_table.o
  CC [M]  /var/lib/dkms/gasket/1.0/build/gasket_sysfs.o
  CC [M]  /var/lib/dkms/gasket/1.0/build/apex_driver.o
/var/lib/dkms/gasket/1.0/build/gasket_core.c: In function ‘gasket_register_device’:
/var/lib/dkms/gasket/1.0/build/gasket_core.c:1841:41: error: passing argument 1 of ‘class_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
 1841 |                 class_create(driver_desc->module, driver_desc->name);
      |                              ~~~~~~~~~~~^~~~~~~~
      |                                         |
      |                                         struct module *
In file included from ./include/linux/device.h:31,
                 from ./include/linux/cdev.h:8,
                 from /var/lib/dkms/gasket/1.0/build/gasket_core.h:11,
                 from /var/lib/dkms/gasket/1.0/build/gasket_core.c:12:
./include/linux/device/class.h:230:54: note: expected ‘const char *’ but argument is of type ‘struct module *’
  230 | struct class * __must_check class_create(const char *name);
      |                                          ~~~~~~~~~~~~^~~~
/var/lib/dkms/gasket/1.0/build/gasket_core.c:1841:17: error: too many arguments to function ‘class_create’
 1841 |                 class_create(driver_desc->module, driver_desc->name);
      |                 ^~~~~~~~~~~~
./include/linux/device/class.h:230:29: note: declared here
  230 | struct class * __must_check class_create(const char *name);
      |                             ^~~~~~~~~~~~
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:252: /var/lib/dkms/gasket/1.0/build/gasket_core.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:2187: /var/lib/dkms/gasket/1.0/build] Error 2
make: Leaving directory '/usr/src/linux-headers-6.4.5-x64v4-xanmod1'
bawachhe commented 9 months ago

According to sources around the internet, it's kernel 6.4 specifically that causes this issue. From the ArchLinux AUR, someone had success simply changing this class_create function call to use one param as specified, so I guess the fix has to determine which kernel version gasket-dkms is being compiled on?

pgenera commented 9 months ago

I've simply changed the call to only use the second param and things are working fine. That unblocks me, I'm happy.

grigio commented 8 months ago

I thinks it's the same bug I had to pin the linux kernel 6.1.0-11-amd64 in Debian 12 stable because the current linux-image-amd64 6.1.0-13-amd64 is broken with gasket

arigit commented 8 months ago

Same issue with kernel 6.5, and couldn't get the apex driver to work. Disappointed with the lack of support for the edge tpu with newer kernels

dewet22 commented 7 months ago

This was fixed a few months ago in https://github.com/google/gasket-driver/ already; for my use case I just built the .deb from that repo directly and deployed across my Coral-bearing machines.

felixc commented 7 months ago

Glad to see that a fix exists! Is there an update schedule or policy for when we might see this new version added to the https://packages.cloud.google.com/apt coral-edgetpu-stable repository?

grigio commented 7 months ago

for me this bug is fixed

Debian 12 / Linux 6.1.55-1 (2023-09-29) x86_64 GNU/Linux

Check to have all the repo enabled

cat /etc/apt/sources.list
deb http://deb.debian.org/debian stable  main contrib non-free-firmware non-free
deb http://deb.debian.org/debian stable-updates main contrib non-free-firmware non-free 
deb http://security.debian.org/debian-security/ stable-security main non-free-firmware non-free contrib
kub3let commented 2 months ago

For anyone coming here this is broken again in Kernel >=6.8, Proxmox is shipping with kernel 6.8.2 since today.

Working patch is available in https://github.com/google/gasket-driver/pull/26 but not merged yet.

CraigeryTheKid commented 1 month ago

For anyone coming here this is broken again in Kernel >=6.8, Proxmox is shipping with kernel 6.8.2 since today.

Working patch is available in google/gasket-driver#26 but not merged yet.

[deleted self-deprecating comment about not being smart enough for linux... it still might be true but see Edit-2]

Edit-1: also, to add to the confusion: it looks like the fix in pull 26 was merged. But only on git source? So official repo "https://packages.cloud.google.com/apt" is not the same team/code as "https://github.com/google/gasket-driver" ?

Edit-2: kept following the links above, led me to this : Build Driver; and it appears to have worked. No errors following the entire link, and final grep check shows the apex device.