id: 2754302
title: "Tutorial: Alpine Linux on Raspberry Pi 3 with Syncthing, OpenVPN and Docker"
published: true
tags: ["raspberrypi", "alpinelinux", "docker", "syncthing"]
series: I Fixed It and I Don't Know How
description: "Advanced Alpine Linux installation on a Raspberry Pi 3 with disk migration, Syncthing configuration, OpenVPN, Docker and common error resolution."
canonical_url: "https://dev.to/ivajofranc/tutorial-alpine-linux-on-raspberry-pi-3-with-syncthing-openvpn-and-docker-2932"
cover_image: "https://media2.dev.to/dynamic/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F670e8xzuffugf407bj2l.png"
Tutorial: Alpine Linux on Raspberry Pi 3 with Syncthing, OpenVPN and Docker
🇪🇸 Lee también este post en español
📝 Detailed Installation and Configuration Tutorial for Alpine Linux (Raspberry Pi 3)
🧑 User
User: test
🔧 General Objective
This tutorial aims to guide you step by step to:
- Install Alpine Linux on a Raspberry Pi 3 (v1).
- Migrate the system from SD storage to an external hard drive.
- Configure services like Syncthing, OpenVPN, Docker, and system tools.
- Resolve common errors (permissions, ARM architecture, inotify, apk package issues).
🟢 STEP 1: Alpine Installation on SD (sys mode)
- Download the official Alpine aarch64 image from alpinelinux.org.
- Flash the image to the SD card (example using
dd
on Linux):
sudo dd if=alpine-rpi-*.img of=/dev/sdc bs=4M status=progress
sync
- Connect the SD to the RPi and run the installer:
setup-alpine
Make sure to select diskless mode sys
.
- Verify that Alpine boots in persistent mode:
mount | grep 'on /'
# /dev/sdb2 on / type ext4 (rw,relatime)
🟢 STEP 2: Clone the system to Hard Drive
Mount the external hard drive (e.g.:
/dev/sdb2
) to/mnt/usbroot
.Copy the SD content to the hard drive:
rsync -aAXv /mnt/sd/ /mnt/usbroot/
- Edit
/boot/cmdline.txt
and adjust the rootfs UUID:
root=UUID=11112222-3333-4444-aaaa-bbbbccccdddd modules=sd-mod,usb-storage,ext4 rootfstype=ext4
Edit
/mnt/usbroot/etc/fstab
to reflect the new UUID.Remove the SD card (leave only the boot) and boot from the disk.
🟢 STEP 3: Manual Syncthing installation
🔄 Download and install the latest version
wget https://github.com/syncthing/syncthing/releases/download/v1.27.8/syncthing-linux-arm64-v1.27.8.tar.gz
tar -xzf syncthing-linux-arm64-v1.27.8.tar.gz
sudo mv syncthing /usr/bin/
sudo chmod +x /usr/bin/syncthing
📆 Create OpenRC service for Syncthing
sudo vi /etc/init.d/syncthing.test
Script content:
#!/sbin/openrc-run
name="Syncthing"
description="Syncthing service"
command="/usr/bin/syncthing"
command_args="--no-browser --gui-address=0.0.0.0:8384"
command_user="test"
depend() {
need net
}
Enable the service:
sudo chmod +x /etc/init.d/syncthing.test
sudo rc-update add syncthing.test default
sudo rc-service syncthing.test start
🟢 STEP 4: Increase inotify watches
sudo sysctl fs.inotify.max_user_watches=65536
echo "fs.inotify.max_user_watches=65536" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
🟢 STEP 5: Configure OpenVPN Client
- Install OpenVPN:
sudo apk add openvpn openrc
Copy the
.ovpn
file as/etc/openvpn/client.conf
.Remove or comment the
register-dns
line if it exists.Create
/dev/net/tun
if it doesn't exist:
sudo mkdir -p /dev/net
sudo mknod /dev/net/tun c 10 200
sudo chmod 600 /dev/net/tun
- Start OpenVPN:
sudo rc-service openvpn start
🟢 STEP 6: Docker & Docker Compose Installation
sudo apk add docker docker-cli containerd docker-cli-compose
sudo rc-update add docker default
sudo rc-service docker start
Verify the installation:
docker version
docker compose version
🔴 Issues encountered and solutions
Syncthing auto-update (permission denied)
-
Cause: Syncthing tries to auto-update in
/usr/bin/
without permissions. - Solution: Update manually from GitHub as in STEP 3.
apk issues with Syncthing and Neofetch
- Syncthing: Didn't work due to incomplete repos ➔ manual download.
- Neofetch: Installed by cloning from GitHub.
vcgencmd
not available
- Cause: Missing Linux headers.
-
Alternative solution: Scripts from
/sys/class/thermal/
.
u2vpodcast
Docker image (amd64 on ARM)
-
build-arm64.sh
generated invalid tags.
Corrections:
docker buildx build --platform linux/arm64 -t atareao/u2vpodcast:arm64 .
📚 Useful Links
- Alpine Linux Documentation
- Syncthing Downloads
- OpenVPN Wiki
- Docker Buildx Guide
- Syncthing FAQ - inotify
- Docker Compose V2
- u2vpodcast Repo - Atareao
🧹 Final Considerations
- Automate Syncthing updates via root script.
- Search for or build optimized ARM64 image of u2vpodcast.
- Replace
vcgencmd
with readings from/sys/class/thermal/
. - Create a watchdog script for OpenVPN.
Top comments (0)