os-alpine
SkillOperate Alpine hosts and images with musl ABI awareness, apk repository discipline, OpenRC services, and persistent configuration.
Instructions
Overview
Use for Alpine Linux systems, container images, and Alpine-related musl compatibility issues. Read the Linux foundation for target identification and shared diagnostic contracts. Musl is a C library, not a distribution; a musl binary does not prove the target is Alpine.
Mental model
Alpine combines musl libc, BusyBox utilities, apk packages, and normally OpenRC on booted hosts. A small image trades GNU/glibc assumptions for different interfaces; making it behave like another distribution through compatibility patches is not automatically the simplest solution.
Release and current changes
- Verified 2026-09-05: Alpine 3.24 is the current stable branch;
edgeis rolling development. Check the release table again before selecting a base image or upgrade path. - Support differs by repository:
mainis typically supported for two years, whilecommunityis supported until the next stable release. An otherwise supported branch can contain community packages that no longer receive that coverage. - Alpine 3.23 introduced apk-tools v3. Check
apk --versionand local help before relying on newer commands, configuration, or parsed output; apk tool version and repository/package format version are different facts. - Alpine 3.24 deprecates
qemu-binfmtin favor of user-mode QEMUbinfmt.dconfiguration and thebinfmtservice. For emulation failures, check installed registration and host ownership rather than starting the obsolete service. - Its setuptools 82 package removes
pkg_resources; a tool broken after upgrading may need a supported dependency/code update, not a system-wide Python downgrade.
ABI and tool compatibility
- Prefer musl-compatible artifacts or build against the actual target. A glibc-linked executable can report “not found” even when the file exists because its ELF interpreter is unavailable. Inspect architecture and ELF interpreter/dependencies with trusted inspection tools before diagnosing PATH.
gcompatimplements a subset of glibc-compatible APIs; it is not a replacement glibc installation or a guarantee that arbitrary vendor binaries work. If upstream supports only glibc, a supported glibc-based image may be the correct deployment choice. Don't invent loader symlinks or fetch unofficial libc packages to suppress an error.- BusyBox
shis normally ash. Check applet help; don't assume Bash syntax or GNU options forsed,date,find, orps. Add a declared tool dependency only when the operation requires it. - Check Python wheel/native-addon availability for musl and the target architecture. A smaller base image can trigger source builds and additional build dependencies; judge the complete deliverable, not only compressed base size.
apk and repository state
- Inspect
/etc/apk/repositories,/etc/apk/world, installed versions, and package policy. Keep repositories on the same stable branch;testingbelongs to edge. Don't combine stable and edge as a generic missing-package fallback. - World records requested package constraints, not just installed files. Resolve conflicts against those constraints; don't use force flags that discard requirements merely to make the solver succeed.
apk updaterefreshes indexes;apk upgradechanges installed packages. Review branch-upgrade instructions separately:--availablereconciles against available repository versions and can downgrade packages. It is not a harmless diagnostic flag.- Keep package signing enabled. Investigate keys, clock, index freshness, mirrors, and branch consistency on verification failure. Do not routinely use
--allow-untrustedor turn HTTPS verification off. - For images, declare runtime packages explicitly and isolate build dependencies in a stage or a named virtual dependency group. Removing a build group must leave required shared libraries available. Treat an image's mutable tag and immutable digest differently; rebuild deliberately for security updates.
- Preserve modified configuration and review
.apk-newfiles. A successful package transaction does not show that a daemon loaded the intended configuration.
Services and persistence
- On an OpenRC host, use
rc-service name status,rc-status, andrc-update showto inspect state. Starting a service now differs from adding it to a runlevel; inspect/etc/init.dand/etc/conf.dfor the actual service configuration. - OpenRC defaults to cgroup v2 in Alpine 3.19+; user services are available in 3.22+. Check the actual manager and cgroup setup rather than translating systemd commands mechanically. Ordinary Alpine containers often have no OpenRC boot lifecycle.
- Distinguish disk-backed installations from diskless/data modes. For diskless setups, inspect
lbuinclusion and persistence configuration; approved changes may needlbu commitand package-cache handling to survive reboot. This overlay is not automatically a backup of all application data. - Before a host release upgrade, review bootloader and filesystem notes and establish recovery access. GRUB updates can require installation to the actual boot device/EFI target; do not copy a generic device path into a command.
Example
Read Alpine package identity without refreshing indexes or changing packages:
set -eu
cat /etc/alpine-release
apk --version
apk --print-arch
apk info -v musl busybox apk-tools
apk policy muslPolicy reflects available local metadata; it is not evidence that repositories were refreshed or the package is the latest security revision.
Checklist
- Branch, repository support, architecture, libc, and apk version are identified.
- Binary and shell assumptions fit musl/BusyBox; compatibility failures stay visible.
- Package constraints, trust, runtime dependencies, and configuration are preserved.
- Init and persistence match the deployment mode; verification limits are stated.