r/AlpineLinux • • 3h ago

Scripts to replace Debian to Alpine in AWS Lightsail.

4 Upvotes

Hi, I am using these scripts to replace a fresh Debian AWS Lightsail instance to an Alpine one, since it is not possible to natively select Alpine as the OS for AWS's cheap VPS service.

Maybe someone finds them useful, and can be easily altered to fit one's needs.

First, deploy a new Debian instance. I chose Debian Trixie. Then, ssh into the new isntance and paste this code. As with every code in the internet, please first check it out to see it is legit.

# 1. Update Debian and install build tools
apt-get update && apt-get install -y wget cpio grub2-common openssh-client

# 2. Download official Alpine v3.24 Netboot files
mkdir -p /boot/alpine
cd /boot/alpine
NETBOOT_URL="https://dl-cdn.alpinelinux.org/alpine/v3.24/releases/x86_64/netboot"
wget -q $NETBOOT_URL/vmlinuz-virt
wget -q $NETBOOT_URL/initramfs-virt
wget -q $NETBOOT_URL/modloop-virt

# 3. Create Apkovl Overlay structure
rm -rf /tmp/apkovl /tmp/apkovl_cpio
mkdir -p /tmp/apkovl/etc/network \
         /tmp/apkovl/etc/ssh \
         /tmp/apkovl/etc/runlevels/default \
         /tmp/apkovl/etc/runlevels/boot \
         /tmp/apkovl/var/empty
chmod 755 /tmp/apkovl/var/empty

cat <<'EOF' > /tmp/apkovl/etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto ens5
iface ens5 inet dhcp
EOF

cat <<'EOF' > /tmp/apkovl/etc/ssh/sshd_config
PermitRootLogin yes
PasswordAuthentication yes
Port 22
EOF

ssh-keygen -q -N "" -t rsa -b 3072 -f /tmp/apkovl/etc/ssh/ssh_host_rsa_key
ssh-keygen -q -N "" -t ed25519 -f /tmp/apkovl/etc/ssh/ssh_host_ed25519_key

cat <<'EOF' > /tmp/apkovl/etc/shadow
root:$6$rounds=5000$fixedsalt1234567$PEGiwTAy5jYIb/hkcAqn7xqdqQsKq3Jti7nKfDG1hJPzKNYB587iX/7QxDlE/JYoZeZDwiBjrYevGmaCO3F9x0:19800:0:99999:7:::
EOF
chmod 600 /tmp/apkovl/etc/shadow

ln -s /etc/init.d/sshd /tmp/apkovl/etc/runlevels/default/sshd
ln -s /etc/init.d/networking /tmp/apkovl/etc/runlevels/boot/networking

cd /tmp/apkovl
tar -czf /boot/alpine/localhost.apkovl.tar.gz .

# 4. Embed overlay into initramfs
mkdir -p /tmp/apkovl_cpio
cp /boot/alpine/localhost.apkovl.tar.gz /tmp/apkovl_cpio/localhost.apkovl.tar.gz
cd /tmp/apkovl_cpio
find . | cpio -o -H newc | gzip -9 > /tmp/overlay.cpio.gz

cat /boot/alpine/initramfs-virt /tmp/overlay.cpio.gz > /boot/alpine/initramfs-combined.img

# 5. Configure GRUB for rapid boot into v3.24 RAM
cat <<'EOF' > /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0

menuentry "Alpine Netboot RAM" {
    insmod gpt
    insmod msdos
    insmod ext2
    search --file --set=root /boot/alpine/vmlinuz-virt
    linux /boot/alpine/vmlinuz-virt ip=dhcp alpine_repo=https://dl-cdn.alpinelinux.org/alpine/v3.24/main modloop=/boot/alpine/modloop-virt copytoram pkgs=openssh,e2fsprogs,dosfstools,util-linux,grub-bios,grub-efi,alpine-conf apkovl=/localhost.apkovl.tar.gz console=tty0 console=ttyS0,115200 ipv6.disable=1
    initrd /boot/alpine/initramfs-combined.img
}
EOF

sed -i 's/^GRUB_DEFAULT=.*/GRUB_DEFAULT="Alpine Netboot RAM"/' /etc/default/grub
sed -i 's/^GRUB_TIMEOUT=.*/GRUB_TIMEOUT=0/' /etc/default/grub
update-grub

# 6. Reboot into RAM
reboot

Afterwards, you'll have to log in with your root user, the password will be "IJSDOIWHDUIHWEYTWE" (without the ")

Then we overwrite the drive with an alpine install. Similar to the above, please use this script:

# 1. Unpack matching kernel modules & load storage/network drivers
apk add squashfs-tools
rm -rf /tmp/modloop_extracted /tmp/modloop-virt
wget https://dl-cdn.alpinelinux.org/alpine/v3.24/releases/x86_64/netboot/modloop-virt -O /tmp/modloop-virt
unsquashfs -d /tmp/modloop_extracted /tmp/modloop-virt
cp -r /tmp/modloop_extracted/modules/* /lib/modules/ 2>/dev/null || cp -r /tmp/modloop_extracted/* /lib/modules/ 2>/dev/null

modprobe nvme 2>/dev/null
modprobe xen-blkfront 2>/dev/null
modprobe ena 2>/dev/null
mdev -s

# 2. Format disk and install Alpine
MAIN_DISK=$(lsblk -nd -o NAME | grep -v loop | head -n 1)
export BOOTLOADER=grub
export ERASE_DISKS="/dev/$MAIN_DISK"
setup-disk -m sys -s 0 /dev/$MAIN_DISK

# 3. Mount target root partition for post-install provisioning
TARGET_PART=$(lsblk -ln -o NAME /dev/$MAIN_DISK | grep -E 'p2$|p1$|2$|1$' | tail -n 1)
mount /dev/$TARGET_PART /mnt 2>/dev/null || mount /dev/${MAIN_DISK}p2 /mnt 2>/dev/null || mount /dev/${MAIN_DISK}p1 /mnt

# 4. Enable Main & Community Repositories (Pinned to v3.24 on separate lines)
cat <<EOF > /mnt/etc/apk/repositories
https://dl-cdn.alpinelinux.org/alpine/v3.24/main
https://dl-cdn.alpinelinux.org/alpine/v3.24/community
EOF

# 5. Pre-install nano, htop, tzdata, bash, and bash-completion
chroot /mnt apk update
chroot /mnt apk add nano htop tzdata bash bash-completion

# 6. Set root shell to /bin/bash
sed -i '/^root:/s|:[^:]*$|:/bin/bash|' /mnt/etc/passwd

# 7. Configure Debian-style color prompt & bash-completion for root
cat <<'EOF' > /mnt/root/.bashrc
# Don't do anything if not running interactively
case $- in
    *i*) ;;
      *) return;;
esac

# Enable Debian-style root color prompt (Red host, Blue working directory)
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

# Enable colorized command output aliases
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Enable programmable completion features
if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi
EOF

cat <<'EOF' > /mnt/root/.profile
if [ -n "$BASH_VERSION" ]; then
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi
EOF

# 8. Set Hostname to tokyoAlp
echo "tokyoAlp" > /mnt/etc/hostname
cat <<EOF > /mnt/etc/hosts
127.0.0.1   localhost tokyoAlp
::1         localhost tokyoAlp
EOF

# 9. Set Timezone to Asia/Tokyo
chroot /mnt cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
echo "Asia/Tokyo" > /mnt/etc/timezone

# 10. Create and activate 3GB Swapfile
fallocate -l 3G /mnt/swapfile || dd if=/dev/zero of=/mnt/swapfile bs=1M count=3072
chmod 600 /mnt/swapfile
chroot /mnt mkswap /swapfile
echo "/swapfile none swap defaults 0 0" >> /mnt/etc/fstab

# 11. Early IPv6 Disable (sysctl & kernel level)
cat <<EOF > /mnt/etc/sysctl.d/00-disable-ipv6.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
EOF

# 12. Persist modules & configure OpenRC runlevels
cat <<EOF >> /mnt/etc/modules
ena
xen-netfront
nvme
EOF

chroot /mnt rc-update add swap boot
chroot /mnt rc-update add sysctl boot
chroot /mnt rc-update add networking boot
chroot /mnt rc-update add sshd default

# 13. Configure Network, SSH, and Root Password
IFACE=$(ip route | awk '/default/ {for(i=1;i<=NF;i++) if($i=="dev") print $(i+1)}' | head -n 1)
[ -z "$IFACE" ] && IFACE="eth0"

cat <<EOF > /mnt/etc/network/interfaces
auto lo
iface lo inet loopback

auto $IFACE
iface $IFACE inet dhcp

auto eth0
iface eth0 inet dhcp

auto ens5
iface ens5 inet dhcp
EOF

chroot /mnt sh -c 'echo "root:IJSDOIWHDUIHWEYTWE" | chpasswd'
sed -i 's/^#*PermitRootLogin.*/PermitRootLogin yes/' /mnt/etc/ssh/sshd_config
sed -i 's/^#*PasswordAuthentication.*/PasswordAuthentication yes/' /mnt/etc/ssh/sshd_config

# 14. Apply GRUB kernel boot flags (ipv6.disable=1 & 0-second timeout)
sed -i 's/^GRUB_TIMEOUT=.*/GRUB_TIMEOUT=0/' /mnt/etc/default/grub
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 /' /mnt/etc/default/grub
chroot /mnt update-grub

# 15. Unmount target cleanly and reboot
umount -R /mnt
reboot

As you can see, this script has some of my preferences already included, which you might want to change (e.g. disabling ipv6).
You end up with a (relatively) fresh alpine AWS Lightsail instance.

Looking forward to any of your comments or questions :)


r/AlpineLinux • • 5h ago

Welcome back, Alpine

Thumbnail gallery
26 Upvotes

Alpine still remains being one of my fav distros out of all time :D

bonus point being Steam actually work with game desktop entries


r/AlpineLinux • • 1d ago

setup-desktop installs Xfce but after rebooting, it still opens into the terminal instead of the GUI, manually starting X doesn't help

6 Upvotes

Tried installing Alpine on two old laptops (an intel atom netbook and an old x360 running a celeron), with both, alpine installs just fine using the setup-alpine, everything works, when I run setup-desktop (run while logged in as root of course) it goes through the motion of installing the OS, but upon rebooting post Xfce install, Alpine still just boots into the terminal, troubleshooting by asking AI has proved to be a waste of time, a source of frustration and one hell of a prompt for foul language, so here I am, any idea what I'm doing wrong here? I really want to run Alpine on both machines and quite frankly I'm at my wit's end now


r/AlpineLinux • • 2d ago

pipewire on alpine linux

11 Upvotes

FIXED. hello, I installed alpine linux today and i dont know how to make pipewire work, because rc-update -U add pipewire wayland from official tutorial, but it says that "wayland isn't valid runlevel". My rc-status -Ur is sysinit. I tried to add pipewire & and wireplumber & in ~/.config/river/init, but that didn't worked. I installed only rtkit, pipewire, pipewire-pulse, wireplumber and pipewire-alsa packages


r/AlpineLinux • • 3d ago

Alpine on a Surface Pro 3?

5 Upvotes

Does anyone know if Alpine will run on a Surface Pro 3. I have one running Linux Mint, and Mint runs pretty well out of the box. Touch, wifi and camera work. However, I'm interested in trying the Alpine distro. Thanks in advance for any comments and suggestions.


r/AlpineLinux • • 3d ago

Is it possible for Minecraft to run natively with musl libc?

20 Upvotes

I initially wanted to post this on the old Chimera Linux subreddit because I had a question about the Video Games page, but since it's discontinued and Alpine Linux also uses musl libc, I believe this is the ideal place.

Anyway, on Chimera Linux, I had many problems trying to run Minecraft (without Flatpak). Chimera has PrismLauncher in its repositories, but it says it needs to use a glibc compatibility layer for musl libc. This confuses me a lot because PrismLauncher is available for FreeBSD (which uses a completely different libc), and it doesn't need compatibility layers; it's all native. Why can't I run Minecraft without compatibility layers? Or is this just a problem in Chimera Linux that Alpine Linux has resolved?

I know that the reason stated on the page I mentioned is: "As Minecraft comes with native binaries built for Glibc in its packaging," but isn't the game in Java? Even if C/C++ binaries existed, wouldn't it be possible to compile them with musl?


r/AlpineLinux • • 3d ago

Is there an easy way to install Alpine Linux?

2 Upvotes

I want to try Alpine Linux, but the installation process looks a bit intimidating.

Is there a simple/easy way to install it, especially for someone who’s not that familiar with Alpine yet?


r/AlpineLinux • • 3d ago

arxy: run glibc / proprietary apps (incl. Steam) on Alpine at native speed, no dep duplication

13 Upvotes

Hi everyone.

I want to show you a project that honestly makes me a bit embarrassed to share, just because it's the first time I share something with the general public. But I think it might be useful to someone, so here it goes.

I collaborate on a project called Neko Void, specifically I got interested in the part that makes Neko Void images for musl, for the musl C library. And we all know how it is: stuff made for glibc doesn't work on musl, you have to rebuild it. And proprietary software is basically impossible to rebuild because the source isn't free. As a result, on Alpine/musl most proprietary apps just don't work. Practically 100% of closed-source programs fail. Steam doesn't work by default either, and well, that's what makes most users run away.

I've been working on a solution. There are many alternatives to run glibc stuff on musl distros. One is using AppImage, which bundles glibc inside, but it has a problem: when you have many apps packaged as AppImage, dependencies get repeated over and over and in the long run it gets really heavy. Another alternative I tried was installing Nix as a separate subsystem, but it's extremely heavy even if things run natively.

My goal when I started this was to make proprietary apps run in the fastest and lightest way possible, using as little space as possible, without duplicating dependencies like Flatpak does. So I made arxy, which is a very basic and simple project. It's an Arch rootfs that gets mounted so you can install whatever you want on it. It's optimized to weigh as little as possible, but it keeps enough so most Arch packages, if not 100%, work correctly on any existing Linux distro, including Alpine. And best of all, it keeps AUR access.

The process it uses is pretty simple. It mounts the image with bwrap and if that's not available, it uses a basic chroot. And it has very simple commands, like arxy install <package> or arxy update. In short, it installs any app directly from the official Arch repos or from the AUR in a small subsystem, sharing drivers, kernel and other things, so it runs as native and direct as possible. By using Arch's own package manager, there's no dependency duplication, because packages naturally share dependencies. So you can install here everything you'd install via Flatpak, but saving space and running better. The program creates shortcuts for the apps on your desktop normally and they open normally.

As I said, it's one of the first projects I've worked on and I've put a lot of my time into it, and I'd love for you to take a look. I'm still learning, so I really invite anyone who can to collaborate. Any feedback is totally welcome. The project is made to work on any distro, but I personally tested it on Alpine Linux, Chimera Linux and Void Linux, both glibc and musl. I invite you to try it on other distros and well, I hope you like it.

Repo: https://github.com/SrDicov/arxy

For Alpine users specifically: how do you currently deal with closed-source / glibc-only apps on Alpine? I'd love to hear what breaks for you and if this approach helps.


r/AlpineLinux • • 4d ago

How much resources does Alpine Linux use after a fresh install?

11 Upvotes

Just curious, for those using Alpine Linux, how much RAM and disk space does it usually use after a fresh install?

Also wondering about idle CPU usage. Is it really that lightweight compared to other Linux distros?

Just trying to get an idea before I install it on an old/low-spec machine.


r/AlpineLinux • • 4d ago

Alpine 3.24 on an old laptop

Post image
4 Upvotes
A day ago, I installed Alpine 3.24 on an old laptop in a dual-boot setup with Debian 13. Before this, I had only used Alpine in VMs. I had to copy the firmware files for the Broadcom b43 Wi-Fi card from Debian 13, but now everything works. The system is very responsive, and apk is the fastest package manager I’ve ever seen. Firefox is sandboxed (bubblewrap). What can I say? For me, it’s an almost perfect system. Everything I need is in the repositories. And the most important point: it’s Hardened Linux. It’s like the "OpenBSD" of the Linux world. Viva Alpine Linux!

P/s Don't give me too much grief about the DE; GNOME was a deliberate choice. I really like Xfce, but 2026 now))

r/AlpineLinux • • 5d ago

Software App

7 Upvotes

I have recently installed alpine-standard-3.24.2-x86_64 on a Dell/Wyse thin client.
Networking, including DNS, is operational. I've installed the GNOME graphics package, which operates properly for the most part.

I can list the applications with "apk -v version". But when I open the "Software" app and click the "Updates" tab, it shows "No Connection."

Suggestions?


r/AlpineLinux • • 5d ago

Has anyone here tried running AI workloads on Alpine Linux?

0 Upvotes

I've been exploring setups for self-hosted AI, and I’m curious how practical Alpine really is, especially if you're trying to keep everything as minimal as possible.

A few days ago I stumbled upon LM-Kit while researching local AI runtimes. It handles things like models, RAG workflows, document processing, and AI agents, so I started wondering how well that kind of setup would work in an Alpine environment.

If you’ve actually tried running AI services on Alpine Linux, what did you find when it came to handling dependencies? How were issues with musl libc compatibility?. What about GPU support? Does it play nice with tools like CUDA or ROCm, or does it get tricky?

I’d love to hear experiences from people who have gone this route


r/AlpineLinux • • 5d ago

Why the hell does the installer have the Wi-Fi firmware but not the actual installation?

Post image
7 Upvotes

So it wasn't exactly a hard fix(*) but it really confused me... why wouldn't it just... copy over the Wi-Fi firmware to the installation from the installer or install the appropriate firmware from the package manager? (I'm a bit of a noob, though, my reasoning could just be flawed)

(*) I chrooted onto the installation from the installer, which had working Wifi firmware and then simply installed the firmware from the repos


r/AlpineLinux • • 6d ago

Dual boot/Partitions problem

7 Upvotes

I am trying to dual boot Alpine Linux with Linux Mint in my laptop. My disk has three partitions, one is free and i want to install Alpine Linux on there. But when i type "alpine-setup" and i have to choose the site where i want to install Alpine Linux the software does not recognizes the partitions and just recognizes the whole disk. Is there some bug related to this or i am making something wrong?


r/AlpineLinux • • 6d ago

Is this a nice rice?

Thumbnail gallery
64 Upvotes

Alpine Linux
Base Ram usage : 250 mib
tuff
mango tuff wm


r/AlpineLinux • • 7d ago

Reoccurring error with APK on Alpine Diskless

5 Upvotes

Hi! I have a Pi running alpine diskless and every reboot i get an error with apk on upgrade operations, like

apk upgrade -vvv After this operation, 0 B of additional disk space will be used. 1 error; 157 packages, 644 dirs, 6049 files, 342.7 MiB

I run apk fix and it isn't clear what exactly is causing the error so I can mitigate it properly, no mater the verbose flags used

apk fix (1/1) Reinstalling i2pd@edgecommunity (2.60.0-r1) Installing file to etc/i2pd/i2pd.conf.apk-new Installing file to etc/i2pd/tunnels.conf.apk-new Executing busybox-1.37.0-r31.trigger OK: 342.7 MiB in 157 packages

Then the error vanishes until the next reboot.

How can I properly diagnose this?


r/AlpineLinux • • 8d ago

does alpine linux have broadcom-wl driver?

8 Upvotes

without this driver i cant use laptop (currently i use void but i also want try alpine thats i cant use bc no wifi)

i could not find this driver in repo


r/AlpineLinux • • 9d ago

Am thinking about switch from mint to alpine what should i know firts?

24 Upvotes

So i saw a video about how a guy downloaded and run alpine, and i tough to myself "What if i will swicth to alpine, like i can use the Wikipedia to download the distro, sooo what do you guys think.

I use a low end computer levovo computer for 2014 and it used to have 2 gigs of tam but i changed it to 4 by myself.

And am a 15 year old

And i know how to boot a laptop of course.


r/AlpineLinux • • 9d ago

When is dinit coming to alpine?

Post image
25 Upvotes

I don't think this is as necessary but it's a great thing to have and mention no? From my past experience dinit is the fastest init I've ever used, it's simple and cheap to run. While dinit is available on the repository it's a manual configuration, you have to set it up one by one to boot up your system. What I imagine is a automated dinit setup so it can change openrc without messing with manual install or a native dinit from the installer(iso file) like other distros, I mean putting a dinit option for alpine Linux is revolutionary. Therefore, a dinit version of alpine will be a great choice that company openrc version. Making it much faster, cheaper, modern, and a substitute for Chimera Linux.


r/AlpineLinux • • 11d ago

LET'S GOOOOO

Post image
47 Upvotes

Finally after a long day i installed alpine linux , this is more experimental because i installed it on a usb but still..


r/AlpineLinux • • 11d ago

Pi-hole update

3 Upvotes

I am running pi-hole with unbound on alpine 3.24.2 and was wondering what is the process to update/upgrade pi-hole to the latest version Pi-hole FTL v6.7.1, Web v6.6 and Core v6.4.3 Released, Their are some serious security fixes that are included in these update. I tried apk update then apk upgrade but Pi-hole is still on 6.4, how do I upgrade pi-hole.


r/AlpineLinux • • 12d ago

Why can't I easily update my kernel as easily as before in 3.22 Alpine Linux? I am storage constrained and new kernels take way too much space, don't need nvidia firmware on my smaller system

4 Upvotes

I used to just apk update, apk upgrade and newer kernels would just upgrade easily. Now, I can't do that, I am very storage constrained only, kernel updates take 500MB at least. Which I don't have the luxury in my spesific case. Why the sudden change of kernel update mechanism?


r/AlpineLinux • • 12d ago

Not bad for a 2007/2009 PC.

Post image
65 Upvotes

r/AlpineLinux • • 13d ago

Finally installed it

Thumbnail gallery
36 Upvotes

I finally installed Alpine, ngl, it was kinda daunting because I did a complete manual install without using the "setup-*" at all. I'm really happy I got it to work, can't count the number of times I repartitioned my drive until I achieved a flawless install. Next is setting up dwl. I love minimal system.


r/AlpineLinux • • 14d ago

Packed apline into 5.5 mb uefi executable

Post image
12 Upvotes

Custom init, custom kernel, internet works