Dedicated Servers - Guide: Alpine Linux as an alternative rescue system using a custom iPXE script
... / Guide: Alpine Linux as an...
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
Frage

Guide: Alpine Linux as an alternative rescue system using a custom iPXE script

Von
le_sbraz
Beitragender
Erstellungsdatum 2025-04-29 11:42:50 (edited on 2025-04-29 12:11:02) in Dedicated Servers

Hi,

I wrote an iPXE script that can be used to boot your bare metal server into an Alpine Linux rescue system. To use it, simply follow the documentation on custom iPXE scripts.

I'm sharing the current version (I might update the gist later) here as well, the really nice part IMHO is the support of SSH keys, making it very easy to use even on servers without a KVM console.

#!ipxe

echo Booting Alpine Linux rescue

# Used below for SSH keys
set space:hex 20
set space ${space:string}
set arch x86_64

#set version edge
set version latest-stable
#set mirror https://dl-cdn.alpinelinux.org/alpine
set mirror https://alpinelinux.mirrors.ovh.net
# To see the whole boot process, adjust the console parameters based on what
# you see in the official rescue's /proc/cmdline
#set console console=tty0${space}console=ttyS0,115200n8
# Enable the community repository for ripgrep
set repo-url ${mirror}/${version}/main,${mirror}/${version}/community
set packages bash,curl,file,lsblk,mount,parted,ripgrep,vim,wget
set ssh_key ssh-ed25519${space}AAAAxxxxxxxxxx

set base-url ${mirror}/${version}/releases/${arch}/netboot

imgfree
kernel ${base-url}/vmlinuz-lts initrd=initrd.magic ${console} ip=dhcp alpine_repo=${repo-url} modules=loop,squashfs modloop=${base-url}/modloop-lts pkgs=${packages} ssh_key="${ssh_key}"
initrd ${base-url}/initramfs-lts
boot

This is very light and can even be used on 2G memory servers:

localhost:~# free -h
              total        used        free      shared  buff/cache   available
Mem:           1.9G       52.6M        1.6G      262.5M      296.8M        1.5G
Swap:             0           0           0