Husarnet Not installing on Pi 0 (install Error)

Help Please

Husarnet Not installing on Pi 0

Raspberry Pi 0

curl https://install.husarnet.com/install.sh | sudo bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2771 100 2771 0 0 1709 0 0:00:01 0:00:01 --:–:-- 1710

Installing Husarnet…

Reading package lists… Done

Unpacking husarnet (1:2.0.141) …
Setting up fonts-noto-color-emoji (0~20180810-1) …
Setting up husarnet (1:2.0.141) …
/var/lib/dpkg/info/husarnet.postinst: line 9: 1143 Illegal instruction /usr/bin/husarnet daemon service-install --silent
dpkg: error processing package husarnet (–configure):
installed husarnet package post-installation script subprocess returned error exit status 132
Errors were encountered while processing:
husarnet
E: Sub-process /usr/bin/dpkg returned an error code (1)

Hello @Fox

Thank you for the report.
RPi 0 is on ARMv6 architecture that Husarnet CLI does not currently support.
Adding the support is definitely possible but at this moment I can’t estimate how long it will take. We’ll discuss internally and I’ll let you know in this thread in a couple of days.

Best regards,
ympek, Husarnet team.

Hello @Fox,

So I’ve researched the topic a bit and it seems that there is open issue in Zig (move -mcpu to be part of the target triple · Issue #4584 · ziglang/zig · GitHub) that kinda blocks incorporating ARMv6l architecture to our build pipelines, as we rely on Zig to cross-compile.

We’ll put this on the roadmap and monitor if this is resolved. Right now, the only workaround that comes to mind would be to build Husarnet from source ON the Raspberry Pi. This is gonna be tedious and time-consuming, as Pi Zero is obviously not the most powerful computer out there, but definitely possible.

In case you want to try it, I provide the instructions below, along with my remarks. I did it today and it worked, although the whole process took a good couple of hours.

I assume you don’t want to go through all this trouble; in that case I’d suggest to just wait until we support ARMv6l. But I am sharing the instructions to anyone interested.

Building Husarnet from source on Raspberry Pi Zero

Preparation

  1. Install dependencies from APT:
sudo apt update && sudo apt install git cmake ninja-build
  1. Install Go language compiler version 1.20+ according to the instructions on Download and install - The Go Programming Language. Don’t install the one in APT repository, it’s outdated.

  2. Resize swap. Compiling needs a lot memory and 512MB of RAM might not be enough and the compiler might utilize swap. Resize it to 1GB or sth like this (change CONF_SWAPSIZE=100 to CONF_SWAPSIZE=1000):

sudo dphys-swapfile swapoff
sudo nano /etc/dphys-swapfile
sudo dphys-swapfile setup
sudo dphys-swapfile swapon

Compilation

  1. Clone and enter the repository:
git clone https://github.com/husarnet/husarnet
cd husarnet
  1. Create CMake file for the architecture. Using editor of choice (vi or nano), create file daemon/arch_armv6l.cmake and paste following contents:
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR armv6l)

SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

Save the file and exit.

  1. Generate build files via CMake:
mkdir build
cd build
cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE=../daemon/arch_armv6l.cmake -DCMAKE_INSTALL_PREFIX=./out -DBUILD_SHARED_LIBS=false ../daemon

It may appear that cmake is stuck on this part:

-- Detecting CXX compile features - done

No worries, this alone can easily take like 15-20 minutes (depending on internet connection, because it downloads dependencies here)

  1. Build husarnet-daemon:
cmake --build .

This is actual compilation step. It’s slow. You will see various warnings, no worries. Took around 2 hours on my device.

  1. Install husarnet-daemon to /usr/bin/

If the daemon compiled correctly, you will see the file husarnet-daemon in build/ directory. Copy it to /usr/bin:

cp husarnet-daemon /usr/bin/
  1. Build husarnet (i.e. the CLI):
cd cli/
go generate && go build -o husarnet .
  1. Install husarnet to /usr/bin/

Similarly, we copy the binary to /usr/bin:

cp husarnet /usr/bin/
  1. Install the service in systemd:
sudo husarnet daemon service-install
  1. Test the installation:
husarnet status

You now have Husarnet on your RPi Zero.

Remarks

Note that in order to verify if compilation is working, I was using headless setup (no GUI) using Raspberry Pi OS Lite:

rpi@rpizero:~ $ uname -a
Linux rpizero 6.1.21+ #1642 Mon Apr  3 17:19:14 BST 2023 armv6l GNU/Linux
rpi@rpizero:~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye

That’s all there is to it.

This post might be helpful for anyone interested in trying out building husarnet for the architecture that is not currently supported by us, or just tinkering with husarnet source code. If you have any problems, feel free to post on the forums.

Best regards,
ympek, Husarnet team

Building Husarnet from source on Raspberry Pi Zero
Not working Error on husarnet join ?

root@raspberrypi:/home/foxcopy/husarnet/cli# husarnet status
Version
● CLI: 2.0.160
● Daemon (running): 2.0.160
● Daemon (binary): 2.0.160

Daemon hooks are currently disabled
Dashboard URL
● CLI: app.husarnet
● Daemon: app.husarnet

Connection status
● Base Server: 188.165.23.196:5582 (UDP)

Readiness
● Is ready to handle data? yes
● Is ready to join? yes
● Is joined? no

Local
● Husarnet IP:
fc94:eb84:d664:f919:aade:1196:067c:c27a

Whitelist
root@raspberrypi:/home/foxcopy/husarnet/cli# sudo husarnet join fc94:b01d:1803:8dd8:b293:5c7d:7639:932a/XXXXXXXXXXXXXXXXXXXXX Pi0-xxxxxx
SUCCESS: Successfully registered a join request
SUCCESS: Waiting for Base server connection (any protocol)…
ERROR: timeout
ERROR: timeout <-------------------------------------------------------------------------------------------- ERROR

root@raspberrypi:/home/foxcopy/husarnet/cli# husarnet status
INFO: Daemon does not seem to be running <---------------------------------------------- ???

Do you want to restart Husarnet Daemon now? [y/N]: Yes

SUCCESS: Waiting until we can communicate with husarnet daemon…
SUCCESS: Waiting until we can communicate with husarnet daemon…
Version
● CLI: 2.0.160
● Daemon (running): 2.0.160
● Daemon (binary): 2.0.160

Daemon hooks are currently disabled
Dashboard URL
● CLI: app.husarnet
● Daemon: app.husarnet

Connection status
● Base Server: :::0 (NONE) <------------------------------------------------------------------ ERROR
● There’s no Base Server connection - Husarnet will not be fully functional

Readiness
● Is ready to handle data? no
● Is ready to join? no
● Is joined? no

Local
● Husarnet IP:
fc94:eb84:d664:f919:aade:1196:067c:c27a

Whitelist
fc94:b01d:1803:8dd8:b293:5c7d:7639:932a (websetup)
● active ● no data flow ● tunelled

Hello,
Thank You for reaching out to us, we will look into this case more in depth and will try to come to you with a solution in the upcoming days.

Best regards,
Konrad

Hello,
We have managed to fully reproduce the issue you have described.
We have added fixing this particular issue and adding a full-fledged support for the Raspberry Pi Zero platform to our roadmap. That being said, we currently do not have many customers using that particular platform and as such we may not be able to prioritize this task in the near future.

Best regards,
Konrad