Installing on Debian 12

I am having some Issues exactly underestanding how to install the Driver+Firmware+Runtime for getting a few Hailo-8L to work on Debian Bookworm 12 AMD64.

My Goal is to run Podman Container (Rootless hopefully) with Frigate to have Accelerated Object Detections.

Unfortunately either the Official Documentation is difficult to find or just not very clear to me.

A good Guide I could find was https://tlab.hongo.wide.ad.jp/2024/03/04/hailo-8-edge-ai-accelerator-deployment-guide/, however I just wonder: isn’t it possible to just create a locally-built .deb Package using something like debuild, dh_make, etc?

I mean since .deb Packages are available, it should also possible to create these Locally. Are there Instructions available ? There is no debian/changelog File so the “usual” Commands don’t really work …

Thank you for your Help :smiley:

1 Like

Hi @silverstone777,
You can compile the hailort + PCIe driver from sources locally, and install it, yes.

This is the PCIe driver git: hailo-drivers
This is the hailort git: hailo-ai/hailort

Hi @Nadav

Thank you for your Reply.

I guess my Question wasn’t clear enough.

I had actually managed to install it based on the Sources.

I created 3 small Scripts.

config.sh

#!/bin/bash

HAILORT_DRIVER_VERSION="4.19.0"
HAILORT_DRIVER_TAG="v${HAILORT_DRIVER_VERSION}"

HAILORT_RUNTIME_VERSION="4.19.0"
HAILORT_RUNTIME_TAG="v${HAILORT_RUNTIME_VERSION}"

build_hailort.sh

#!/bin/bash

source config.sh

git clone https://github.com/hailo-ai/hailort.git

cd hailort
git checkout ${HAILORT_RUNTIME_TAG}

#cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config release

# Include installation in the Machine
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && sudo cmake --build build --config release --target install

build_pcie_driver.sh

#!/bin/bash

source config.sh

git clone https://github.com/hailo-ai/hailort-drivers.git

cd hailort-drivers
git checkout "${HAILORT_DRIVER_TAG}"

build --config release
cd linux/pcie
make all
sudo make install_dkms
sudo modprobe hailo_pci


cd ../.. || exit

./download_firmware.sh
mkdir -p /lib/firmware/hailo/
sudo mv hailo8_fw.${HAILORT_DRIVER_VERSION}.bin /lib/firmware/hailo/hailo8_fw.bin
mkdir -p /etc/udev/rules.d/
sudo cp ./linux/pcie/51-hailo-udev.rules /etc/udev/rules.d/

And I managed to get it working (almost) first try on Kernel 6.8.12-4-pve on Proxmox VE with Hailo Version v4.19.0. The 3x Installed Devices are recognized.

Whether they are all actually being used by Frigate Docker/Podman Container it’s another Matter: Frigate is NOT crashing and seems to have detected at least one of them, and CPU usage went down. No clue how to check the respective Load / Usage of each of these Hailo-8L though :roll_eyes:.

The original Question was also trying to ask: How can I create a Debian Package (.deb) from these Sources. The Provided Commands work “OK” for a Quick&Dirty Install, however I guess it should be fairly easy to provide Commands for how to build a Debian Package based on those, since apparently Raspberry Pi / Hailo are doing it.

Is it possible to compile this to run on TrueNAS Scale (Electric Eel)?
The current kernel version is

6.6.44-production+truenas

.

Hi,
I haven’t tried it, but I don’t see a reason why not, if TrueNas runs Linux.

I cannot compile it on my install as I get this error when compiling

root@server /m/a/m/h/l/pcie (master)# make all
make[1]: Entering directory '/usr/src/linux-headers-6.6.44-production+truenas'
  CC [M]  /mnt/apps/misc/hailort-drivers/linux/pcie/src/pcie.o
  CC [M]  /mnt/apps/misc/hailort-drivers/linux/pcie/src/fops.o
  CC [M]  /mnt/apps/misc/hailort-drivers/linux/pcie/src/sysfs.o
  CC [M]  /mnt/apps/misc/hailort-drivers/linux/pcie/src/nnc.o
  CC [M]  /mnt/apps/misc/hailort-drivers/linux/pcie/src/soc.o
  CC [M]  /mnt/apps/misc/hailort-drivers/linux/pcie/../../common/fw_validation.o
  CC [M]  /mnt/apps/misc/hailort-drivers/linux/pcie/../../common/fw_operation.o
  CC [M]  /mnt/apps/misc/hailort-drivers/linux/pcie/../../common/pcie_common.o
  CC [M]  /mnt/apps/misc/hailort-drivers/linux/pcie/../../common/vdma_common.o
  CC [M]  /mnt/apps/misc/hailort-drivers/linux/pcie/../../common/hailo_resource.o
  CC [M]  /mnt/apps/misc/hailort-drivers/linux/pcie/../utils/logs.o
  CC [M]  /mnt/apps/misc/hailort-drivers/linux/pcie/../vdma/vdma.o
  CC [M]  /mnt/apps/misc/hailort-drivers/linux/pcie/../vdma/memory.o
  CC [M]  /mnt/apps/misc/hailort-drivers/linux/pcie/../vdma/ioctl.o
  LD [M]  /mnt/apps/misc/hailort-drivers/linux/pcie/hailo_pci.o
  MODPOST /mnt/apps/misc/hailort-drivers/linux/pcie/Module.symvers
  CC [M]  /mnt/apps/misc/hailort-drivers/linux/pcie/hailo_pci.mod.o
  LD [M]  /mnt/apps/misc/hailort-drivers/linux/pcie/hailo_pci.ko
  BTF [M] /mnt/apps/misc/hailort-drivers/linux/pcie/hailo_pci.ko
Skipping BTF generation for /mnt/apps/misc/hailort-drivers/linux/pcie/hailo_pci.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/linux-headers-6.6.44-production+truenas'

That’s NOT an Error … I’m getting the same.

root@HOST:/usr/src/hailo/hailort-drivers/linux/pcie# make clean
make[1]: Entering directory '/usr/src/linux-headers-6.8.12-4-pve'
  CLEAN   /usr/src/hailo/hailort-drivers/linux/pcie
  CLEAN   /usr/src/hailo/hailort-drivers/linux/pcie/Module.symvers
make[1]: Leaving directory '/usr/src/linux-headers-6.8.12-4-pve'
root@HOST:/usr/src/hailo/hailort-drivers/linux/pcie# make all
make[1]: Entering directory '/usr/src/linux-headers-6.8.12-4-pve'
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/src/pcie.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/src/fops.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/src/sysfs.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/src/nnc.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/src/soc.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../../common/fw_validation.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../../common/fw_operation.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../../common/pcie_common.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../../common/vdma_common.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../../common/hailo_resource.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../utils/logs.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../vdma/vdma.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../vdma/memory.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../vdma/ioctl.o
  LD [M]  /usr/src/hailo/hailort-drivers/linux/pcie/hailo_pci.o
  MODPOST /usr/src/hailo/hailort-drivers/linux/pcie/Module.symvers
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/hailo_pci.mod.o
  LD [M]  /usr/src/hailo/hailort-drivers/linux/pcie/hailo_pci.ko
  BTF [M] /usr/src/hailo/hailort-drivers/linux/pcie/hailo_pci.ko
Skipping BTF generation for /usr/src/hailo/hailort-drivers/linux/pcie/hailo_pci.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/linux-headers-6.8.12-4-pve'

All you need to do now is

sudo make install_dkms
sudo modprobe hailo_pci

If you think it’s REALLY an error you can try make all -d (DEBUG) or make all --trace (TRACE) and that will give you more Information.

But I still think that if you do this it will work like it did for me:

sudo make install_dkms
sudo modprobe hailo_pci

Do you also get this when running sudo make install_dkms?

(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.6.44-production+truenas (x86_64)
Consult /var/lib/dkms/hailo_pci/4.19.0/build/make.log for more information.
DKMS make.log for hailo_pci-4.19.0 for kernel 6.6.44-production+truenas (x86_64)
Thu Dec  5 12:55:46 PST 2024
make[1]: Entering directory '/usr/src/linux-headers-6.6.44-production+truenas'
make[3]: *** [scripts/Makefile.build:243: /var/lib/dkms/hailo_pci/4.19.0/build/linux/pcie/src/pcie.o] Killed
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:243: /var/lib/dkms/hailo_pci/4.19.0/build/linux/pcie/src/fops.o] Killed
make[2]: *** [/usr/src/linux-headers-6.6.44-production+truenas/Makefile:1924: /var/lib/dkms/hailo_pci/4.19.0/build/linux/pcie] Error 2
make[1]: *** [Makefile:237: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.6.44-production+truenas'
make: *** [Makefile:131: install_dkms] Error 1

cat /var/lib/dkms/hailo_pci/4.19.0/build/make.log
DKMS make.log for hailo_pci-4.19.0 for kernel 6.6.44-production+truenas (x86_64)
Thu Dec  5 12:55:46 PST 2024
make[1]: Entering directory '/usr/src/linux-headers-6.6.44-production+truenas'
make[3]: *** [scripts/Makefile.build:243: /var/lib/dkms/hailo_pci/4.19.0/build/linux/pcie/src/pcie.o] Killed
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:243: /var/lib/dkms/hailo_pci/4.19.0/build/linux/pcie/src/fops.o] Killed
make[2]: *** [/usr/src/linux-headers-6.6.44-production+truenas/Makefile:1924: /var/lib/dkms/hailo_pci/4.19.0/build/linux/pcie] Error 2
make[1]: *** [Makefile:237: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.6.44-production+truenas'

Nope, but I already installed it so maybe that’s why my output is a bit shorter. But pretty sure it was also like the following on my first try …

root@HOST:/usr/src/hailo/hailort-drivers/linux/pcie# sudo make clean
make[1]: Entering directory '/usr/src/linux-headers-6.8.12-4-pve'
make[1]: Leaving directory '/usr/src/linux-headers-6.8.12-4-pve'
root@HOST:/usr/src/hailo/hailort-drivers/linux/pcie# sudo make all
make[1]: Entering directory '/usr/src/linux-headers-6.8.12-4-pve'
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/src/pcie.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/src/fops.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/src/sysfs.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/src/nnc.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/src/soc.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../../common/fw_validation.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../../common/fw_operation.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../../common/pcie_common.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../../common/vdma_common.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../../common/hailo_resource.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../utils/logs.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../vdma/vdma.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../vdma/memory.o
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/../vdma/ioctl.o
  LD [M]  /usr/src/hailo/hailort-drivers/linux/pcie/hailo_pci.o
  MODPOST /usr/src/hailo/hailort-drivers/linux/pcie/Module.symvers
  CC [M]  /usr/src/hailo/hailort-drivers/linux/pcie/hailo_pci.mod.o
  LD [M]  /usr/src/hailo/hailort-drivers/linux/pcie/hailo_pci.ko
  BTF [M] /usr/src/hailo/hailort-drivers/linux/pcie/hailo_pci.ko
Skipping BTF generation for /usr/src/hailo/hailort-drivers/linux/pcie/hailo_pci.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/linux-headers-6.8.12-4-pve'
root@HOST:/usr/src/hailo/hailort-drivers/linux/pcie# sudo make install_dkms
Creating symlink /var/lib/dkms/hailo_pci/4.19.0/source -> /usr/src/hailo_pci-4.19.0
Sign command: /lib/modules/6.8.12-4-pve/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Building module:
Cleaning build area...
make -j8 KERNELRELEASE=6.8.12-4-pve -C /lib/modules/6.8.12-4-pve/build M=/var/lib/dkms/hailo_pci/4.19.0/build/linux/pcie modules...
Signing module /var/lib/dkms/hailo_pci/4.19.0/build/./linux/pcie/hailo_pci.ko
Cleaning build area...

hailo_pci.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.8.12-4-pve/updates/dkms/
depmod...
root@HOST:/usr/src/hailo/hailort-drivers/linux/pcie# 

Check you dmesg and apparmor / selinux

Not sure why I am getting a 403 Error whenever I try to post anything now …

Other things to check include dmesg, apparmor, selinux, auditd.

You might have some protections going on, possibly some “noexec” or other “weird” mount Options on that location as well as simply running out of Memory / RAM (“Killed”).

I’m not sure what the issue is. I’ll post on the TrueNAS forum and see if anybody there can help me compile this.
Thanks for your help :slight_smile:

No worries.

For a complete different Project I learned about this noexec weird mount Permission Issue on TrueNAS.

I’d start looking at mount -l, dmesg, apparmor and

@Nadav Any Chance the Administrators can have a Look at this weird 403 Error while trying to Submit a Reply ? It’s super irritating when I prepare a Reply and it just refuses to submit (potentially/coincidentally because of Code Blocks Ticks ?) …

I’m pretty sure it has to do with kernel headers. I am unable to install linux-headers-$(uname -r) as I get

sudo apt-get install linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package linux-headers-6.6.44-production+truenas
E: Couldn't find any package by glob 'linux-headers-6.6.44-production+truenas'
E: Couldn't find any package by regex 'linux-headers-6.6.44-production+truenas'

I also cannot compile the kernel headers on my machine and am unable to compile them on my Arch machine. If you have a TrueNAS machine running could you try to install this kernel on yours and see if it works for you?

If not no worries.

I don’t use TrueNAS …

My best guess would be that they name their Kernel a bit differently than Debian GNU/Linux.

A bit similar to what Proxmox VE does with their Kernel for instance (proxmox-kernel-xxxx, pve-kernel-xxxx).

So I’d probably just use “aptitude search headers” or “aptitude search truenas” or something like that and see what comes up. Maybe the Kernel package is in something like “truenas-kernel”.

You can actually find that out relatively easy.

For Proxmox VE for Instance:

root@HOST:~# dpkg -S /boot/vmlinuz-6.8.12-4-pve 
proxmox-kernel-6.8.12-4-pve-signed: /boot/vmlinuz-6.8.12-4-pve

I’m a complete noob when it comes to compiling drivers so I’m stuck honestly. I appreciate all the help you’ve given so far but nothing works.
I can install the driver after running

make all
sudo make install

but after checking dmesg it gives

437656.583698] hailo: Init module. driver version 4.19.0
[437656.584525] hailo 0000:04:00.0: Probing on: 1e60:2864...
[437656.585337] hailo 0000:04:00.0: Probing: Allocate memory for device extension, 11632
[437656.586291] hailo 0000:04:00.0: Probing: Device enabled
[437656.587109] hailo 0000:04:00.0: Probing: mapped bar 0 - 00000000fbef4d94 16384
[437656.588014] hailo 0000:04:00.0: Probing: mapped bar 2 - 0000000058e2e44b 4096
[437656.588893] hailo 0000:04:00.0: Probing: mapped bar 4 - 00000000950ecec0 16384
[437656.589786] hailo 0000:04:00.0: Probing: Setting max_desc_page_size to 4096, (page_size=4096)
[437656.590716] hailo 0000:04:00.0: Probing: Enabled 64 bit dma
[437656.591525] hailo 0000:04:00.0: Probing: Using userspace allocated vdma buffers
[437656.592389] hailo 0000:04:00.0: Disabling ASPM L0s
[437656.593137] hailo 0000:04:00.0: can't disable ASPM; OS doesn't have ASPM control
[437656.593975] hailo 0000:04:00.0: Successfully disabled ASPM L0s
[437656.594875] hailo 0000:04:00.0: Writing file hailo/hailo8_fw.bin
[437656.596082] Failed to write file hailo/hailo8_fw.bin
[437656.596831] hailo 0000:04:00.0: Failed writing firmware files. err -2
[437656.597676] hailo 0000:04:00.0: Firmware load failed
[437656.598485] hailo 0000:04:00.0: Failed activating board -2
[437656.599315] hailo: probe of 0000:04:00.0 failed with error -2

I’ll just have to wait and see if someone can help on Discord as none of my research/attempts have gotten me any closer :frowning:

I think you only miss installing the FIRMWARE (see above for my script) now and do a update-initramfs -k all -u ; update-grub ; reboot :smiley:

The Error Message in dmesg looks familiar, it’s simply missing the Firmware to be built-into the initramfs (well, not sure if it’s really the case, but it won’t hurt). Also add hailo_pci into /etc/modules-load.d/hailo.conf on the 2nd LINE (first line just put a # Comment). Cannot remember if it’s /etc/modules-load.d or /etc/modprobe.d or what else but somewhere the 1st Line gets ignored that’s why I start at line number 2 every Time :smiley:

1 Like

OMG LOL THANK YOU

[441264.938779] hailo: Init module. driver version 4.19.0
[441264.939526] hailo 0000:04:00.0: Probing on: 1e60:2864...
[441264.940173] hailo 0000:04:00.0: Probing: Allocate memory for device extension, 11632
[441264.940974] hailo 0000:04:00.0: Probing: Device enabled
[441264.941631] hailo 0000:04:00.0: Probing: mapped bar 0 - 00000000fbef4d94 16384
[441264.942351] hailo 0000:04:00.0: Probing: mapped bar 2 - 000000008a6dc714 4096
[441264.943071] hailo 0000:04:00.0: Probing: mapped bar 4 - 000000008c56c97e 16384
[441264.943778] hailo 0000:04:00.0: Probing: Setting max_desc_page_size to 4096, (page_size=4096)
[441264.944541] hailo 0000:04:00.0: Probing: Enabled 64 bit dma
[441264.945184] hailo 0000:04:00.0: Probing: Using userspace allocated vdma buffers
[441264.945897] hailo 0000:04:00.0: Disabling ASPM L0s
[441264.946522] hailo 0000:04:00.0: can't disable ASPM; OS doesn't have ASPM control
[441264.947250] hailo 0000:04:00.0: Successfully disabled ASPM L0s
[441264.948028] hailo 0000:04:00.0: Writing file hailo/hailo8_fw.bin
[441265.004965] hailo 0000:04:00.0: File hailo/hailo8_fw.bin written successfully
[441265.005717] hailo 0000:04:00.0: Writing file hailo/hailo8_board_cfg.bin
[441265.006565] Failed to write file hailo/hailo8_board_cfg.bin
[441265.007240] hailo 0000:04:00.0: File hailo/hailo8_board_cfg.bin written successfully
[441265.007989] hailo 0000:04:00.0: Writing file hailo/hailo8_fw_cfg.bin
[441265.008758] Failed to write file hailo/hailo8_fw_cfg.bin
[441265.009425] hailo 0000:04:00.0: File hailo/hailo8_fw_cfg.bin written successfully
[441265.099207] hailo 0000:04:00.0: Firmware loaded successfully
[441265.110705] hailo 0000:04:00.0: Probing: Added board 1e60-2864, /dev/hailo0