Google Coral TPU support

nautilus7

Dabbler
Joined
Jan 23, 2023
Messages
15
Frigate 0.12 which is not yet available from Truecharts, is supposed to allow you to edit the configuration from inside the webui of frigate.
 
Joined
Aug 3, 2015
Messages
6
I have gotten a PCIe Coral TPU working with a TrueCharts Frigate app. I used the script above to install the drivers by ssh'ing into the TrueNAS server. In order for the Frigate app to use the TPU I had to check the "Show Advanced Security Settings" and then check "Privileged Mode" and "Allow Privilege Escalation".
 

jetskiz

Cadet
Joined
Jun 18, 2023
Messages
2
I just did a fresh install with 22.12.3 and was getting an error "Could not exec dpkg!" when running the script. I ran this command then reran the scrip and everything worked. I just wanted to post this for the next person to save them the aggravation I had.
chmod +x /usr/bin/dpkg*
 

The_Saver

Dabbler
Joined
Mar 13, 2022
Messages
31
I just did a fresh install with 22.12.3 and was getting an error "Could not exec dpkg!" when running the script. I ran this command then reran the scrip and everything worked. I just wanted to post this for the next person to save them the aggravation I had.
Thank you! This worked and fixed my error message which I am posting below so that people searching for this error can hopefully find it:

Code:
Could not exec dpkg!
E: Sub-process /usr/bin/dpkg returned an error code (100)
 

jaharmi

Cadet
Joined
Apr 25, 2019
Messages
5
I've been trying to get this working on TrueNAS SCALE v22.12.2 and then v22.12.3.1. Some notes so far:
  • I had to run `chmod +x /usr/bin/dpkg` on 22.12.3.1. Until I did that, I got `Could not exec dpkg!` errors with `apt-get install`.
  • I had to specify the path with `/usr/sbin/modinfo apex` on 22.12.3.1. Otherwise, I got `zsh: command not found: modprobe`.
  • I saw the Frigate TPUs with `lspci` before and after installing the drivers.
  • I have not rebooted TrueNAS, and don't know if that is necessary.
  • I am trying to install the TrueCharts Frigate Incubator app. I am not sure how to / do not see a way to Add Device here. I feel like I had seen something like this somewhere in TrueNAS before, but cannot find it as of 22.12.2/22.12.3.1.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
  • I had to run `chmod +x /usr/bin/dpkg` on 22.12.3.1. Until I did that, I got `Could not exec dpkg!` errors with `apt-get install`.

Just a reminder that you are not supposed to be modifying the base operating system. You run various risks of broken stuff in the future. The execute bit was DELIBERATELY removed from dpkg. Off-roaders be warned.

  • I had to specify the path with `/usr/sbin/modinfo apex` on 22.12.3.1. Otherwise, I got `zsh: command not found: modprobe`.

If you set an alternative administrative account up, you are responsible for populating it with reasonable dotfiles that include properly setting up PATH.
 
Joined
Aug 3, 2015
Messages
6
after updating to Scale 12.22.3.2 from 12.22.2, in addition to chmod +x /usr/bin/apt* I needed to also chmod +x /usr/bin/dpkg*
 

mrcc

Cadet
Joined
Mar 25, 2023
Messages
3
Hi all,
I just got it working on scale 22.12.3.1 without installing any driver/modding, just got the USB address via dmesg, and passed the bus address to docker app:

Capture.JPG


stopped and relaunched APP (for some reason, just restarting from frigate did not catch coral-related mods to config), and coral tpu was up and running.
 

mazay

Cadet
Joined
Feb 11, 2023
Messages
9
Just a reminder that you are not supposed to be modifying the base operating system. You run various risks of broken stuff in the future. The execute bit was DELIBERATELY removed from dpkg. Off-roaders be warned.



If you set an alternative administrative account up, you are responsible for populating it with reasonable dotfiles that include properly setting up PATH.
I think Coral drivers should be included out of the box, similar to NVIDIA GPU ones. While there's a VM option, I'd like to leverage the k3s cluster capabilities to its full extent.
 

sammael

Explorer
Joined
May 15, 2017
Messages
76
Hi all,
I just got it working on scale 22.12.3.1 without installing any driver/modding, just got the USB address via dmesg, and passed the bus address to docker app:

View attachment 68500

stopped and relaunched APP (for some reason, just restarting from frigate did not catch coral-related mods to config), and coral tpu was up and running.
you don't even have to search for the exact usb location, just pass the whole `/dev/bus/usb` as `/dev/ttyACM0` and it will work even if you plug the coral to different usb later on. Doesn't interfere with other usb devices afaik (the truenas I have it set up on like that boots from usb drive).
 

edwi023

Dabbler
Joined
Oct 28, 2023
Messages
10
After i updated to TrueNAS-SCALE-22.12.4.2 i cannot install the drivers anymore, iam using a m2 variant.the script and other recommendations above aren't working for me anymore.does anybody have a fix for this.
 

nautilus7

Dabbler
Joined
Jan 23, 2023
Messages
15
That is not correct.

I updated earlier today to the exact same version, using the commands in post #29 and the driver installation instructions in the coral edge tpu website. No problem at all.
 

edwi023

Dabbler
Joined
Oct 28, 2023
Messages
10
Then i'am wondering what iam doing wrong, all the updates before i got it up and running.

```
root@Truenas[~]# chmod +x /usr/bin/apt*
root@Truenas[~]# chmod +x /usr/bin/dpkg*
root@Truenas[~]# uname -r
5.15.131+truenas
root@Truenas[~]# lsmod | grep apex
apex 28672 0
gasket 126976 1 apex
root@Truenas[~]# 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-get update
deb https://packages.cloud.google.com/apt coral-edgetpu-stable main
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
100 2659 100 2659 0 0 17535 0 --:--:-- --:--:-- --:--:-- 17609
OK
Hit:1 https://packages.cloud.google.com/apt coral-edgetpu-stable InRelease
Hit:2 http://apt.tn.ixsystems.com/apt-direct/bluefin/nightlies/debian bullseye InRelease
Hit:3 http://apt.tn.ixsystems.com/apt-direct/bluefin/nightlies/docker buster InRelease
Hit:4 http://apt.tn.ixsystems.com/apt-direct/bluefin/nightlies/gluster bullseye InRelease
Hit:5 http://apt.tn.ixsystems.com/apt-direct/bluefin/nightlies/libnvidia bullseye InRelease
Hit:6 http://apt.tn.ixsystems.com/apt-direct/bluefin/nightlies/nvidia-container bullseye InRelease
Hit:7 http://apt.tn.ixsystems.com/apt-direct/bluefin/nightlies/nvidia-docker bullseye InRelease
Hit:8 http://apt.tn.ixsystems.com/apt-direct/bluefin/nightlies/helm all InRelease
Hit:9 http://apt.tn.ixsystems.com/apt-direct/bluefin/nightlies/debian-security bullseye-security InRelease
Hit:10 http://apt.tn.ixsystems.com/apt-direct/bluefin/nightlies/debian-backports bullseye-backports InRelease
Hit:11 http://apt.tn.ixsystems.com/apt-direct/bluefin/nightlies/debian-debug bullseye-debug InRelease
Hit:12 http://apt.tn.ixsystems.com/apt-direct/bluefin/nightlies/nodejs bullseye InRelease
Hit:13 http://apt.tn.ixsystems.com/apt-direct/bluefin/nightlies/yarn stable InRelease
Hit:14 http://apt.tn.ixsystems.com/apt-direct/bluefin/nightlies/nvidia bullseye InRelease
Reading package lists... Done
W: Skipping acquire of configured file 'contrib/binary-amd64/Packages' as repository 'http://apt.tn.ixsystems.com/apt-direct/bluefin/nightlies/debian-backports bullseye-backports InRelease' doesn't have the component 'contrib' (component misspelt in sources.list?)
W: Skipping acquire of configured file 'contrib/i18n/Translation-en' as repository 'http://apt.tn.ixsystems.com/apt-direct/bluefin/nightlies/debian-backports bullseye-backports InRelease' doesn't have the component 'contrib' (component misspelt in sources.list?)
W: Skipping acquire of configured file 'non-free/binary-amd64/Packages' as repository 'http://apt.tn.ixsystems.com/apt-direct/bluefin/nightlies/debian-backports bullseye-backports InRelease' doesn't have the component 'non-free' (component misspelt in sources.list?)
W: Skipping acquire of configured file 'non-free/i18n/Translation-en' as repository 'http://apt.tn.ixsystems.com/apt-direct/bluefin/nightlies/debian-backports bullseye-backports InRelease' doesn't have the component 'non-free' (component misspelt in sources.list?)
root@Truenas[~]# sudo apt-get install gasket-dkms libedgetpu1-std
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
gasket-dkms is already the newest version (1.0-18).
libedgetpu1-std is already the newest version (16.0).
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
root@Truenas[~]# sudo sh -c "echo 'SUBSYSTEM==\"apex\", MODE=\"0660\", GROUP=\"apex\"' >> /etc/udev/rules.d/65-apex.rules"

sudo groupadd apex

sudo adduser $USER apex
Adding user `root' to group `apex' ...
Adding user root to group apex
Done.
root@Truenas[~]# lspci -nn | grep 089a
03:00.0 System peripheral [0880]: Global Unichip Corp. Coral Edge TPU [1ac1:089a]
04:00.0 System peripheral [0880]: Global Unichip Corp. Coral Edge TPU [1ac1:089a]
09:00.0 System peripheral [0880]: Global Unichip Corp. Coral Edge TPU [1ac1:089a]
root@Truenas[~]# ls /dev/apex_0
root@Truenas[~]#
```
 

jetskiz

Cadet
Joined
Jun 18, 2023
Messages
2
After i updated to TrueNAS-SCALE-22.12.4.2 i cannot install the drivers anymore, iam using a m2 variant.the script and other recommendations above aren't working for me anymore.does anybody have a fix for this.
What errors are you receiving?
 

edwi023

Dabbler
Joined
Oct 28, 2023
Messages
10
That is not correct.

I updated earlier today to the exact same version, using the commands in post #29 and the driver installation instructions in the coral edge tpu website. No problem at all.
i did what you suggested but when i use the "ls /dev/apex_0" command it gives me the following message "ls: cannot access '/dev/apex_0': No such file or directory" this is after the steps and a reboot.
 
Top