I put Ubuntu on the RPi4. I wrote a whole guide on how I set it up which I need to tidy up, update and put into a new topic. I might get to that this weekend but here it is as it is just now.
But I don’t think there is anything special that I did that allows it to run 40 nodes and I can’t see why you can’t on yours. And I actually can’t really test if it will because my internet isn’t good enough for as many as that.
–
Raspberry Pi 4 in Argon One M2 NVMe Case
V1.0
20230419
This guide assumes you have a Raspberry Pi 4 with an Argon One case with the M2 NVMe board.
and
This houses a M2 NVMe drive in the base of the case and it is powered by a USB dongle that hangs out of the back and connects a USB port in the base to the one of the USB ports on the Pi 4.
It’s a nice case. The whole of the top of the case is made of Aluminium and connects to the heatsink so while it has a fan it doesn’t really need it and you can set it to only come on if the cpu temperature gets to 60C which should be basically never. When I was compiling Safe it only got to 49C.
It should also work for the Argon One case with the M2 SATA case as well. It will work for Raspberry Pi 4s in some other case apart from the bit about using the argon utility to control the Fan. You’ll have to find something else for that.
It also assumes you have an SD card reader/writer on yourcomputer. If you don’t have one get something like this:-
This guide is for setting up the Raspberry Pi with a wired ethernet connection. This is partly to keep Wireless traffic on my network down but also because there is a known problem with the Raspberry Pi 4 and the Argon M2 NVMe case in particular. The only option to power the M2 drive is with the Raspberry Pi 4 USB bus and that can’t supply more than 3.0A at 5V. Ethernet and the Wifi chipset is on the USB bus as well and 3.0A at 5V is not really enough to run everything considering that NVMe uses a lot of power. So I’ve disabled the onboard Wifi.
Another solution is to plug the USB port in the base of the Argon One case and the USB port on the Pi 4 that you were going to connect together with the dongle into a powered USB hub. This will then power the NVMe drive instead which will lighten the load on the Pi 4’s USB bus enough for all the stuff to work.
It may be possible to get the whole lot working with Wifi as well by using a higher power USB-C mains adapter but that’s not guaranteed at all and it seems the issue is with what the USB bus on the Pi 4 can supply rather than what it is supplied with to start with. I tried it with a PSU that can deliver 20W and the Wifi still doesn’t work.
I’m using a 32GB SD card for the OS. A 16GB one should be fine. 8GB is not enough to download the Safe source code and compile it. But it should be enough for running the published binary. During the testnet phase of the project though it might be necessary to compile from source to stay up to date so 16GB or 32GB might be the way to go. There’s hardly any difference in the price anyway. If you want the Desktop version of Raspberry OS you will definitely need 16GB and 32GB will be nice.
I opted to install the Raspberry Pi OS on the SSD card to leave the maximum amount of the NVMe drive free for Safe just run on the OS as well on a SATA or NVMe drive.
It really shouldn’t need an NVMe drive because a Raspberry Pi 4 can’t use all the performance it offers but this is what I had in stock. A SATA SSD would be fine. A magnetic SATA drive would be fine as well but that would need a larger case and be noisier.
This is a bare bones guide to get people going and other ways of doing things are possible. It does assume a bit of capability like how to edit a config file (I’ve got to draw the line somewhere…). Maybe there will be another How-To on how to use nano and vi (let the text editor wars commence!)
But I’ve gone into the detail of how to use fdisk because that’s something a bit less basic.
I’ll be interested in any suggestions for improvements.
First of all we’re going to put an image of the Raspberry Pi OS onto an SD Card. The easiest way to do this is with the Raspberry Pi Imager.
This can be downloaded for Windows, linux and Mac from:-
https://www.raspberrypi.com/software/
Plug the Micro SD card into your SD Card reader and run Raspberry Imager.
Don’t use the recommended option of ‘Raspberry Pi OS (32-bit)’ because Safe will require the 64-bit version of the Raspberry OS.
Go to the ‘Raspberry Pi OS (other)’ section.
For the OS choose either:-
‘Raspberry Pi OS (64-bit)’
If you want to have a Desktop available.
or
‘Raspberry Pi OS Lite (64-bit)’
If you are happy with just CLI access to the Pi.
When there is a GUI available for Safe you may want the Desktop for that but there is no need at the moment.
Click on the Cog Wheel in the lower right of the window to get at the advanced options.
Set a hostname
Set a username and password
Enable SSH
If you are able to use WiFi and want to set it up you can enter the SSID and Password here as well.
Save the settings and click on ‘Write’.
Once the SD Card has been written put it in your Pi and power it.
Login to the Raspberry Pi for the first time.
You’ll need to use a keyboard and a monitor.
If you are using the Pi in an Argon One case or another one like it will convert the Pi’s micro HDMI port to the normal sized one. If not, you’ll need to get an adapter like this one:-
Select the Keyboard layout that suits you.
Enter a username and password for a new user if you didn’t do it during the SD card imaging.
–
The Pi will reboot.
Once it comes up with the Login prompt login with the username and password you set.
The first thing to do is get the IP address of the Pi.
Run this:-
ip a l
This will give output like this:-
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether e4:5f:01:48:e1:01 brd ff:ff:ff:ff:ff:ff
inet 169.254.141.197/16 brd 169.254.255.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fd02:3107:e840:0:cd21:c2d5:85db:7d89/64 scope global mngtmpaddr noprefixroute
valid_lft forever preferred_lft forever
inet6 fe80::4ee1:6add:d09e:405b/64 scope link
valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether e4:5f:01:48:e1:04 brd ff:ff:ff:ff:ff:ff
You are interested in the IP address for ‘eth0’ or ‘wlan0’
It will probably be an IP address like 169.254.141.197.
You should be able to login to this from your computer and do the rest of the tasks.
Many people will be happy with the Raspberry Pi getting a DHCP address but I like to know where things are on my network. And because I’m not using the onboard Wifi and the Ethernet interface eth0 is not setup by default at all I had to do these steps from the console. So you’ll need to connect the Pi to a monitor and keyboard for this first bit. Or you could leave the extra drive not connected so WiFi will work and do these bits over WiFi and DHCP and then when it is on Ethernet plug in the drive and reboot before doing the drive related things and the rest.
Set to use eth0 with a static address by adding these lines to:-
/etc/dhcpcd.conf
interface eth0
static ip_address=10.0.0.101
static routers=10.0.0.1
static domain_name_servers=1.1.1.1 1.0.0.1
But replace the values with things that will work on your network!
Then restart the dhcp service with:-
systemctl restart dhcpcd
You should now be able to login to the Pi from another computer.
Expand the root disk to the size of the SD card
Run:-
sudo raspi-config
Then use these options:-
│ 6 Advanced Options Configure advanced settings │
│ A1 Expand Filesystem Ensures that all of the SD card is available │
Select ‘Yes’ for reboot now or just wait until you next reboot to get the extra RAM.
Disable WiFi
Obviously don’t do this if you want to use it!
Disable wifi by:-
Editing the file /boot/config.txt
Find the following line:
Additional overlays and parameters are documented /boot/overlays/README
And add these two lines under it:
dtoverlay=disable-wifi
dtoverlay=disable-bt
The second line is for the Bluetooth module so don’t add it if you need Bluetooth and just want to disable Wi-Fi.
That’s the easy way of doing it but a more correct way as the wifi isn’t going to be used at all is to disable the drivers for the wifi hardware in this file:-
/etc/modprobe.d/raspi-blacklist.conf
Paste these two lines in it (the file is probably empty):
blacklist brcmfmac
blacklist brcmutil
These two instructions were lifted from:-
Partition the NVMe or SATA drive with fdisk. I’ll call this the ‘data drive’ from now on.
sudo fdisk /dev/sda
Type ‘d’ to delete any partition that is there.
Type ‘n’ to create a new partition.
Type ‘p’ to create a Primary partition or just press Enter because that is the default.
Accept all the defaults by pressing Enter.
Type ‘w’ to write the new partition table.
Type ‘q’ to quit.
Format the NVMe drive with mkfs
sudo mkfs.ext4 /dev/sda1
Create the directory for mounting the data drive.
sudo mkdir /home//.safe
create the fstab entry for mounting the data drive by adding this to the end of the file:-
/etc/fstab
/dev/sda1 /home//.safe ext4 defaults,auto_da_alloc 0 2
Replacing ‘’ with the user you created.
Check that the filesystem mounts correctly:-
sudo mount /home//.safe
Check the filesystem is mounted:-
df -h
You should see something like this:-
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 30G 1.5G 27G 6% /
devtmpfs 3.7G 0 3.7G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 1.6G 1.1M 1.6G 1% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
/dev/mmcblk0p1 255M 31M 225M 12% /boot
tmpfs 787M 0 787M 0% /run/user/1000
/dev/sda1 219G 28K 208G 1% /home/myuser/.safe
Check that the filesystem on the data drive mounts on boot correctly by rebooting:-
sudo shutdown -r now
Then running df -h again.
A few totally optional things you might want to do before installing Safe:-
–
I like to follow a ‘least privilege’ model and not use an account capable of becoming root unless I have to. So I run Safe under another account.
Create an unprivileged user called name:-
sudo adduser name
You don’t have to put anything for the Full Name, etc. so just Enter through the prompts.
Unmount the previously mounted filesystem:-
umount /home/myuser/.safe
(that’s not a spelling mistake: the command is definitely ‘umount’ without an ‘n’!
Edit /etc/fstab so that it references the new un-privileged user:-
/dev/sda1 /home/unprivuser/.safe ext4 defaults,auto_da_alloc 0 2
Login as the unprivileged user.
Create the directory for the mountpoint
mkdir .safe
Reboot with:-
shutdown -r now
Login as the unprivileged user
Check the filesystem is mounted again with df -h
Check you can write to the filesystem with:-
touch .safe/testfile
rm .safe/testfile
This should return nothing if you can write and delete the file proving that you are the owner of the directory and permissions have flowed down.
Then you should only need to login to the privileged account that can use sudo for things such as upgrading the OS and compiling Safe from source.
–
Reduce the GPU RAM
On a Raspberry Pi some of the RAM is allocated to the GPU for the display. Unless you are using the Desktop install you won’t need much so reduce it to 16GB unless you are using the Desktop version of the OS in which case you might want more.
Run:-
sudo raspi-config
Then use these options:-
│ 4 Performance Options Configure performance settings │
│ P2 GPU Memory Change the amount of memory made available to the GPU │
Change the value to be 16.
Select ‘Finish’ and press Enter
Select ‘Yes’ for reboot now or just wait until you next reboot to get the extra RAM.
install iostat so that you can see read and write activity on the drives
sudo apt install sysstat
Then you can run:-
iostat 5
to get an update every 5 seconds of read and write throughput.
–
Install the smartctl utility so you can look at the SMART health of the SSD drive (not the SD card with the OS on it - there is no health monitoring possible for that).
sudo apt install smartmontools
Then run this to see the SMART data:-
sudo smartctl --all /dev/sda
–
To see the temperature of the CPU run this:-
paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s '\t' -t | sed 's/\(.\)../.\1°C/’
Put that into a file and make it executable to run whenever you want:-
echo “paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s '\t' -t | sed 's/\(.\)../.\1°C/'” > cpu_temp
Make the file executable with:-
chmod 744 cpu_temp
Then you can just run it with:-
./cpu_temp
Or you can run it in a while loop with this command:-
while true; do ./cpu_temp; sleep 5; done
You could even put that in a script called ‘monitor_cpu_temp’ to run whenever you want:-
echo “while true; do ./cpu_temp; sleep 5; done” > monitor_cpu_temp
chmod 744 monitor_cpu_temp
You might want to do that while compiling the safe software (if you are installing by compiling from source) as it is likely the busiest the CPU will ever be!
–
Setup Fan control using the argon1 script:-
Download the script with:-
curl https://download.argon40.com/argon1.sh | bash
Run the script with:-
argonone-config
If you’re not using the Argon One case there will be some other way of controlling the fan (if you have one).
–
Make an image of the state of this SD card and save it on your big computer and also image it to a brand new SD card. Then when the SD card fails you can just pop in the new one. Don’t forget to save all your config as well and especially keys!