Safe Network Node on 64-bit ARM servers Installation Guide [Manjaro minimal]

Introduction

This guide will tell you how to install a safe network node on any server computer that runs on an ARM chip. Once running, you will earn safe network tokens. Good luck!

Note: As of now, only the first half of this guide functions as intended, that is step 1 to 5, or the proper installment of the SD card. I’m still working on step 6, the proper installment of the safe application.

Note: The safe network is still in it’s testing phase, so all earned safe network tokens will be destroyed at the end of each test run.

Note: For those of you who are absolute beginners when it comes to server computers.
A server computer is not necessarily any different from a client computer. Any computer can be a server computer. What’s often different about ‘server computers’ is that they often lacks support for monitors, speakers and other components aimed at human sensors. Server computers sit in a corner and uploads data to whomever requests it.

Note: Manjaro ARM no longer supports armv7h architecture. So if you have a armv7h device, you will have to find another guide or buy a newer ARM server.

Requirements

Client computer

  • A Desktop or laptop

Server computer

Minimal

  • 64-bit ARM computer (Raspberry Pi 4 in picture)
    • Motherboard
    • Case
    • Power Adapter
  • SD Card - (Endurable recommended)
  • SD Card reader
  • Ethernet cable

Highly recommended

  • A display-providing cable for your ARM server in case it loses connection:
    • Monitor with HDMI cable : USB-C in to HDMI out cable
    • Monitor with displayport cable : USB-C in to Disyplayport out cable (not in picture)
    • No monitor : Raspberry Pi Display (not in picture)
  • For those who use of the Raspberry Pi 4 as their server, the Raspberry Pi 4 Heatsink

Recommended (not in picture)

  • External storage

Steps

WARNING! For Manjaro OS users that know one can skip step 1 to 3 simply by running manjaro-arm-installer straight away, it is highly recommended to follow these steps carefully as a virtual machine protects you from calamity. This tutorial writer did not follow his own advice and had accidentally deleted his entire computer. Please do not be as stupid as him.

Step 1: Download and install Libvrt, Vagrant and Manjaro OS

Windows 10/11

Recommendation: Chocolately

Chocolately is a package manager, which is like an app store full of free adless software. Go to https://chocolatey.org/ and follow the instructions. Once you have downloaded and installed chocolately, downloaded, installed and started choco-gui, you can install both Vagrant and virtualbox via Chocolately-gui, as vagrant-libvirt has so far has not been able to work with Windows.

– Todo

For Mac OS users

– Todo

For Arch Linux OS users

Open your terminal and type

sudo pacman -S vagrant virt-manager qemu vde2 ebtables dnsmasq bridge-utils openbsd-netcat
sudo systemctl enable libvirtd.service
sudo systemctl start libvirtd.service

For Debian Linux OS users

sudo apt install vagrant virt-manager qemu vde2 ebtables dnsmasq bridge-utils openbsd-netcat
sudo systemctl enable libvirtd.service
sudo systemctl start libvirtd.service

For Fedora Linux OS users

sudo yum install vagrant virt-manager qemu vde2 ebtables dnsmasq bridge-utils openbsd-netcat
sudo systemctl enable libvirtd.service
sudo systemctl start libvirtd.service

Step 2: Run vagrant, download, install and run the MAI-box

Create a folder in your home directory named vagrant.
Open your terminal and navigate towards this folder.
Then type the following:

vagrant plugin install libvrt
vagrant init safenetwork-community/manjaro-arm-installer
vagrant up

Step 3: Insert SD card and run the MAI-box

Once done, start virt-machine, insert your SD card and choose
View->Add Hardware->USB host device and then choose your SD card.

Go back to the terminal and type the following:

vagrant ssh

Step 4: Install Manjaro Minimal onto your SD card

Note: There’s no need for difficult passwords right away, because we’re going to use SSH keys and then via SSH we can change those passwords.

WARNING! If you are not careful with one of the steps during the procedure and choose vda, you will overwrite your virtual machine and have to do Step 1 over again.

asciicast

As in the video choose the following:

YOUR_ARM_COMPUTER_MODEL 
minimal
YOUR_USERNAME 
wheel,sys,audio,input,video,storage,lp,network,users,power
YOUR_FULLNAME 
A_SIMPLE_PASSWORD 
REPEAT
A_SIMPLE_PASSWORD 
REPEAT
sda <- [READ WARNING ABOVE!]
btrfs
YOUR_TIMEZONE
YOUR_LOCALE (default: en_US)
YOUR_TTY_KEYBOARD_LAYOUT (default: us) 
YOUR_HOSTNAME (default: Safenetwork-one)

Once the installment is finished, enter these commands (ROOT_MNJRO=ROOT_MNJRO):

curl https://link.tardigradeshare.io/s/julx763rsy2egbnj2nixoahpobgq/rezosur/safe_network_dev_environment_setup.sh?download -o safe_network_dev_environment_setup.sh
curl https://link.tardigradeshare.io/s/julx763rsy2egbnj2nixoahpobgq/rezosur/sshd_config?download -o sshd_config
mkdir /run/media/$USER/ROOT_MNJRO/@home/YOUR_USERNAME/{safe,safenetwork-node,.ssh} 
mv safe_network_dev_environment_setup.sh /run/media/$USER/ROOT_MNJRO/@home/YOUR_USERNAME/safe/
sudo mv -b sshd_config  /run/media/$USER/ROOT_MNJRO/@/ssh
ssh-keygen -t ed25519 -N <passphrase> -C "USER@HOSTNAME"
cat ~/.ssh/id_ed25519.pub | tee -a /run/media/$USER/ROOT_MNJRO/@home/YOUR_USERNAME/.ssh/authorized_keys

Step 5: Access your ARM server computer via SSH

Pull your Mirco SD card out of your reader and push it into your ARM server.
Connect the ethernet cable to your modem and turn your ARM server on.

On your client computer terminal type the following command to connect to your server:

ssh YOUR_USERNAME@YOUR_HOSTNAME

This should give you access to your server computer.

Next use a password manager (example: KeepassXC) for generating and managing passwords.
Then type these commands:

passwd
YOUR_PASSWORD
NEWLY_GENERATED_PASSWORD
REPEAT
sudo su
passwd
NEWLY_GENERATED_PASSWORD
REPEAT
exit

Run the safe network script which should download and setup docker on your server computer.
This requires a reconnect in order for Manjaro to provide new user permissions.

sudo sh ~/safe/safe_network_dev_environment_setup.sh
exit
ssh YOUR_USERNAME@YOUR_HOSTNAME

Step 6: Start the node

Note: As of now, only rootnode-ipv4 works, although only locally. I’m working on finishing the rest as soon as possible.

Pull the safenetwork-node image from docker.
It should immediately run the node once the build has been completed.

For those who want to join an existing ipv4-only safe network

docker pull ghcr.io/safenetwork-community/joinnode-ipv4:main
docker run --name safe_node -dt ghcr.io/safenetwork-community/joinnode-ipv4:main

For those who want to join an existing ipv6-only safe network

docker pull ghcr.io/safenetwork-community/joinnode-ipv6:main
docker run --name safe_node -dt ghcr.io/safenetwork-community/joinnode-ipv6:main

For those who want to start an ipv4-only safe network

docker pull ghcr.io/safenetwork-community/rootnode-ipv4:main
docker run --name safe_node -dt ghcr.io/safenetwork-community/rootnode-ipv4:main

For those who want to start an ipv6-only safe network

docker pull ghcr.io/safenetwork-community/rootnode-ipv6:main
docker run --name safe_node -dt ghcr.io/safenetwork-community/rootnode-ipv6:main

Congratulations and welcome to the club!
You can also run the safe command line interface from the server side and take a look inside at your hard earned money from running your server farm.

docker exec -it safe_node safe

Happy safe networking!

Extra: Install Lunarvim

Lunarvim is a text-based editor with a steep learning curve, but great for programmers.

bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/installer/install.sh)

Fira ligatures

As a favorite font for editing in servers, choose fira-code.

sudo pacman -S yay
yay -S nerd-fonts-fira-code

Troubleshooting

In case your node unexpectedly quits you can enter the container like this:

docker commit safe_node debug/safe_node
docker run -it --entrypoint=/bin/bash --name debug_node debug/safe_node

And then run a pastebin debug command like this:

nodebin

Work needed to be done

  • [Docker] Figure out how to get rootnode-ipv6 working.
  • [Docker] Figure out how what networks are best to join by default.
  • [Docker] Figure out how people should best join any network they want.
  • [Guide] Add windows screenshots for chocolately, virtualbox and vagrant.
  • [Vagrant] Set vagrant box partition table to GPT.
  • [Vagrant] Set vagrant ISO firmware to EFI.
  • [Vagrant] Set vagrant box firmware to EFI.
  • [Vagrant] Add a post-installer dialog where one can choose a setup (nothing/{join,root}node-ipv{4,6}) which will install docker, the docker image, lunarvim and aliases (lunarvim, termbin, safe).
  • [Vagrant] Replace virtualbox with libvirt on Windows once it’s possible.
22 Likes

This will be misleading to anyone new to the project. Maybe put “test safe network tokens” at least?
Thanks for the guide!

3 Likes

This should be

docker run -it manjaro-arm-installer

1 Like

Has anyone else replicated this procedure on any OS?

I have a suspicion that the permissions are not set correctly for the Manjaro Installer on Debian

Also when I select the locale the installer jumps to the end of the process and I can only either accept what I have in this screen or abort

mount: /var/tmp/manjaro-arm-installer/root: permission denied.
umount: /var/tmp/manjaro-arm-installer/root: must be superuser to unmount.
mount: /var/tmp/manjaro-arm-installer/root: permission denied.
mount: /var/tmp/manjaro-arm-installer/root/home: permission denied.
mount: /var/tmp/manjaro-arm-installer/boot: permission denied.
==> Creating install for rpi4...
  -> Used device is /dev/sdd
  -> Downloading latest aarch64 rootfs...
Manjaro-ARM-aarch64-latest.tar.gz  100%[===============================================================>] 167.08M  4.36MB/s    in 42s     
  -> Extracting aarch64 rootfs...
  -> Setting up keyrings...
  -> Generating mirrorlist...
  -> Installing packages for minimal on rpi4...
mount: /var/tmp/manjaro-arm-installer/root/var/cache/pacman/pkg: permission denied.
clone() failed: Operation not permitted
  -> Enabling services...
clone() failed: Operation not permitted
systemd-networkd.service not found in rootfs. Skipping.
dhcpcd.service not found in rootfs. Skipping.
sshd.service not found in rootfs. Skipping.
iwd.service not found in rootfs. Skipping.
zswap-arm.service not found in rootfs. Skipping.
systemd-oomd.service not found in rootfs. Skipping.
bootsplash-hide-when-booted.service not found in rootfs. Skipping.
bootsplash-show-on-shutdown.service not found in rootfs. Skipping.
  -> Applying overlay for minimal...
  -> Setting up users...
  -> Setting password for root ...
  -> Adding user...
  -> Enabling user services...
No user services for minimal edition
  -> Setting up system settings...
clone() failed: Operation not permitted
sed: can't read /var/tmp/manjaro-arm-installer/root/usr/lib/systemd/system-preset/90-systemd.preset: No such file or directory
Correcting permissions from overlay...
  -> Adding btrfs support to system...
sed: can't read /var/tmp/manjaro-arm-installer/root/etc/mkinitcpio.conf: No such file or directory
  -> Cleaning install for unwanted files...
umount: /var/tmp/manjaro-arm-installer/root/var/cache/pacman/pkg: must be superuser to unmount.
==> rpi4 minimal install complete
==> Writing bootloader and cleaning up after install...
mv: cannot stat '/var/tmp/manjaro-arm-installer/root/boot/*': No such file or directory
Set boot partition to  in /etc/fstab...
Set root partition to  in the relevant boot script...
Set root partition to  in /etc/fstab if applicable...
umount: /var/tmp/manjaro-arm-installer/root/home: must be superuser to unmount.
umount: /var/tmp/manjaro-arm-installer/root: must be superuser to unmount.
umount: /var/tmp/manjaro-arm-installer/boot: must be superuser to unmount.
  -> If you get an error stating 'failed to preserve ownership ... Operation not permitted', it's expected, since the boot partition is FAT32 and does not support ownership permissions...
2 Likes

I highly doubt it.
I will have to fix the permissions issue.
It’s clear that they are wrong.

2 Likes

I tried to cheat by running docker exec -it running docker ID bash in another terminal and then running mkdir -p /var/tmp/manjaro-arm-installer/root/var/cache/pacman/pkg inside that shell but I didnt get much further

Giving up now cos I have had 4 hrs sleep in the last 72 and Im not at my most precisely analytical… except I can’t sleep…

2 Likes
docker run -it --privileged=true manjaro-arm-installer
1 Like

Better but still some issues to sort

Error: /dev/sdd: unrecognised disk label ← this confuses me. The system recognises /dev/sdd OK and it has created the partitions

So I am unsure at this stage if this is an Ubuntu error at my end or a further error in the installer…

Here is what i get…

==> Proceeding....
  -> Getting package lists ready for rpi4 minimal edition...
==> Getting /dev/sdd ready with btrfs for rpi4...
Error: /dev/sdd: unrecognised disk label
==> Creating install for rpi4...
  -> Used device is /dev/sdd
  -> Downloading latest aarch64 rootfs...
Manjaro-ARM-aarch64-latest.tar.g 100%[=========================================================>] 167.08M  4.42MB/s    in 38s     
  -> Extracting aarch64 rootfs...
  -> Setting up keyrings...
  -> Generating mirrorlist...
  -> Installing packages for minimal on rpi4...
Failed to retrieve machine ID: No such file or directory
Attempted to remove disk file system under "/run/systemd/nspawn/propagate/root", and we can't allow that.
  -> Enabling services...
Failed to retrieve machine ID: No such file or directory
Attempted to remove disk file system under "/run/systemd/nspawn/propagate/root", and we can't allow that.
systemd-networkd.service not found in rootfs. Skipping.
dhcpcd.service not found in rootfs. Skipping.
sshd.service not found in rootfs. Skipping.
iwd.service not found in rootfs. Skipping.
zswap-arm.service not found in rootfs. Skipping.
systemd-oomd.service not found in rootfs. Skipping.
bootsplash-hide-when-booted.service not found in rootfs. Skipping.
bootsplash-show-on-shutdown.service not found in rootfs. Skipping.
  -> Applying overlay for minimal...
  -> Setting up users...
  -> Setting password for root ...
  -> Adding user...
  -> Enabling user services...
No user services for minimal edition
  -> Setting up system settings...
Failed to retrieve machine ID: No such file or directory
Attempted to remove disk file system under "/run/systemd/nspawn/propagate/root", and we can't allow that.
sed: can't read /var/tmp/manjaro-arm-installer/root/usr/lib/systemd/system-preset/90-systemd.preset: No such file or directory
Correcting permissions from overlay...
  -> Adding btrfs support to system...
sed: can't read /var/tmp/manjaro-arm-installer/root/etc/mkinitcpio.conf: No such file or directory
  -> Cleaning install for unwanted files...
==> rpi4 minimal install complete
==> Writing bootloader and cleaning up after install...
mv: cannot stat '/var/tmp/manjaro-arm-installer/root/boot/*': No such file or directory
Set boot partition to  in /etc/fstab...
Set root partition to  in the relevant boot script...
Set root partition to  in /etc/fstab if applicable...
  -> If you get an error stating 'failed to preserve ownership ... Operation not permitted', it's expected, since the boot partition is FAT32 and does not support ownership permissions...
==> Time : 2.25 minutes...

I’ll try to figure out what this is.
I get this even outside docker.

[update]

I filed an issue for it.

3 Likes

Ok - so its not just me then :slight_smile:

I have to go AFK now for some unspecified time - could be hours, could be days…
Please keep looking, I will dive in when I can. I am finding this distracting/therapeutic from some some major shit…
Thank you

4 Likes

No, all your issues are either related to how docker handles the manjaro-arm-installer or manjaro-arm-installer itself.

1 Like

Yes exactly. I was about to spin up a VM to install Manjaro on my PC to look at the installer more closely but then I got called away.

1 Like

I seem to recall there was something weird about installing Manjaro alongside other Linux distros. Like it doesn’t play nice with other boot managers or something. But that may be totally irrelevant to anything you are discussing.

1 Like

I’m switching to Ubuntu for this Pi
Raspberry Pi Imager Just Worked and I had Ubuntu 20.04 LTS Server running inside 10 mins.

3 Likes

Moving on with Ubuntu on the Pi, I want to see just how much of @folaht 's script can be reused

I think this should be mkdir -p /run/media/$USER/ROOT_MNJRO/@home/YOUR_USERNAME/{safe,safenetwork-node,.ssh} `

to give

Yeah I know ROOT_MNJRO is not the best label here for that dir but it works for now

Also to avoid confusing myself entirely I should choose a username other than “ubuntu”

1 Like

It only creates one folder up on the …/@home/YOUR_USERNAME folder.
I don’t see why -p is then necessary.

1 Like

I had to create everything under /run/media…

but I was likely abusing your script

the -p doesn’t hurt in any case :slight_smile:

1 Like

Hi @folaht,

From what I understand here, your Pi is running in headless mode, and you’ve packaged sn_node into a container.

Would more users be interested in seeing sn_node distributed in containers? We could look into doing that for our releases. One of the good things about the node being written in Rust though is that it can be distributed as a single compiled binary. I guess a container could make things slightly more convenient though if you maybe wanted to package a node config with it. Did you have a particular scenario in mind for the container?

Cheers,

Chris

2 Likes

Correct.

No. Just a general scenario of the safe network becoming popular and all wanting the best security.
Storj does it. I don’t know why.

1 Like

Thanks. I’ll keep containers in mind.

2 Likes