ScrapLinux

A source-built Linux distribution, installed by hand, managed declaratively.
            a8888b.
           d888888b.
           8P"YP"Y88
           8|X|X|888
           8'    .88
           8`._.' Y8.
          d/      `8b.
         dP   .    Y8b.
        d8:'  "  `::88b
       d8"         'Y88b
      :8P    '      :888
       8a.   :     _a88P
     ._/"Yaa_:   .| 88P|
     \    YP"    `| 8P  `.
     /     \.___.d|    .'
     `--..__)8888P`._.'

ScrapLinux pairs a BSD userland (toybox, zsh, doas, netbsd-curses) with glibc underneath, its own kernel fork, and its own package manager, scraps. Packages are signed with signify; the key ships in the base system rather than arriving beside the thing it verifies.

There is no installer. You partition, format and chroot by hand, the way Arch or LFS expects - see the install guide below. Once installed, the machine is described in six small files under /etc/scraplinux/, and one command, scraplinux-rebuild, makes the machine match them. Every rebuild records a generation, so a bad edit is one scraplinux rollback away.

Init is your choice: busybox init (the default) or OpenRC ships ready in its own tarball; sysvinit, runit, dinit and initialization install afterwards. Services are declared once and translated to whichever one runs.

features

STATUS: alpha. The busybox-init tarball is the tested default. The OpenRC tarball ships alongside it with OpenRC wired up as init, verified separately - use the default for a first install if you are not sure which you want.

install

Boot any live Linux with tar and disk tools. No ScrapLinux media needed for this part.

1. Partition and format

By hand. Root plus a FAT32 boot partition for UEFI/Limine; root plus a small unformatted BIOS-boot partition for BIOS/GRUB or BIOS/Limine.

fdisk /dev/sdX
mkfs.ext4 /dev/sdX2
mount /dev/sdX2 /mnt
mkfs.fat -F32 /dev/sdX1
mount --mkdir /dev/sdX1 /mnt/boot

2. Extract the tarball

def for busybox init, openrc for OpenRC. Either way scraps arrives pre-installed.

tar -xJf scraplinux-def-tarball.tar.xz -C /mnt

3. Sync the package repos

scraps-strap runs scraps fetch all against the tarball's own copy of scraps, writing fresh repo indexes into /mnt/var/lib/scraps/sync - the same thing a normal install does the first time it fetches anything, just pointed at /mnt from outside it instead of at / from inside. Nothing installs yet; this only makes package names resolvable.

/mnt/usr/bin/scraps-strap /mnt

4. Write fstab

Has to run now, before chroot: it reads the live environment's own mount table, which a chroot has no view of. genfstab isn't bundled in the tarball, so fetch it explicitly first, still pointed at /mnt.

SCRAPS_ROOT=/mnt SCRAPS_CONF=/mnt/etc/scraps/scraps.conf SCRAPS_REPOD=/mnt/etc/scraps/repos.d \
  /mnt/usr/bin/scraps add genfstab
/mnt/usr/bin/genfstab /mnt >> /mnt/etc/fstab

5. Chroot in and install the rest

Swap limine for grub on BIOS if you want GRUB instead. scraplinux-rebuild, run here rather than after exiting, activates the kernel and writes the bootloader config - it reads plain /etc/fstab and /boot, so it only means anything from inside the target.

/mnt/usr/bin/scraplinux-chroot /mnt
passwd
adduser you
scraps add scraplinux-base
scraps add scraplinux-base-kernel
scraps add limine
scraplinux-mkinitramfs
scraplinux-rebuild
exit

6. Deploy the bootloader

Back on the live environment, as root. The config is already written; this is the one step that stays manual.

# BIOS, Limine
limine bios-install /dev/sdX

# EFI, Limine - the target's own copy, not the live environment's
mkdir -p /mnt/boot/EFI/BOOT /mnt/boot/EFI/scraplinux
cp /mnt/usr/share/limine/BOOTX64.EFI /mnt/boot/EFI/BOOT/
cp /mnt/usr/share/limine/BOOTX64.EFI /mnt/boot/EFI/scraplinux/scraplinuxx64.efi
efibootmgr --create --disk /dev/sdX --part 1 \
  --loader '\EFI\scraplinux\scraplinuxx64.efi' --label 'ScrapLinux'

# BIOS, GRUB
grub-install --target=i386-pc --boot-directory=/mnt/boot /dev/sdX

7. Reboot

reboot

Encryption, btrfs, static networking, repairs: the install docs.

build it yourself

Every build runs sandboxed under bubblewrap - the host is mounted read-only, only the build tree and /tmp are writable.

build/scraplinux-sandbox --check
build/build.sh

The toolchain is clang, lld and the llvm-* binutils. There is no second one: a package built by gcc is not a ScrapLinux package.

contribute

Packages are defined in a manifest in scraplinux-ports, with recipes generated from it rather than hand-written. Adding a port means adding a line to the manifest, not boilerplate.

Pull requests welcome on github.

download

Latest release on GitHub - scraplinux-def-tarball.tar.xz and scraplinux-openrc-tarball.tar.xz, both with a .sha256 alongside.