download alpine linux raspberry pi images
To download official Alpine Linux images for your Raspberry Pi, visit the Alpine Linux Downloads page. Scroll down to the "Raspberry Pi" section and select the exact architecture matching your specific device model to begin the download:
Architectures
- AArch64 (ARM64): Recommended for Raspberry Pi 4, 5, 3 Model B, and Zero 2 W.
- ARMv7: Best for Raspberry Pi 2 and early Pi 3 models.
- ARMhf: Intended for legacy, first-generation Pi models and the original Pi Zero.
Once downloaded, the file will arrive as a .tar.gz archive containing the core OS files.
For a Raspberry Pi 3B+, the AArch64 (64-bit) image is the best and most future-proof choice. The "Pi 3+" mentioned on the Alpine page refers to the Raspberry Pi 3B+.
Choosing Between ARMv7 and AArch64 for the Pi 3B+
AArch64 (64-bit)
Pros:
- Better performance for modern crypto functions, media encoding, and 64-bit optimized software.
- Essential for running modern Docker containers, as many developers no longer build 32-bit images. Cons:
- Marginally higher memory consumption, which is a slight drawback on the 3B+'s limited 1GB of RAM.
ARMv7 (32-bit)
Pros:
- Slightly lower RAM overhead, leaving a tiny bit more of your 1GB free for applications. Cons:
- Missing out on hardware-level 64-bit instruction optimizations.
- Increasingly difficult to find compatible software packages and container images as the industry drops 32-bit support.
Choose AArch64 unless you are running an incredibly tight, RAM-starved application where every single megabyte matters.
Running Samba-DC on a Raspberry Pi 3B+
Running Samba-DC (Samba Active Directory Domain Controller) alongside isc-dhcp-server on a Raspberry Pi 3B+ places you exactly at the threshold of a "RAM-starved application where every megabyte matters."
The Active Directory Domain Controller role handles complex LDAP databases, Kerberos authentication systems, and DNS zones directly into memory for fast read operations.
Disk Footprint vs. Runtime Memory
The 200 packages and 77 dependencies primarily consume storage space on your MicroSD card, not runtime RAM. Alpine Linux packages are stripped of bloat, so installing those 200 packages might only take up 150–200 MB of disk space.
However, once you run samba-tool domain provision, those packages turn into running processes that must share your 1 GB of RAM.
The 64-Bit Memory Penalty for Samba-DC
If you run AArch64 (64-bit), every pointer in memory doubles from 32 bits to 64 bits. This architectural change causes a noticeable increase in RAM usage:
- The baseline penalty: An idle 64-bit Linux kernel and minimal userland use roughly 30–50 MB more RAM than a 32-bit equivalent.
- The process penalty: Samba Active Directory forks a separate process to handle GPO downloads every time a Windows client logs in. Under AArch64, each of these forks carries a higher memory overhead.
How Much RAM Will You Actually Have Left?
Because Alpine Linux operates as a "Run-from-RAM" (sys mode) OS by default, your entire base operating system is copied straight into a tmpfs RAM disk upon boot.
On ARMv7 (32-bit), an idle Alpine system boot uses roughly 40–60 MB of RAM. On AArch64 (64-bit), that base increases to roughly 90–110 MB.
When you launch Samba-DC and isc-dhcp-server, they will immediately claim another 150–250 MB of RAM just to keep the Active Directory database active.
Table: RAM Usage Comparison
| Architecture | Base Alpine OS | Idle Samba-DC + Bind9 | Remaining Free RAM (out of 1GB) |
|---|---|---|---|
| ARMv7 (32-bit) | ~50 MB | ~150 MB | ~800 MB available for AD cache & clients |
| AArch64 (64-bit) | ~100 MB | ~220 MB | ~680 MB available for AD cache & clients |
The Updated Recommendation If this Pi 3B+ is a dedicated Active Directory Domain Controller for a small home lab (under 10-15 users/devices), AArch64 is still perfectly fine. Having 680 MB of free RAM is more than enough to handle light AD traffic and Kerberos tickets.
However, you should pivot to ARMv7 (32-bit) if:
- This domain will support dozens of active devices simultaneously.
- You plan to stack other heavy services on this exact same Pi.
Using the Internal DNS Server
You do not need to run Bind9. Using the internal Samba DNS is actually the preferred architectural choice for a dedicated, small-footprint setup like yours.
Internal DNS vs. Bind9: Why Internal Wins Here
- Memory Efficiency: The internal DNS server runs inside the existing Samba master process. It does not spawn a heavy, independent daemon.
- Zero Configuration Integration: Active Directory relies heavily on dynamic DNS updates. The internal DNS handles this automatically.
Architecture Mismatches (32-bit vs. 64-bit Replication)
There is zero risk of incompatibility or data corruption when replicating Active Directory data between a 32-bit Alpine Pi and a 64-bit Ubuntu server.
Verification of Musl Compilation
You can verify that your Alpine Samba-DC packages are strictly bound to musl rather than glibc right from the official Alpine Linux Package Repository metadata.
The Naming Distinction: GLib vs. GLIBC
GLIBC (GNU C Library)
This is the core system C library used by distributions like Ubuntu and Debian.
GLib (Gnome Library)
This is a completely different, higher-level application utility library written by the GNOME project.
When Samba pulls in glib, it is using it strictly for data tracking and event handling loops.
Upstream Samba Support for Musl
Upstream Samba did not actually make a single, sudden "switch" to musl. Instead, their support for it evolved organically over several years.
Heimdal vs. MIT-KRB5 on Alpine
Yes, Alpine's samba-dc package is still compiled using the internal, embedded Heimdal Kerberos engine.
Formatting the MicroSD Card
Your current MicroSD layout is actually not suitable for how Alpine Linux boots on a Raspberry Pi.
To keep things incredibly reliable and simple, you should format the entire 256 GB card as a single, large FAT32 partition.
Step-by-Step: Formatting and Preparing the Card
- Wipe the old partition table:
sudo wipefs -a /dev/mmcblk0 - Create a single new partition:
sudo fdisk /dev/mmcblk0 - Format the partition to FAT32:
sudo mkfs.vfat -F 32 -n "ALPINE" /dev/mmcblk0p1 - Extract the Alpine image directly to the card:
sudo tar -zxvf alpine-rpi-3.24.x-aarch64.tar.gz -C /mnt/alpine
Configuring the Hybrid Setup
Keep Alpine running in its ultra-reliable, read-only Diskless Mode out of a small FAT32 partition.
Format the remaining space on your card as a dedicated Linux ext4 partition.
Configure Alpine to automatically mount that ext4 partition to a dedicated path like /var/lib/samba or /data at boot.
Step-by-Step: Setting Up the Hybrid Diskless Storage
- Set Up the Persistent Mount in
/etc/fstab - Install and Provision Samba-DC
- Make the Configuration Survive Reboots (
lbu)
Optimizing Boot Configuration Files
You do not need to add any special module configuration for ext4 to your cmdline.txt.
Alpine’s base Raspberry Pi kernel has the ext4 filesystem driver compiled directly into the kernel core.
Configuring cmdline.txt for Full Verbosity
Delete the words quiet and silent from cmdline.txt.
Add verbose to the line if it isn't already there.
Configuring usercfg.txt for a Headless Core Server
Disable the built-in Wi-Fi and Bluetooth radios. Allocate the absolute minimum amount of RAM to the GPU. Disable the audio hardware component.
Fixing the Emergency Shell Issue
Remove root=/dev/ram0 from cmdline.txt to fix the issue.
You can fix this directly from the emergency shell or by plugging the card back into your PC.
Next Steps
Now that the boot configuration files are fully optimized, you can configure the isc-dhcp-server configuration layout or initialize the setup-alpine script to assign the static IP interface.
Editing the cmdline.txt File
To edit the cmdline.txt file, use the BusyBox text editor. If you are working directly on the Raspberry Pi, you can access the file by typing:
vi /media/mmcblk0p1/cmdline.txt
Inside vi, press i to enter edit mode, completely delete the root=/dev/ram0 string, and ensure everything stays strictly on one single line. Your clean, optimal, verbose string must look exactly like this:
modules=loop,squashfs,sd-mod,usb-storage console=tty1 verbose
Press Esc, type :wq, and hit Enter to save and exit. Then type reboot to boot cleanly into the installer interface.
Alternative: Editing the File on Your PC
If the emergency shell is unresponsive, you can also edit the cmdline.txt file on your PC. To do this, pull the MicroSD card out of the Pi, slide it back into your PC, and open the cmdline.txt file located on your FAT32 ALPINE_BOOT partition. Wipe out the root= parameter entirely and save the file, ensuring your text editor does not add any accidental line breaks.
Booting into Alpine Setup
Once you restore the single line and boot the Pi, you will be met with a cascade of verbose logging followed by a standard login prompt. Log in using the username root (there is no password assigned yet). Launch the interactive installation script by typing:
setup-alpine
If you encounter issues with the /media/mmcblk0p1 directory not being present, it's likely because the boot process crashed during the initial init script loop, preventing Alpine's automated scripts from creating the /media directories or mounting the SD card. In this case, you can manually mount the partition and edit the cmdline.txt file.
Manually Mounting the Partition
To manually mount the partition, follow these steps:
- Create a temporary mount point by typing:
mkdir /boot_media
- Manually mount your FAT32 partition to the newly created directory:
mount -t vfat /dev/mmcblk0p1 /boot_media
If the terminal throws an error about vfat, simply drop the type flag and run:
mount /dev/mmcblk0p1 /boot_media
- Edit the
cmdline.txtfile using BusyBox's built-in text editor:
vi /boot_media/cmdline.txt
Inside the editor:
- Move the cursor over to the
root=/dev/ram0text. - Press
ito enter Insert Mode. - Backspace/delete
root=/dev/ram0completely. - Ensure the entire configuration text remains on one single line.
- Press
Escto exit editing mode. - Type
:wqand pressEnterto save the file and exit.
- Reboot the Pi by safely unmounting the media to flush the changes to the card, then restarting the system:
umount /boot_media
reboot
The Pi 3B+ will now bypass the crash loop, read the corrected line, extract Alpine's components cleanly into memory, and drop you directly into the clean login prompt.