One question guys, I’ve decided to buy a rasperry pi to build a node, the problem is that I literally have no idea how to do it. Could someone give me a link to a tutorial or guide me a bit? I’m still buying the parts and I’m already lost. Is the HDD memory used to mount the node? or do they have to be from ssd? It would be great if someone could guide me with the materials to buy, thanks
Check the R Pi’s own resources or search online. There will be lots of guides.
No need to spend daft money on a Raspberry Pi. Check the link above for a perfectly capable Banana Pi and hook up a spare SATA drive – spinning disk or SSD, its up to you.
The stableset repo will mature soon enough and an ARMv7 will be included in the first release. You will hear on the forum how we get on with that and how to install. There will also likely be various node images made for each of the architectures either by Maidsafe or by the community.
We don’t know yet what HW parameters will be important, we are only guessing now.
Typical Raspberry Pi setup is small SD card or USB flashdisk from which system is loaded on boot. For running fileserver or Safe node in our case, you can attach any SATA hdd via USB to SATA adapter.
great, thanks for the link
Yes! You are correct! Thanks, I found it in raspi-config and lowered the RAM to 16MB which is the minimum.
I got a Pi4 with 8GB to see what Safe will be like on the biggest SBC out there but I’ll also buy a couple of Pi3s and see how it runs.
I’ll also obtain one of these Banana things. I like the idea of finding the absolute minimum of what we can run it on as that will really lower the barrier to entry.
I’m putting together a short guide on how to get it all running on a Raspberry Pi that assumes very little starting knowledge so you could be the pilot for that when I’ve finished it.
I’m using a Pi4 with 8GB in a nice case and with a NVMe drive (totally unnecessary but that is what I had). I’ll share the guide soon. I just have a couple of things to iron out.
But as to the question about the usage of the HDD and where the Safe node(s) will store data the thing to do will definitely be to not try to store any Safe data on the SD card you use to boot the Pi. They are barely good enough to run an OS on at the best of times and they just aren’t a good choice for heavy writing.
The thing to do will be to have the Pi boot from the SD card but mount a NVMe, SATA SSD or SATA magnetic HDD that is attached to it for storing the safe data.
This will be under:-
/home/username/.safe
If the system continues to deploy as it has done in the past.
The guide will go into how to achieve that along with the OS install and a couple of things to make things easier.
You could also just use the NVMe, or SATA drive for the OS as well but that would steal a bit of space from what should ideally be just for the data downloaded.
sounds great, that’s just what i need! I look forward to your guide.
and something I should have highlighted myself - there may be a case for mounting /usr/local/bin on the mass storage as well and touching the SD card as little as possible for max reliability.
That is an option and smart thinking. Especially in this phase of tests and installing Safe lots of times I would imagine and maybe compiling as well. I might do that.
The thing about that is that it will rob you of some precious high speed and reliable storage that should be used for Safe chunks.
I’m going to regard the SD cards as disposable and take image copies and have a build process and save keys offline so I can reinstall quickly and smoothly when the SD card fails.
Sorry, causing chaos by replying to my own post and then deleting it twice!
/usr/local/bin should only be ~200Mb so its not too much to lose
I dont see any need to use SD cards >8GB anyway for a dedicated node so they are not expensive
I think 16GB is the sweet spot. I’ve spent the last couple of nights fiddling with this Pi and found an 8GB card with Raspberry OS on it doesn’t leav enough to download and compile Safe which I’m guessing will be necessary for the next wee while. I’m sure 8GB will be fine in the future but I’ve gone with an over the top 32GB one for now.
Here is my much anticipated (by @Safemoon anyway) guide to setting up a Raspberry Pi 4 for installing Safe on it.
It’s maybe a bit over the top in terms of detail and lots of people will know some of the things it explains but just skip over them if you know it.
It’s also a little bit specific about the case that I’m using so maybe it needs splitting out into a generic guide and another proper examination of the various case and cooling options.
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 your your computer. 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:-
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 Reaspberry 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 it converts 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/<username>/.safe
create the fstab entry for mounting the data drive by adding this to the end of the file:-
/etc/fstab
/dev/sda1 /home/<username>/.safe ext4 defaults,auto_da_alloc 0 2
Replacing ‘’ with the user you created.
Check that the filesystem mounts correctly:-
sudo mount /home/<username>/.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 installing Safe.
–
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!
Please let me know of any corrections or improvements!
My 8Gb figure was assuming cross compiling on x86 desktop then copying to the Pi.
aha! Even smarter! Less wear on the SD card. I like it.
You sure about this?
I have just skimmed your guide above - looks like excellent work (mostly)
check https://askleo.com/why_cant_i_connect_with_a_169254xx_ip_address/
This is truly amazing! If I can’t get a node up and running with this level of detail, I’ll have to retire from the forum haha.
This really deserves its own thread in the forum
Yes, that’s what I was getting. And I could even log in to that IP address as well! Which I found surprising because I thought it was an awful self assigned IP address and would not be pingable. But there it was and I could do everything with it. I really ought to investigate how it was possible. It might be something weird on my router being helpful. Next week I’ll use the other SD card and try it all again and confirm one way or the other.
What is the LAN address of your desktop? Which device is doing DHCP duties on your LAN?
My PiHole JustWorks for all this now, previously I was using the ISP supplied router that was OK-ish.