Installing Google Coral Mini PCIE Dual EdgeTPU on Fedora
Introduction#
This guide shows how to run a Google Coral Dual Edge TPU on Fedora: which adapter you need to use both TPU cores, and how to install the driver from Copr.
The Coral Dual Edge TPU is an M.2 card with two Edge Tensor Processing Units (Edge TPUs), low-power ASICs for fast machine learning inference.
Maintenance status (2026): Google has archived the Coral driver and runtime repositories on GitHub (gasket-driver, libedgetpu, pycoral), so they no longer receive updates. The driver is built with DKMS on your machine for every new kernel, so a future kernel may break it. The last build of the Copr package below is from April 2024.
Why do I need an adapter for a Dual Edge TPU?#
The Coral Dual Edge TPU is one card with two identical TPU cores. Each core has its own PCIe interface, so the M.2 slot has to provide two PCIe interfaces for both cores to work. Passive M.2 E-key to desktop PCIe adapters pass only one PCIe interface to the card, so only one TPU core works.
To use both TPUs in my system’s standard PCIe x1 slot, I got this adapter with its own PCIe switch: magic-blue-smoke/Dual-Edge-TPU-Adapter.
Why do I need to install a kernel module?#
The Coral Gasket driver makes the Coral Edge TPU usable on Linux. It contains two modules:
- Gasket: Gasket (Google ASIC Software, Kernel Extensions, and Tools) is a top-level driver for lightweight communication with Google ASICs.
- Apex: the driver for the Edge TPU v1.
The driver was added to the staging tree in Linux 4.19 and removed again in Linux 5.13, because development had stopped. Google also publishes DKMS packages for Debian-based distributions. That doesn’t help on distributions with other package formats whose kernels don’t include the driver.
The RPM/DKMS package below is based on the main branch of Google’s driver and was built for Fedora 37 and later.
Installation#
Google’s official driver sources are at google/gasket-driver, and my fork for Copr is robertzaage/gasket-driver. Releases of the fork are built and hosted on Fedora Copr.
The current build status is shown on the gasket-dkms Copr package page.
Enable the Copr repository and install the driver package:
dnf copr enable robertzaage/gasket-dkms
dnf install gasket-dkms
Check that the driver is installed and loaded:
$ lsmod | grep -E 'gasket|apex'
apex 32768 0
gasket 135168 1 apex
Now create a udev rule named e.g. 99-edgetpu-accelerator.rules in /etc/udev/rules.d and insert the following lines:
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="9302", MODE:="0666", TAG+="systemd"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1a6e", ATTRS{idProduct}=="089a", MODE:="0666", TAG+="systemd"
SUBSYSTEM=="apex", MODE:="0666", TAG+="systemd"
These rules create systemd device units for Apex and Coral USB devices; TAG+="systemd" controls this.
This is useful if you have systemd services that depend on a TPU being present.
Since I use my EdgeTPUs in containers and don’t feel like managing special user groups to access them, MODE:="0666" makes permissions a bit more open.
Then reload the udev rules:
udevadm control --reload-rules && udevadm trigger
Check that both TPUs were added as device units and appear as /dev/apex_N:
$ systemctl | grep apex
sys-devices-pci0000:00-0000:00:1c.6-0000:02:00.0-0000:03:03.0-0000:04:00.0-apex-apex_0.device loaded active plugged /sys/devices/pci0000:00/0000:00:1c.6/0000:02:00.0/0000:03:03.0/0000:04:00.0/apex/apex_0
sys-devices-pci0000:00-0000:00:1c.6-0000:02:00.0-0000:03:07.0-0000:05:00.0-apex-apex_1.device loaded active plugged /sys/devices/pci0000:00/0000:00:1c.6/0000:02:00.0/0000:03:07.0/0000:05:00.0/apex/apex_1
$ ls -la /dev/apex_*
crw-rw-rw-. 1 root root 120, 0 Dec 31 21:51 /dev/apex_0
crw-rw-rw-. 1 root root 120, 1 Dec 31 21:51 /dev/apex_1
Result#
Both TPU cores now show up as /dev/apex_0 and /dev/apex_1, and you can use the Dual Edge TPU on Fedora. 🤖
Sources#
- Google, gasket-driver (archived): https://github.com/google/gasket-driver
- Fork used for the Copr package: https://github.com/robertzaage/gasket-driver
- Copr package gasket-dkms: https://copr.fedorainfracloud.org/coprs/robertzaage/gasket-dkms/package/gasket-dkms/
- Dual Edge TPU adapter: https://github.com/magic-blue-smoke/Dual-Edge-TPU-Adapter
- Coral: https://coral.ai/