Machu Picchu (bonus): 64-bit Persistent IPFS node on Raspberry Pi3

Machu Picchu IPFS node on Raspberry Pi 3 running Ubuntu Server on 64-bit

version of September 15, 2021

This is a bonus to the series of articles describing how to install a full IPFS decentralized storage node on a Raspberry Pi 3 Model B+ with a Samsung Solid State Storage of 500 GB.

  • Part 1 explains the purposes of Machu Picchu — Data as a Public Service, the characteristics of the Raspberry Pi (RPi) family and the reasons why we chose the RPi 3.
  • Part 2a is a hands-on installation tutorial to install the 32-bit Raspbian operating system on the Raspberry Pi up to the first remote connection with the actual hostname and password.
  • Part 2b continues the tutorial with the installation of the SSD and IPFS.

This bonus is the equivalent of Part 2a. If you follow {2a + 2b} you’ll have an IPFS node running in 32-bit mode. Following {Bonus + 2b}, you’ll have an system running in 64-bit mode.

Trade-offs of running 32-bit vs. 64-bit

  • A CPU running in 64-bit mode is faster: https://hackaday.com/2020/01/28/raspberry-pi-4-benchmarks-32-vs-64-bits/
  • But unless their code is optimized, applications takes more RAM space in 64-bit mode. This is important since the RPi3 has only 1 GB RAM.
  • The family of low-cost computers Raspberry Pi started in 2012 with the 32-bit architectures ARMv6 and ARMv7. In October 2016 was introduced the first models using 64-bit ARMv8. As a result there are a lot of add-ons and drivers written in 32-bit mode.
  • Running in 64-bit mode requires rewriting the kernel, the drivers, the boot process. For best results, the “userland” applications should also be compiled for 64-bit.
  • The OS officially supported by the Raspberry Foundation is the 32-bit Raspbian Buster. The Foundation team is too small to maintain 2 versions. Update of November 2021: they are working on a 64-bit version of the official OS but the beta is not yet available for download.
  • The Ubuntu Foundation released a Long-Term-Support version of Ubuntu for Raspberry Pi in 64-bit mode. There has been fewer RPi running in this mode then in 32-bit, hence there might be incompatibilities.

For the above reasons, I started installing the Machu Picchu IPFS node in Raspbian 32-bit. Once successful, I tried installing the node in 64-bit to make Machu Picchu more future-proof. It is described in this bonus

List of installation steps

This article details only the steps that makes this 64-bit bonus differ from the 32-bit Part 2a. They are marked with a star in the list below. The rest is identical and not listed here.

  1. *Burn the boot micro-SD card and configure it for wi-fi access.
  2. *Boot and open a ssh session.
  3. *In the ssh session(s), change hostname and password.
  4. Initiate new ssh session with the new hostname and password.
  5. Update and upgrade all software packages.
  6. Prepare the mounting of the SSD.
  7. Install IPFS and check IPFS access.

1. Burn the boot micro-SD card and configure it for wi-fi access

  • Insert the micro-SD card into the USD adapter and insert the adapter on your Macbook.
Raspberry Mass memory Micro-SD card
  • Launch Raspberry Pi Imager on your laptop to select which OS to flash in the micro-SD card. Choose “Other general purpose OS” followed by “Ubuntu” followed by “Ubuntu Server 20.04.3 LTS (RPi 3/4/400)”. Choose the storage “Mass Storage Device Media — 31.9 GB” (exact value depends on your specific micro-SD card) and flash the card. On MacOS, you need to give your administrator password to enable flashing.
Dialogs to select the OS to flash on the micro-SD card
  • Once the micro-SD card is flashed and verified, it will be “ejected” by MacOS. Remove the micro-SD card USB adapter and reinsert it back in your Macbook. It appears on the Finder Desktop as a volume named system-boot. There are inside 2 Ubuntu files to modify.
Content of the micro-SD card with the 2 additional files for Wi-Fi
  • Modify network-config using any text editor on MacOS, replace its content with the following. The easiest is to copy-paste the example below because the space indentations are important. Modify the lines 22 and 23 to suit your wi-fi network name (SSID) and your wi-fi network password, both between quotes. Save and close the file.
  • Quit the MacOS editor. Eject the USB adapter. Remove the micro-SD card and insert it in the Raspberry Pi. Now we can work on the RPi.

2. Boot and open ssh session

  • Insert the micro-SD card in the RPi3, connect the RPi3 to its power supply and switch power on. Wait for the green LED to stop blinking. It will take at least 5 minutes. Check in the list of terminals on your wi-fi router that a host machine named ubuntu has appeared. Here is the example from my home network. If no ubuntu has appeared, the most frequent cause is an erroneous indentation in either of the 2 files you have modified.
  • Logon remotely using ssh ubuntu@x.x.x.x (the IP address assigned by your router).

3. In ssh session, change password

We have seen in user-data that the default username is ubuntu and password is ubuntu. The password must be changed at first login. Here is an example of output of this first login, from my installation. There are 5 points to note:

  1. Lines 1–43, first ssh session prompt.
  2. Lines 44–50, password is changed
  3. Lines 50–53, after the password is changed, the ssh session closes. We must start a new ssh session.
  4. Lines 54–65, obeying to the warning that the RPi must be restarted, we order the RPi to shutdown and restart (sudo shutdown now -r). The ssh session is closed.
  5. Lines 66–71, we wait for restart, and initiate again from the MacBook a new ssh session.

Get latest Ubuntu upgrades

This is a good practice with all newly installed Linux systems.

ubuntu@ubuntu:~$ sudo apt update
ubuntu@ubuntu:~$ sudo apt upgrade

Change hostname to ipfs-pi64

To be as close as possible to the Raspbian installation, let’s change the hostname from the default ubuntu to ipfs-pi64. We have to do it manually using the command hostnamectl because unlike with the Raspbian install, the script raspi-config doesn’t exist in Ubuntu.

Again we have to restart the RPi (sudo shutdown now -r) to make the WiFi network sees the new hostname.

Install Avahi, local Domain Name Server

To be as close as possible to the Raspbian installation, let’s install Avahi. It allows us to use the hostname instead of the IP address each time we initiate a ssh session.

ubuntu@ubuntu:~$ sudo apt-get install avahi-daemon

Wait a while for Avahi to be installed and to broadcast its service over the network. Then we ping the RPi3 by its hostname with the domain extension local. If successful, we exit ssh and login again by the hostname, this is explained in Part 2b.

ubuntu@ubuntu:~$$ ping  ipfs-pi64.local
ubuntu@ubuntu:~$$ exit
MBP18VTK:~ kvutien$ ssh ubuntu@ipfs-pi64.local

What have we achieved?

We have gone through steps 1 to 3 inclusive as in Raspbian but this time with 64-bit Ubuntu. We made the Raspberri Pi visible on Wi-Fi as a distinct host.

  1. We burned the boot micro-SD card with Ubuntu Server 64-bit and configured it for wi-fi access.
  2. We booted the Rasperry Pi and opened the ssh session.
  3. In ssh session, we installed the tools to make our RPi as similar as possible to the Raspbian version. We also changed hostname and password.

What remains to do now is to make it recognize the SSD (Solid State Disk) on startup and install it as an IPFS node. For this, continue with the steps 4, 5, 6 and 7 explained in Part 2b of this article.

And if you feel like it, join Machu Picchu. It’s an open source and collaborative project to help humanitarians. Update of November 2021: a video of “Machu Picchu in 40 seconds”: https://youtu.be/MRz5oKHRg-8

--

--

--

Machu Picchu — Data as a Public Service

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Creating Presentation Slides Directly Inside Exploratory

4 Advancements That Led to StorX Decentralized Cloud Storage

Insertion Sort

Docker 102: Docker-Compose

Search Engine

Everseed, the first free to Play and Own/Play and Earn game in the making

Upload csv files to Postgresql (AWS RDS) using python’s Psycopg2

How To Setup your Validator Node (Matic Staking Testnet) Option“2”

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Khang Vu Tien

Khang Vu Tien

Machu Picchu — Data as a Public Service

More from Medium

How to set up an Ethereum node cluster

Message to Martians Roadmap

How to use a Merkle Tree for large whitelist mints

Top Blockchains to Develop dApps in 2022