Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Raspberry Pi 3 Alpine Linux Skywire Node
I wanted to get this up quickly but there are some enhancements I would like to make. This guide would not be possible without the help of our telegram group and specifically user asxtree. I'm borrowing from him and copied and pasted some of his text. I included it here to simplify workflow. I'm assuming that you have a RPi with Noobs, Rasbian, or Ubuntu.

1. You will need:
  • RPi 3 with a working raspian or ubuntu operating system connected to your network.
  • USB SD card reader
  • Blank SD card
2. Set-up your SD card. Attach the card reader to the RPi. Login to your RPi and gain root.
$ sudo su

We will need to determine the name of your SD card.
# fdisk -l

You will see.
Disk /dev/sda: 14.9 GiB, 15931539456 bytes, 31116288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start      End  Sectors  Size Id Type
/dev/sda1        8192 31116287 31108096 14.9G  c W95 FAT32 (LBA)

Your SD card is /dev/sda. We need to partition the card.
# fdisk /dev/sda

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): o
Created a new DOS disklabel with disk identifier 0x79cf80e5.

Command (m for help): n
Partition type
  p   primary (0 primary, 0 extended, 4 free)
  e   extended (container for logical partitions)
Select (default p):

Using default response p.

Partition number (1-4, default 1): 
First sector (2048-31116287, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-31116287, default 31116287): +150M

Created a new partition 1 of type 'Linux' and of size 150 MiB.

Command (m for help): t
Selected partition 1
Partition type (type L to list all types): c
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now

That created the first partition. Now we will create the second partition.
Command (m for help): n
Partition type
  p   primary (1 primary, 0 extended, 3 free)
  e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (309248-31116287, default 309248):
Last sector, +sectors or +size{K,M,G,T,P} (309248-31116287, default 31116287):

Created a new partition 2 of type 'Linux' and of size 14.7 GiB.

Now let's check and see if it looks right. 
Command (m for help): p
Disk /dev/sda: 14.9 GiB, 15931539456 bytes, 31116288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x79cf80e5

Device     Boot  Start      End  Sectors  Size Id Type
/dev/sda1  *      2048   309247   307200  150M  c W95 FAT32 (LBA)
/dev/sda2       309248 31116287 30807040 14.7G 83 Linux

Looks good. Let's write it.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

The partitions are there so now let's create the filesystems on each partition. 
This is the FAT32 boot partition.
# mkfs -t vfat -F 32 /dev/sda1

mkfs.fat 4.1 (2017-01-24)
Make the linux filesystem
# mkfs -i 8192 -t ext4 /dev/sda2

Creating filesystem with 3850880 4k blocks and 1925760 inodes
Filesystem UUID: a21cd180-f362-48e2-b6b5-f2b4819fb84f
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done  

Now we need to get the Alpine image onto the boot partition and untar it there.
root@raspberrypi:/# mkdir /media/sda1
root@raspberrypi:/# mount /dev/sda1 /media/sda1
root@raspberrypi:/# cd /media/sda1/
root@raspberrypi:/media/sda1# wget

root@raspberrypi:/media/sda1# tar -xvf alpine-rpi-3.7.0-armhf.tar.gz

You have to add this simple config file.
vi usercfg.txt
Hit the i key
add a new line that says "enable_uart=1" without the quotation marks. Hit Esc, colon key, w,q

I was having trouble with Raspian holding onto a device despite it being unmounted and ejected. There is an apk for eject. Unmount and eject the SD card. 
apk add eject
umount /media/sda1
eject /dev/sda

 Unplug the power.  Plug in the new SD. Connect HDMI, Network cable, and keyboard. Connect the power.
rpi login: root

rpi:~# setup-alpine

For most options you will be choosing the defaults.
Choose your keyboard
Choose a hostname
default [eth0]
default [dhcp]

##Note the IP address for eth0

set your new root password
confirm it
default [UTC]
Proxy is the default [none]
choose your mirror. I did [f] the first time but after that I chose the mirror that was the fastest.
default [openssh]
default [chrony]
where to store configs type "none" without the quotes
apk cache type "none" without the quotes
apk update

Now let's get it ready to accept an ssh connection from your computer so you can cut and paste these commands instead of typing.
apk add sudo
adduser -h /home/pi pi
adduser pi wheel

Uncomment line #82   wheel ALL=(ALL) ALL
arrow down to line 82. hit i, uncomment the line. hit esc then type :wq

You should be all good to remote login to your Pi. From your computer type:
ssh pi@the IP I told you to note earlier.enter your password

Let's continue setting up Alpine. RPi has no battery for the hardware clock so we need to sync with an NTP server.

apk add chrony  
service chronyd restart
apk add e2fsprogs
mount /dev/mmcblk0p2 /mnt  
setup-disk -m sys /mnt
mount -o remount,rw /dev/mmcblk0p1
rc-update del hwclock boot
rc-update add swclock boot
service hwclock stop
service swclock start  

rm -f /media/mmcblk0p1/boot/*  
cd /mnt       # We are in the second partition
rm boot/boot  # Drop the unused symbolink link

Move the image and init ram for Alpine
mv boot/* /media/mmcblk0p1/boot/  
rm -Rf boot
mkdir media/mmcblk0p1
ln -s media/mmcblk0p1/boot boot

Update /etc/fstab
echo "/dev/mmcblk0p1 /media/mmcblk0p1 vfat defaults 0 0" >> etc/fstab
sed -i '/cdrom/d' etc/fstab
sed -i '/floppy/d' etc/fstab
sed -i '/edge/s/^#//' etc/apk/repositories
cd /media/mmcblk0p1

For the next boot, indicate that the root filesystem is on the second partition:
sed -i 's/^/root=\/dev\/mmcblk0p2 /' cmdline.txt

Log back in to your RPi with ssh and su for root access.
apk update
apk upgrade
apk add go git musl-dev make
go get -u
go get -u

Edit /etc/profile with gopath.
vi /etc/profile
add "export GOPATH=$HOME/go" without quotes to the file.
Hit esc and then :wq
You're all set. Now you can proceed with configuring the Skywire node.
[-] The following 1 user says Thank You to Bobbyhchrist for this post:
  • skyguy
Nice. I tried installing Alpine and got completely lost. Will give it another go using this guide. Thanks!

Forum Jump:

Users browsing this thread: 1 Guest(s)