...
Code:
#!/bin/sh
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
sh -c "echo 'SUBSYSTEM==\"apex\", MODE=\"0660\", GROUP=\"apex\"' >> /etc/udev/rules.d/65-apex.rules"
groupadd apex
modprobe apex
udevadm control --reload-rules
This seems to work if you first:
Code:
chmod +x /usr/bin/apt*
and
Code:
chmod +x /usr/bin/dpkg*
However, it complains that apt-key is deprecated:
Code:
#
"Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8))."
Note: the following is based on some googling and my own experimentation - if someone spots an error in it, please correct me!
Note 2: All the commands need to be run as root
Note 3: As mentioned earlier in this thread, all of this is unsupported, and will not persist Truenas upgrades (which is why it is scripted ;) )
Note 4: After enabling apt-get, do NOT install any updates that are suggested! This will likely break your NAS. It is an appliance, and all these workarounds to install drivers onto Truenas are hacks!
Anyways, to fix this and get rid of the apt-key warning - which I suppose is valid since apt-key is deprecated for a good reason:
I was installing elasticsearch following this guide, but elasticsearch is not really the part of this question. In the first step, I need to add the key: wget -qO - https://artifacts.elastic.co/GPG...
stackoverflow.com
and
Setting up keys for a local repository on a new ubuntu 20.10 virtual machine, I got a message that apt-key add was deprecated and I should read the apt-key(8) man page. The apt-key(8) man page is a
askubuntu.com
If you have already tried @j0rd 's script, first list your existing apt keys:
Find the key that looks like " [ unknown] Rapture Automatic Signing Key (cloud-rapture-signing-key-2022-03-07-08_01_01.pub)"
look at the 40 character key id, e.g.
"A362 B822 F6DE DC65 2817 EA46 B53D C80D
13ED EF05"
take the last 8 characters
removing the space between:
e.g.
13EDEF05
and run:
Code:
apt-key del 13EDEF05
Thereafter, you can run a modified version of the script (just start here if this is the first time you are installing the coral driver):
Code:
#!/bin/sh
mkdir /etc/apt/keyrings
echo "deb [signed-by=/etc/apt/keyrings/coral.gpg] https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list
wget -O- https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor | sudo tee /etc/apt/keyrings/coral.gpg > /dev/null
apt-get update
apt-get install gasket-dkms libedgetpu1-std
sh -c "echo 'SUBSYSTEM==\"apex\", MODE=\"0660\", GROUP=\"apex\"' >> /etc/udev/rules.d/65-apex.rules"
groupadd apex
modprobe apex
udevadm control --reload-rules
This places Google's gpg key into a file in /etc/apt/keyrings folder called coral.gpg, and references it only from the corresponding source.list
/etc/apt/sources.list.d/coral-edgetpu.list
thus avoiding cross-signing with other gpg keys.
The script might need yet another modification when Debian moves to Deb822 format using individual .sources files instead of .list files.
The result should look like:
Code:
# modinfo apex
filename: /lib/modules/5.15.79+truenas/updates/dkms/apex.ko
author: John Joseph <jnjoseph@google.com>
license: GPL v2
version: 1.2
description: Google Apex driver
srcversion: 700E8BBBE9CC23C6EC17712
alias: pci:v00001AC1d0000089Asv*sd*bc*sc*i*
depends: gasket
retpoline: Y
name: apex
vermagic: 5.15.79+truenas SMP mod_unload modversions
parm: allow_power_save:int
parm: allow_sw_clock_gating:int
parm: allow_hw_clock_gating:int
parm: bypass_top_level:int
parm: trip_point0_temp:int
parm: trip_point1_temp:int
parm: trip_point2_temp:int
parm: hw_temp_warn1:int
parm: hw_temp_warn2:int
parm: hw_temp_warn1_en:bool
parm: hw_temp_warn2_en:bool
parm: temp_poll_interval:int
# modinfo gasket
filename: /lib/modules/5.15.79+truenas/updates/dkms/gasket.ko
author: Rob Springer <rspringer@google.com>
license: GPL v2
version: 1.1.4
description: Google Gasket driver framework
srcversion: 2CA68DA0268ABC8C7117109
depends:
retpoline: Y
name: gasket
vermagic: 5.15.79+truenas SMP mod_unload modversions
parm: dma_bit_mask:int
# lspci -vvv | grep -e Unichip
04:00.0 System peripheral: Global Unichip Corp. Coral Edge TPU (prog-if ff)
Subsystem: Global Unichip Corp. Coral Edge TPU
The 04:00:0 part gives you the PCI slot number that you need to expose to a VM - in a sort of reverse notation. In the UI, 04:00:0 should show up as pci_0000_00_04_0 .
At least for me, Scale's UI only showed a few of all the PCI devices once it populated the list (note that you need to give it a minute when opening the "PCI Passthrough Device*" dropdown), and it was missing the 04:
To get around this, instead of choosing from the populated list, just start typing 04 (or what ever your PCI number happens to be) in the Search box:
Choose the one that most resembles in notation the ones that are populated automatically if nothing is typed.
This seems to pass the device correctly into a VM.
If you want to go via the Truechart route, just select the "Render Configuration" checkbox right after the MQTT options in the chart configuration, click on "Add", and fill a name (can be anything I suppose), choose "Edge TPU" as the Type, and type "pci" in the Device.
If you have several coral boards, choose one for each detector:
detectors:
coral1:
type: edgetpu
device: pci:0
coral2:
type: edgetpu
device: pci:1
Or mix usb and pci:
detectors:
coral_usb:
type: edgetpu
device: usb
coral_pci:
type: edgetpu
device: pci