google-coral / edgetpu

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

Cannot install gasket-dkms on Xubuntu 24.04.1 LTS #866

Open mark-hingston opened 2 months ago

mark-hingston commented 2 months ago

Description

Following the instructions here: https://coral.ai/docs/m2/get-started/#2-install-the-pcie-driver-and-edge-tpu-runtime

The install of the PCIe driver is failing:

$ sudo apt-get install gasket-dkms libedgetpu1-std
Removing old gasket-1.0 DKMS files...
Deleting module gasket-1.0 completely from the DKMS tree.
Loading new gasket-1.0 DKMS files...
Deprecated feature: REMAKE_INITRD (/usr/src/gasket-1.0/dkms.conf)
Building for 6.8.0-44-generic
Building initial module for 6.8.0-44-generic
Deprecated feature: REMAKE_INITRD (/var/lib/dkms/gasket/1.0/source/dkms.conf)
Error! Bad return status for module build on kernel: 6.8.0-44-generic (x86_64)
Consult /var/lib/dkms/gasket/1.0/build/make.log for more information.
dpkg: error processing package gasket-dkms (--configure):
 installed gasket-dkms package post-installation script subprocess returned error exit status 10
Errors were encountered while processing:
 gasket-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)
DKMS make.log for gasket-1.0 for kernel 6.8.0-44-generic (x86_64)
Thu Sep 12 09:24:06 AM BST 2024
make: Entering directory '/usr/src/linux-headers-6.8.0-44-generic'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-13 (Ubuntu 13.2.0-23ubuntu4) 13.2.0
  You are using:           gcc-13 (Ubuntu 13.2.0-23ubuntu4) 13.2.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
/var/lib/dkms/gasket/1.0/build/gasket_interrupt.c: In function ‘gasket_handle_interrupt’:
/var/lib/dkms/gasket/1.0/build/gasket_interrupt.c:161:17: error: too many arguments to function ‘eventfd_signal’
  161 |                 eventfd_signal(ctx, 1);
      |                 ^~~~~~~~~~~~~~
In file included from /var/lib/dkms/gasket/1.0/build/gasket_interrupt.h:11,
                 from /var/lib/dkms/gasket/1.0/build/gasket_interrupt.c:4:
./include/linux/eventfd.h:87:20: note: declared here
   87 | static inline void eventfd_signal(struct eventfd_ctx *ctx)
      |                    ^~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:243: /var/lib/dkms/gasket/1.0/build/gasket_interrupt.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/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:228:54: note: expected ‘const char *’ but argument is of type ‘struct module *’
  228 | 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:228:29: note: declared here
  228 | struct class * __must_check class_create(const char *name);
      |                             ^~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:243: /var/lib/dkms/gasket/1.0/build/gasket_core.o] Error 1
make[1]: *** [/usr/src/linux-headers-6.8.0-44-generic/Makefile:1925: /var/lib/dkms/gasket/1.0/build] Error 2
make: *** [Makefile:240: __sub-make] Error 2
make: Leaving directory '/usr/src/linux-headers-6.8.0-44-generic'

I've tried building the driver myself but am still having issues:

$ git clone https://github.com/google/gasket-driver.git
$ cd gasket-driver
$ debuild -us -uc -tc -b
dpkg-buildpackage: info: source package gasket-dkms
dpkg-buildpackage: info: source version 1.0-18
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Coral <coral-support@google.com>
 dpkg-source --before-build .
dpkg-buildpackage: info: host architecture amd64
 fakeroot debian/rules clean
dh clean --with dkms
   dh_clean
 debian/rules build
dh build --with dkms
   dh_update_autotools_config
   dh_autoreconf
   create-stamp debian/debhelper-build-stamp
 fakeroot debian/rules binary
dh binary --with dkms
   dh_testroot
   dh_prep
   debian/rules override_dh_install
make[1]: Entering directory '/home/mark/Downloads/gasket-driver'
dh_install src/* usr/src/gasket-1.0/
make[1]: Leaving directory '/home/mark/Downloads/gasket-driver'
   dh_installdocs
   dh_installchangelogs
   debian/rules override_dh_dkms
make[1]: Entering directory '/home/mark/Downloads/gasket-driver'
dh_dkms -V 1.0
make[1]: Leaving directory '/home/mark/Downloads/gasket-driver'
   dh_installudev
   dh_perl
   dh_link
   dh_strip_nondeterminism
   dh_compress
   dh_fixperms
   dh_missing
   dh_installdeb
   dh_gencontrol
   dh_md5sums
   dh_builddeb
dpkg-deb: building package 'gasket-dkms' in '../gasket-dkms_1.0-18_all.deb'.
 dpkg-genbuildinfo --build=binary -O../gasket-dkms_1.0-18_amd64.buildinfo
 dpkg-genchanges --build=binary -O../gasket-dkms_1.0-18_amd64.changes
dpkg-genchanges: info: binary-only upload (no source code included)
 fakeroot debian/rules clean
dh clean --with dkms
   dh_clean
 dpkg-source --after-build .
dpkg-buildpackage: info: binary-only upload (no source included)
Now running lintian gasket-dkms_1.0-18_amd64.changes ...
E: gasket-dkms changes: bad-distribution-in-changes-file unstable
Finished running lintian.
Click to expand! ### Issue Type Bug, Build/Install ### Operating System Ubuntu ### Coral Device M.2 Accelerator B+M ### Other Devices _No response_ ### Programming Language Python 3.9 ### Relevant Log Output _No response_
JagdSeelen commented 2 months ago

I'm having the exact same problem when trying to install with Ubuntu 24.04.1 LTS

Did you ever get this problem solved?

MrGoodbits commented 1 month ago

Same issue... same question.

Thanks.

JagdSeelen commented 1 month ago

I finally got mine working following the below list of commands

    uname -r

    lsmod | grep apex

    echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list

    curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

    apt-get update

    apt-get install gasket-dkms libedgetpu1-std -y

    sh -c "echo 'SUBSYSTEM==\"apex\", MODE=\"0660\", GROUP=\"apex\"' >> /etc/udev/rules.d/65-apex.rules"

    groupadd apex

    adduser $USER apex

    reboot

    lspci -nn | grep 089a

    apt install pve-headers-$(uname -r)

    apt install proxmox-default-headers -y

    apt install dh-dkms devscripts git -y

    git clone  https://github.com/google/gasket-driver

    cd gasket-driver

    debuild -us -uc -tc -b -d

    cd ..

    dpkg -i gasket-dkms_1.0-18_all.deb

    reboot

    ls /dev/apex*
ryand11 commented 1 month ago

Same issue; Unable install via apt, unable to build from source.

Kernel: 6.8.0-45-generic OS: Ubuntu 24.04.1 LTS TPU Device: Coral M2

madman2012 commented 1 month ago

Same issue same problem. USB. Noble.

djieno commented 1 month ago

Got it working :) see below if that might help for your TPU Device:

LT;DR

echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - ; sudo apt update

sudo apt install dh-dkms gasket-dkms libedgetpu1-std devscripts git debhelper -y #prolly redundant packages
git clone  https://github.com/google/gasket-driver; cd gasket-driver
debuild -us -uc -tc -b -d

sudo sh -c "echo 'SUBSYSTEM==\"apex\", MODE=\"0660\", GROUP=\"apex\"' >> /etc/udev/rules.d/65-apex.rules"
sudo groupadd apex
sudo adduser $USER apex

after a reboot or 'modprobe -a gasket':
ls /dev/apex_0
/dev/apex_0

lspci -nn | grep 089a: 05:00.0 System peripheral [0880]: Global Unichip Corp. Coral Edge TPU [1ac1:089a]

lsb_release -a: No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 24.04.1 LTS Release: 24.04 Codename: noble

uname -a: Linux node02 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

######## Longer version:

git clone https://github.com/google/gasket-driver; cd gasket-driver

/gasket/gasket-driver$ debuild -us -uc -tc -b -d
 dpkg-buildpackage -us -uc -ui -tc -b -d
dpkg-buildpackage: info: source package gasket-dkms
dpkg-buildpackage: info: source version 1.0-18
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Coral <coral-support@google.com>
 dpkg-source --before-build .
dpkg-buildpackage: info: host architecture amd64
 fakeroot debian/rules clean
**dh clean --with dkms**
make: dh: No such file or directory
make: *** [debian/rules:6: clean] Error 127
dpkg-buildpackage: error: fakeroot debian/rules clean subprocess returned exit status 2
debuild: fatal error at line 1184:
dpkg-buildpackage -us -uc -ui -tc -b -d failed

debhelper was missing: sudo apt install debhelper it created the 'gasket-dkms_1.0-18_all.deb'

debuild -us -uc -tc -b -d
 dpkg-buildpackage -us -uc -ui -tc -b -d
dpkg-buildpackage: info: source package gasket-dkms
dpkg-buildpackage: info: source version 1.0-18
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Coral <coral-support@google.com>
 dpkg-source --before-build .
dpkg-buildpackage: info: host architecture amd64
 fakeroot debian/rules clean
dh clean --with dkms
   dh_clean
 debian/rules build
dh build --with dkms
   dh_update_autotools_config
   dh_autoreconf
   create-stamp debian/debhelper-build-stamp
 fakeroot debian/rules binary
dh binary --with dkms
   dh_testroot
   dh_prep
   debian/rules override_dh_install
make[1]: Entering directory '/home/ubuntu/gasket/gasket-driver'
dh_install src/* usr/src/gasket-1.0/
make[1]: Leaving directory '/home/ubuntu/gasket/gasket-driver'
   dh_installdocs
   dh_installchangelogs
   debian/rules override_dh_dkms
make[1]: Entering directory '/home/ubuntu/gasket/gasket-driver'
dh_dkms -V 1.0
make[1]: Leaving directory '/home/ubuntu/gasket/gasket-driver'
   dh_installudev
   dh_perl
   dh_link
   dh_strip_nondeterminism
   dh_compress
   dh_fixperms
   dh_missing
   dh_installdeb
   dh_gencontrol
   dh_md5sums
   dh_builddeb
dpkg-deb: building package 'gasket-dkms' in '../gasket-dkms_1.0-18_all.deb'.
 dpkg-genbuildinfo --build=binary -O../gasket-dkms_1.0-18_amd64.buildinfo
 dpkg-genchanges --build=binary -O../gasket-dkms_1.0-18_amd64.changes
dpkg-genchanges: info: binary-only upload (no source code included)
 fakeroot debian/rules clean
dh clean --with dkms
   dh_clean
 dpkg-source --after-build .
dpkg-buildpackage: info: binary-only upload (no source included)
Now running lintian gasket-dkms_1.0-18_amd64.changes ...
E: gasket-dkms changes: bad-distribution-in-changes-file unstable
Finished running lintian.

sudo dpkg -i ../gasket-dkms_1.0-18_all.deb

(Reading database ... 169151 files and directories currently installed.)
Preparing to unpack gasket-dkms_1.0-18_all.deb ...
Deleting module gasket-1.0 completely from the DKMS tree.
Unpacking gasket-dkms (1.0-18) over (1.0-18) ...
Setting up gasket-dkms (1.0-18) ...
Loading new gasket-1.0 DKMS files...
Deprecated feature: REMAKE_INITRD (/usr/src/gasket-1.0/dkms.conf)
Building for 6.8.0-45-generic 6.8.0-47-generic
Building initial module for 6.8.0-45-generic
Deprecated feature: REMAKE_INITRD (/var/lib/dkms/gasket/1.0/source/dkms.conf)
Done.
Deprecated feature: REMAKE_INITRD (/var/lib/dkms/gasket/1.0/source/dkms.conf)
Deprecated feature: REMAKE_INITRD (/var/lib/dkms/gasket/1.0/source/dkms.conf)

gasket.ko.zst:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.8.0-45-generic/updates/dkms/

apex.ko.zst:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.8.0-45-generic/updates/dkms/
depmod...
Building initial module for 6.8.0-47-generic
Deprecated feature: REMAKE_INITRD (/var/lib/dkms/gasket/1.0/source/dkms.conf)
Done.
Deprecated feature: REMAKE_INITRD (/var/lib/dkms/gasket/1.0/source/dkms.conf)
Deprecated feature: REMAKE_INITRD (/var/lib/dkms/gasket/1.0/source/dkms.conf)

gasket.ko.zst:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.8.0-47-generic/updates/dkms/

apex.ko.zst:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.8.0-47-generic/updates/dkms/
depmod...

sudo sh -c "echo 'SUBSYSTEM==\"apex\", MODE=\"0660\", GROUP=\"apex\"' >> /etc/udev/rules.d/65-apex.rules" sudo groupadd apex sudo adduser $USER apex

after a reboot or 'modprobe -a gasket':

ubuntu@node02:~$ id
uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),110(lxd),119(docker),1001(apex)
ubuntu@node02:~$ ls /dev/apex_0
/dev/apex_0
ubuntu@node02:~$ modinfo gasket
filename:       /lib/modules/6.8.0-45-generic/updates/dkms/gasket.ko.zst
author:         Rob Springer <rspringer@google.com>
license:        GPL v2
version:        1.1.4
description:    Google Gasket driver framework
import_ns:      DMA_BUF
srcversion:     584E4F871D5CD164F02B2D2
depends:        
retpoline:      Y
name:           gasket
vermagic:       6.8.0-45-generic SMP preempt mod_unload modversions 
sig_id:         PKCS#7
signer:         node02 Secure Boot Module Signature key
sig_key:        3C:0E:1B:C2:50:C6:0F:F5:FE:3F:FC:10:70:9F:AC:C5:8F:FA:B2:54
sig_hashalgo:   sha512
signature:      C1:43:D6:7A:4F:72:07:49:14:3C:F7:01:57:88:A6:4B:BB:62:B3:63:
        32:7B:7B:FB:AC:A7:70:33:BA:18:63:30:74:B7:43:74:87:7E:59:11:
<snipped>
        70:4F:AD:9F:89:1A:2C:28:59:A2:28:68:6E:0C:49:DE:33:D6:FD:81:
<snipped>
        BD:F1:8A:BE:C4:B6:44:D7:85:43:25:AA:CF:1F:52:B7:B8:97:BF:37:
        21:59:D3:92:7F:D0:BF:D9:0C:DD:D1:9B:A4:81:4A:03
parm:           dma_bit_mask:int

TEST if it actually works!

cat > Dockerfile << EOF FROM debian:10

WORKDIR /home ENV HOME /home RUN cd ~ RUN apt-get update RUN apt-get install -y git nano python3-pip python-dev pkg-config wget usbutils curl

RUN echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" \ | tee /etc/apt/sources.list.d/coral-edgetpu.list RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - RUN apt-get update RUN apt-get install -y edgetpu-examples EOF

docker build -t "coral" .

docker run -it --device /dev/apex_0:/dev/apex_0 coral /bin/bash

INYOURCONTAINER python3 /usr/share/edgetpu/examples/classify_image.py --model /usr/share/edgetpu/examples/models/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite --label /usr/share/edgetpu/examples/models/inat_bird_labels.txt --image /usr/share/edgetpu/examples/images/bird.bmp
---------------------------
Poecile atricapillus (Black-capped Chickadee)
Score :  0.44140625
---------------------------
Poecile carolinensis (Carolina Chickadee)
Score :  0.29296875