Skip to content

Instantly share code, notes, and snippets.

@ilyaigpetrov
Last active January 8, 2026 11:00
Show Gist options
  • Select an option

  • Save ilyaigpetrov/c6a05e50114dd34ce01fdfb18f228d90 to your computer and use it in GitHub Desktop.

Select an option

Save ilyaigpetrov/c6a05e50114dd34ce01fdfb18f228d90 to your computer and use it in GitHub Desktop.
Кратко об Alpine Linux на 10.2025 | #Alpine #СПО #Линукс #WithoutSystemd #Кратко #RU

Кратко об Alpine Linux на 10.2025

О дистрибутиве

Сайт: https://alpinelinux.org.
Мотто: «Small. Simple. Secure.»
Кредо: «Alpine Linux is a security-oriented, lightweight Linux distribution based on musl libc and busybox».
О себе / About: «independent, non-commercial, general purpose Linux distribution designed for power users who appreciate security, simplicity and resource efficiency», /about.
Подробнее о себе: https://wiki.alpinelinux.org/wiki/Alpine_Linux:Overview.
Страничка в DistroWatch: https://distrowatch.com/alpine.
Происхождение: Норвегия.
Команда: Natanael Copa⁠ (основатель и сопровождающий).

Alpine находит применение в контейнерах, встраиваемых (embedded) системах, сетевом оборудовании, серверах, одноплатниках и в качестве нетребовальной ОС для продвинутых пользователей.

Prior Art / Существующие обзоры:

Предупреждение: у меня довольно мало опыта с этим дистрибутивом.

Особенности

  1. Легковесный. Вместо общепринятых в популярных дистрибутивах утилит и др. программ используются менее требовательные альтернативы:
    • glibc (GPL) → musl (MIT)
    • coreutils (LGPL) → BusyBox (GPL)
    • systemd (LGPL) → OpenRC (BSD)
    • Bash (GPL) → Busybox Ash shell (GPL)
    • sudo (ISC-style) → doas (ISC)
  2. Из-за нестандартного набора ПО не является строгим GNU/Linux[not-gnu] и, бывает, имеет проблемы совместимости c этой ОС. Бинарники должны быть скомпилированы под musl, либо запускаться через слой совместимости gcompat -- см. [not-glib].
  3. Собственный пакетный менеждер APK (Alpine Package Keeper, GPL, на C).
    11.2025 ожидается выпуск Alpine 3.23.0, включающий новые apk-tools v3.
    OpenWRT планирует перейти на APK, но, думаю, уже после выхода v3.
    См. [apk].
  4. Акцент на безопасности. По умолчанию включает микрокоды для CPU. Бинарники компилируеются с защитой PIE (не точно). См. [security].
  5. Простой (по внутреннему устройству, принцип KISS).
  6. Минималистичен. Поставляется без предустановленного графического окружения -- см. no-de. Но, несмотря на это, работа из виртуальной консоли, включая установку графической оболочки, настройки системы и прочей подгонки под себя (customization), упрощается благодаря наличию удобных setup-* скриптов: см. https://wiki.alpinelinux.org/wiki/Alpine_setup_scripts.
  7. Поддержка различных архитектур, включая Raspberry Pi: см. https://wiki.alpinelinux.org/wiki/Alpine_Linux:Overview#Architectures.
  8. Проприетарный драйвер NVIDIA не поддерживает Musl, так что используется Nouveau.

Ссылки и сноски

  1. Про несоответствие GNU/Linux:

    1. «The GNU operating system»: https://www.gnu.org/philosophy/categories.html#TheGNUsystem.
    2. «How much of the GNU system is needed for the system to be GNU/Linux?»: https://www.gnu.org/gnu/gnu-linux-faq.html#howmuch.
    3. «Are there complete Linux systems [sic] without GNU?»: https://www.gnu.org/gnu/gnu-linux-faq.html#linuxsyswithoutgnu.
    4. https://en.wikipedia.org/wiki/GNU/Linux_naming_controversy#Composition_of_operating_systems.
  2. Про musl, glibc и бинарную несовместимость:

    1. https://wiki.alpinelinux.org/wiki/Software_management#Running_glibc_programs.
  3. Про пакетный менеджер APK:

    1. Черновик заметки к выпуску Alpine Linux v3.23.0 с apk-tools v3: alpine-draft.
    2. О переходе OpenWRT на APK в выпуске от 06.02.2025:

      OpenWrt 24.10 uses OPKG only, APK packages are not supported. Only main branch was changed to APK.

  4. Про безопасность:

    1. Микрокод: https://wiki.alpinelinux.org/wiki/CPU_Microcode.
    2. Защита PIE:
      • Из /about:

        All userland binaries are compiled as Position Independent Executables (PIE) with stack smashing protection.

      • В версии 3.23.0 запланирована поддержка PIE для статических бинарников (static binaries). См. alpine-draft.

Публикации

— В тг-канале «Декрабизация»: https://t.me/decrabru/59.

Notes on Alpine

  1. There are no musl binaries for Golang at https://go.dev/dl/. I have found only this community package: https://pkgs.alpinelinux.org/package/edge/community/x86_64/go.
  2. For IPFS on Alpine see: https://gist.github.com/ilyaigpetrov/6a5d25bc6b076f67d44d6c83e2ce6524#alpine-linux.
  3. You can tune setup-scripts by specifying environment variables. Something like $ (export ROOTFS=btrfs; setup-disk) should work. See:
  4. Packages I add right after a fresh install: doas apk add tmux lsblk git vim curl docs w3m gcompat. Optionally you may enable community packages: doas setup-apkrepos -c (from https://wiki.alpinelinux.org/wiki/Repositories#Enabling_the_community_repository). And then install ipfs and a mail client: doas apk add kubo aerc.
  5. For Cyrillic support in the virtual console you may:
# apk add kbd
# setfont /use/share/consolefonts/cyr-sun16.psfu.gz

chroot into a Broken Alpine Linux

  1. Burn the official image to a media and boot from it.
# setup-interfaces -r # Configure network interfaces and connect to the Internet.
# setup-apkrepos -c # Enable community repos for apk and tune it in other ways.
# apk update
# apk upgrade

# blkid # Prints all partitions, their FS types and type of encryption (LUKS).
# # You have to figure out the partition with broken Alpine's root.
# # In my case it's /dev/sdb2.

# apk add cryptsetup
# cryptsetup luksOpen /dev/sdb2 decrypted-root

# apk add lsblk
# lsblk --fs # Will show if the decrypted partition uses LVM2 (logical volume).
# # In my case I have `LVM2_memeber` as a FS type for `decrypted-root`.

# apk add lvm2
# vgscan # In my case it shows a volume group named `vg0`.
# vgchange -ay vg0 # Activates `vg0`.
# lsblk --fs # Now it includes logical volumes with their FS types.
# mkdir /mnt/broken-root
# # We will use original mount util, not the one from busybox.
# apk add mount
# mount /dev/mapper/vg0-lv_root /mnt/broken-root/
# # Make sure it is actually the root of your broken Alpine:
# ls /mnt/broken-root/

# mount -o bind /dev /mnt/broken-root/dev
# mount -t proc none /mnt/broken-root/proc
# mount -o bind /sys /mnt/broken-root/sys
# cp -L /etc/resolv.conf /mnt/broken-root/etc/

# # Optionally: mount the boot partition. In my case it's sdb1 of type vfat: 
# mount /dev/sdb1 /mnt/broken-root/boot # Haven't tested but it should work.
# # Just know that in Alpine there is a tool for creating
# # initramfs images called `mkinitfs` which doesn't require `chroot`ing.

# # Now enter the chroot:
# chroot /mnt/broken-root/ /bin/ash -l

# # Now troubleshoot, figure out and fix the
# # broken parts of your Alpine.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment