Skyminer with archlinuxARM
1) Download Archlinux ARM image:
Select the image appropriate for your board.
extract the image once you have downloaded the archive
The extension of the extracted file should be .img
The size of the extracted file will be approximately 1.5 gigabytes
2) MicroSD setup
Write the image you have downloaded and extracted to the drive
2.1) Determine block device
First, determine the block device which represents the microSD card
lsblk
the command will output something like this:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 111.8G 0 disk
├─sda1 8:1 0 512M 0 part
└─sda2 8:2 0 111.3G 0 part /
sdb 8:16 0 1.8T 0 disk
├─sdb1 8:17 0 512M 0 part
└─sdb2 8:18 0 1.8T 0 part /node
sdX 8:16 0 16G 0 disk
in this example, ‘sdX
’ is the microSD we want to write the image to. It will be something else for you.
2.2) Writing the image to the microSD
DOUBLE CHECK TO MAKE ABSOLUTELY CERTAIN THE BLOCK DEVICE YOU ARE WRITING TO IS THE INTENDED TARGET OR RISK OVERWRITING YOUR OTHER DISKS!!!
substituite the block device representing your microSD card in one of the commands below
using dd
sudo dd if=/path/to/rpi-4-arch-linux-20211017.img of=/dev/sdX
or, using dcfldd
(faster?)
sudo dcfldd if=/path/to/rpi-4-arch-linux-20211017.img of=/dev/sdX
Do not close the terminal or remove the microSD card until the command has completed
When the command has completed, the image is written to the disk.
2.3) Expanding the root filesystem
Expand the root filesystem partition to occupy the remaining space on the microSD.
This can be done with any one of several tools: parted, gparted, gnome-disks, etc.
Using gnome-disks (a.k.a. gnome-disk-utility) is likely the easiest method.
Launch gnome-disks, select from the left column the “disk” which represents the microSD.
Select the root filesystem partition from Volumes
Below the selection are three buttons, the rightmost is a button with two gears
Click the button with the gears to see additional partition options
Select the fifth option from the top which says “Resize…"
A window will appear with a slider. Drag the slider all the way to the right, then click “resize” in the top right corner of the window.
The partition will be resized, but it is mounted in doing so.
Click the square (first button) in the row underneath the Volume selection to unmount it. The icon on the button will change to a triangle.
It should now be safe to remove the microSD card
3) OS configuration
3.1) Boot and establish the SSH session
Insert the microSD card, ssh to the board.
in the ssh command below, substituite the IP address of the board on the network.
To determine the IP address, check your router’s web interface.
It is typically one of the following:
if it is not one of these two ip addresses, the label on the router should tell you what the default interface address is.
Another way to determine the IP address of the router, if you are connected to it, check the IP address of your machine.
For example, if your computer’s IP address is 192.168.254.115, it is likely that you will find the router’s interface at 192.168.254.1
ssh alarm@192.168.0.2
if your router can work with hostnames, you can use this:
ssh alarm@alarm
- Login as the default user alarm with the password alarm.
- The default root password is root.
Change to the root user
su - root
3.2) Initial OS config
run the following commands (as root):
pacman-key --init
pacman-key --populate archlinuxarm
pacman -Syu git libnewt wget
To make downloading packages faster:
nano /etc/pacman.conf
Scroll down to
#ParallelDownloads = 5
Uncomment this line by removing the leading # and if desired, change 5 to 8 or however many parallel downloads you want to run. For my ISP 8 works well.
Save the file (ctrl X, type y, press enter)
then
systemctl reboot
4) EndeavourOS-ARM and skywire installation
(say goodbye to errors caused by not setting the time and other basic things)
SSH to the board again when it has booted and log back in with root.
4.1) installing EndeavourOS-ARM
Install EndeavourOS on the device with the following commands:
git clone https://github.com/endeavouros-arm/install-script.git
cd install-script
chmod +x *.sh
./endeavour-ARM-install-V2.X.sh
You will be greeted with a graphical installer session; similar to any linux installer.
Complete the steps. You only need a server installation for skywire, but if you have a board with more ram you can install a desktop if desired.
Reboot once you have finished the installation and log in as the user you created.
4.2) installing skywire
All the tools of endeavourOS are at hand and the system is updated and ready to install skywire (or any other skycoin software), which can be done with just one command:
yay -S skywire
When the postinstall script is executed, skywire will be configured and started as hypervisor with no additional configuration necessary.
5) Build Images yourself
Note: this step is not required
This information has been included for reference or advanced users
The images provided have been created using a script that was adapted into the PKGBUILD format
This script is executed by makepkg
for archlinux users, the script may be run as follows to create the base image:
mkdir ~/img && cd ~/img
curl https://downloads.magnetosphere.net/img/IMGBUILD -o IMGBUILD
chmod +x IMGBUILD
edit the file at this point to select the board you are building for. The rpi3b+ may work with the image for the 4.
then, execute the script
./IMGBUILD
the image will populate in the current directory
6) Cluster deployment
The cluster deployment approach discussed here configures update mirrors and / or a local package repository.
The two strategies for this were taken from the archwiki article: Pacman tips & tricks
(This assumes you have already deployed one image / board and that your other boards are the same type of board or the same architecture)
6.1) Creating a Custom local package repository
Pacman tips & tricks | custom local package repository
On the first board you have deployed
create a local package repository which contains the built skywire package you wish to share with other nodes
sudo repo-add /var/cache/pacman/pkg/hypervisor.db.tar.gz $HOME/.cache/yay/skywire/skywire-*.pkg.tar.xz
sudo repo-add /var/cache/pacman/pkg/hypervisor.db.tar.gz $HOME/.cache/yay/skywire/skywire-*.pkg.tar.zst
(depending on the extension of the created package)
Copy the package from yay’s cache to pacman’s cache
cp $HOME/.cache/yay/skywire/skywire*.pkg.tar.* /var/cache/pacman/pkg/
Repeat with any additional packages from yay’s cache that you want to share
6.2) Update mirror
Pacman tips & tricks | read-only package cache
On the first board you have deployed
Symlink your sync repositories to pacman’s cache, and host the folder on the local network with any webserver. The article suggests darkhttpd. The port has been changed from the default in the article.
sudo ln -sf /var/lib/pacman/sync/*.db /var/cache/pacman/pkg
sudo -u http darkhttpd /var/cache/pacman/pkg --no-server-id --port 8079
Note: the webserver will need to be running for the other nodes to retrieve update
Note: always update the software on the hypervisor first before attempting to update other nodes
to update:
yay -Syy && yay -Syu
or, the same as above only shorter
yay
6.3) Building images for cluster deployment
Base images do not have the hypervisor as an update mirror, nor do they have the package repository configured (both of which are hosted by the hypervisor).
It would be necessary to change the configuration from the SSH session if it was not done in one image. Once you have created one image, it should be possible to reuse that on the rest of your cluster, unless you require ip-preset images. The hypervisor is the only board that needs to maintain the same ip address; dhcp is usually good enough as the boards come back with the same ip when they are rebooted or removed from and re-inserted into the network.
to partially reiterate the earlier section with additional context:
The base images provided have been created using a script that was adapted into the PKGBUILD format
This script is executed by makepkg
It is suggested to do this on the on the first board / hypervisor instance
for archlinux users, the script may be run as follows
mkdir ~/img && cd ~/img
curl https://downloads.magnetosphere.net/img/IMGBUILD -o IMGBUILD
chmod +x IMGBUILD
edit the file to select the board you are building an image for.
nano IMGBUILD
The rpi3b+ may work with the image for the 4.
For cluster deployments uncomment the lines in the build()
function and change the ip address to the ip address of the board you are using.
you can find the ip address of your board with ifconfig
(deprecated) or ip link
commands
The commands listed below should follow the extraction of the root filesystem and the modifications made to it; and precede the unmounting of the root filesystem
sudo echo "Server = http://192.168.0.2:8079/" > arch-root/root/mirrorlist
sudo cat arch-root/etc/pacman.d/mirrorlist >> arch-root/root/mirrorlist
sudo mv arch-root/root/mirrorlist arch-root/etc/pacman.d/mirrorlist
sudo cat arch-root/etc/pacman.conf > arch-root/root/pacman.conf
sudo echo -e "[hypervisor]\nInclude = /etc/pacman.d/mirrorlist\nSigLevel = Never" >> arch-root/root/pacman.conf
sudo mv arch-root/root/pacman.conf arch-root/etc/pacman.conf
if you are building all these from source on desktop; append -cluster
to the image name of the image being crated (before the extension) to avoid confusion or overwriting the first image you created.
then, execute the script
./IMGBUILD
the image will populate in the current directory
Repeat steps 2, 3, and 4 for every board you are adding to your cluster using the image created in this step.
7) Tips & troubleshooting
If you have more than one board, it may be necessary to install and use macchanger so that the mac addresses are unique, in order to avoid IP conflicts. You will need to create a systemd service for that, as the AUR package for macchanger does not include one.
macchanger can only be installed via the chroot when the image is being created (in the case of mac address or ip conflicts) and the systemd service you create for it must be enabled at boot.
an example of such a system.d service:
[Unit]
Description=Macchanger systemd service
After=network.target
Type=simple
ExecStart=/usr/bin/macchanger
[Install]
WantedBy=multi-user.target
place this file in either /etc/systemd/system/
or /usr/lib/systemd/system/
then, be sure to enable the service before exiting the chroot.
8) Updates
To update your archlinuxARM / eos-arm cluster; always begin by updating the first board (a.k.a. the hypervisor)
8.1) updating the hypervisor
using yay:
yay
the above is the same command as
yay -Syy && yay -Syu
the above is a wrapper for
sudo pacman -Syy && sudo pacman -Syu
the yay
command will also update any AUR packages (pacman will not)
to explicitly update skywire, you can use any of the AUR package variants
for a package built from the source archive of the latest versioned release:
yay -S skywire
for a package which sources the binary release of skywire:
yay -S skywire-bin
to manually build and install the package without using yay
cd $HOME/.cache/yay/
rm -rf skywire
git clone https://aur.archlinux.org/skywire
cd skywire
makepkg -if
check that the update was successful and that the expected functionality exists before continuing.
8.2) Updating packages in the hypervisor package repo
add the packages to the hypervisor repo
sudo repo-add /var/cache/pacman/pkg/hypervisor.db.tar.gz $HOME/.cache/yay/skywire/skywire-*.pkg.tar.xz
sudo repo-add /var/cache/pacman/pkg/hypervisor.db.tar.gz $HOME/.cache/yay/skywire/skywire-*.pkg.tar.zst
Copy the package from yay’s cache to pacman’s cache
cp $HOME/.cache/yay/skywire/skywire*.pkg.tar.* /var/cache/pacman/pkg/
8.3) Refresh the hypervisor’s update mirror
Symlink your sync repositories to pacman’s cache, and host the folder on the local network with any webserver.
sudo ln -sf /var/lib/pacman/sync/*.db /var/cache/pacman/pkg
sudo -u http darkhttpd /var/cache/pacman/pkg --no-server-id --port 8079
8.4) Update the cluster
the rest of the boards in the cluster can now be updated with any of the following commands
yay
yay -Syy && yay -Syu
sudo pacman -Syy && sudo pacman -Syu