
Installing Alpine Linux on STB BH860
Installing Alpine Linux on STB BH860
Background
After various experiments, I found the most stable method to run Alpine Linux on the STB BH860 (Amlogic S905X): leveraging the kernel and initramfs from Armbian Ophub, which has proven compatible with this device. This approach avoids driver issues and boot failures that frequently occur when using a generic Alpine kernel. This technique is commonly known as a Franken-Distro or Rootfs Swapping.
Prerequisites
- System on eMMC:
- Armbian Ophub is already installed and running normally on the internal memory (eMMC). This guide assumes your device also has Armbian Ophub installed on eMMC. However, this is not strictly required — you can use any OS on eMMC, though the installation process will differ accordingly.
- SD Card:
- Contains the same version of Armbian Ophub as the one on eMMC (make sure it boots normally before making any modifications).
- Internet connection:
- An internet connection and LAN cable, which will be used in Armbian to download Alpine packages.
1. Preparing the Environment
- Do not insert the SD card during initial boot. Power on the STB BH860 without the SD card to ensure the system boots from eMMC (Armbian Ophub).
- Once the boot process is complete, insert the SD card containing Armbian Ophub.
2. Identifying the SD Card Partition
In the Armbian terminal (eMMC), run:
lsblk
Example output:
mmcblk0boot0 179:8 0 4M 0 disk
mmcblk0boot1 179:16 0 4M 0 disk
mmcblk0 179:0 0 15G 0 disk
├─mmcblk0p1 179:1 0 256M 0 part /boot
├─mmcblk0p2 179:2 0 15G 0 part /
mmcblk1 179:24 0 30G 0 disk
├─mmcblk1p1 179:25 0 256M 0 part
└─mmcblk1p2 179:26 0 30G 0 part
mmcblk0: The eMMC device (main Armbian system).mmcblk1: The SD card (to be converted to Alpine Linux).mmcblk1p2: The root partition to be replaced with Alpine.
3. Mount the SD Card Partition
mkdir -p /mnt/alpine-root
mount /dev/mmcblk1p2 /mnt/alpine-root
4. Replace the RootFS with Alpine Linux
Download and extract the Alpine rootfs directly on the STB:
cd /tmp/
wget https://dl-cdn.alpinelinux.org/alpine/v3.23/releases/aarch64/alpine-minirootfs-3.23.2-aarch64.tar.gz
sudo tar xvf alpine-minirootfs-3.23.2-aarch64.tar.gz -C /mnt/alpine-root
5. Copy Kernel Modules from Armbian Ophub
Kernel modules from eMMC must be copied to the SD card so that hardware (Ethernet, USB, HDMI) is detected by Alpine:
cp -r /lib/modules/* /mnt/alpine-root/lib/modules/
Verify:
ls /mnt/alpine-root/lib/modules
6. Basic Configuration via Chroot
Set up the chroot environment:
mount -t proc /proc /mnt/alpine-root/proc
mount -t sysfs /sys /mnt/alpine-root/sys
mount -o bind /dev /mnt/alpine-root/dev
mount -o bind /etc/resolv.conf /mnt/alpine-root/etc/resolv.conf
Enter the Alpine environment:
chroot /mnt/alpine-root /bin/sh
Inside Chroot:
a. Set Repositories and Update
echo "https://dl-cdn.alpinelinux.org/alpine/v3.23/main" > /etc/apk/repositories
echo "https://dl-cdn.alpinelinux.org/alpine/v3.23/community" >> /etc/apk/repositories
apk update
b. Install Essential Packages
apk add openssh ntpd bash nano
c. Network Configuration
Ethernet Interface (DHCP):
cat > /etc/network/interfaces <<EOF auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp EOFDNS:
echo "nameserver 8.8.8.8" > /etc/resolv.conf echo "nameserver 1.1.1.1" >> /etc/resolv.confEnable Networking Services:
rc-service networking start rc-update add networkingNTP:
rc-update add ntpd default ntpd -q -p pool.ntp.org
d. Allow Root Login via SSH
sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
grep -q "PermitRootLogin" /etc/ssh/sshd_config || echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
rc-update add sshd
e. Finalization
passwd # Set the root password for Alpine
echo "Nixpoin-alpine" > /etc/hostname
exit # Exit chroot
7. Clean Up and Unmount
umount -l /mnt/alpine-root/{proc,sys,dev,etc/resolv.conf,}
umount /mnt/alpine-root
8. Reboot and Boot from SD Card
- Shut down the STB:
poweroff - Make sure the SD card remains inserted.
- Power on the STB.
- If your U-Boot supports automatic boot order, the system will boot from the SD card.
System Verification
After booting into Alpine:
- Check kernel and modules:
uname -r # Ensure the kernel version matches Armbian Ophub lsmod # Verify hardware modules are loaded - Check system time:
date # Time should be accurate thanks to NTP
Troubleshooting
Common Issues
It is recommended to connect the STB to a monitor via HDMI cable on the first boot, so you can see whether it successfully boots into Alpine or not.
Ethernet not detected: Make sure all kernel modules from
/lib/modulesin Armbian have been copied. Check withdmesg | grep eth.Cannot log in as root via SSH: Check the
/etc/ssh/sshd_configconfiguration and ensure there is no typo inPermitRootLogin yes.Boot failure: Since we are not modifying
/boot, the issue usually lies in:- The root partition (
mmcblk1p2) not being readable (check the SD card connection). - Incompatible kernel modules (make sure the kernel version on eMMC and the SD card are exactly the same).
- The root partition (
Important Notes
- Do not delete Armbian on eMMC: This system acts as a “rescue” if Alpine on the SD card fails to boot. Simply remove the SD card to return to Armbian.
(This article is based on the author’s personal experience. Proceed at your own risk.)
References:
