- CSS 60.5%
- Shell 29%
- Python 8.6%
- C 1.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| liverootfs | ||
| .gitignore | ||
| build.sh | ||
| limine.png | ||
| live-script.sh | ||
| packages | ||
| pkgmk.conf | ||
| prt-get.conf | ||
| qemu.sh | ||
| README.md | ||
KRAK3N live ISO
Scripts to build the KRAK3N live ISO: a bspwm desktop that boots from a USB stick or DVD, with an installer and optional persistence.
Building
Requirements
Build on a KRAK3N system, as root, with:
prt-getandports, with the KRAK3Ncoreandextraports treeslibisoburn(xorriso),squashfs-tools,libarchive(bsdtar),limine,kmod,file- enough disk space for the rootfs, sources and packages (about 20 GB)
build.sh checks for the tools first and lists any that are missing.
Build
./build.sh
This:
- installs the
coreports intorootfs/ - updates the ports, upgrades outdated packages with
prt-get sysup, and builds and installs the packages inpackages, all inside a chroot ofrootfs/; then, ifprt-utilsis installed there, rebuilds any packagerevdepfinds linked against a library that is gone, and deletes the sources and packages insrc/andpkg/thatoldfilesreports as no longer used, e.g. old versions (both fromprt-utils; nothing is deleted if a package failed) - packs
rootfs/into a squashfs, without the ports trees (ports -ufetches them on the live or installed system), rebuilt only when packages were installed, removed or upgraded; deleteiso/live/filesystem.squashfsto force a rebuild after other changes torootfs/ - makes the initramfs and copies the kernel
- packs
liverootfs/, the files used only by the live system - writes
krak3n-YYYYMMDD.iso, bootable on both BIOS and UEFI, and its checksumkrak3n-YYYYMMDD.iso.sha256sum
To build only some packages, name them:
./build.sh firefox gparted
build.sh only installs missing packages. To get an updated port into the
rootfs, remove the package first and build again:
pkgrm -r rootfs slim
./build.sh
Files
| Path | What it is |
|---|---|
build.sh |
the build script |
packages |
packages added on top of core, one per line; # comments |
prt-get.conf, pkgmk.conf |
package build settings used in the chroot |
liverootfs/ |
files unpacked over the system at boot: desktop setup, /etc/skel, themes, the live tools |
live-script.sh |
runs at every boot before init: live user, services, autologin |
limine.png |
boot menu wallpaper |
qemu.sh |
boots the ISO in QEMU |
Testing in QEMU
./qemu.sh krak3n-YYYYMMDD.iso # BIOS
./qemu.sh -u krak3n-YYYYMMDD.iso # UEFI
./qemu.sh -d disk.qcow2 krak3n-YYYYMMDD.iso # with a 20G disk, to try the installer
./qemu.sh -d disk.qcow2 # boot the installed disk
Writing to a USB stick
All data on the stick is lost.
First check that the ISO is intact, with the .sha256sum file next to it:
sha256sum -c krak3n-YYYYMMDD.iso.sha256sum
It should print krak3n-YYYYMMDD.iso: OK.
-
Find the stick's device name: plug it in and run
lsblk. It is a whole disk such as/dev/sdb, not a partition such as/dev/sdb1. Check the size and model to be sure it is the stick and not a hard disk. -
Unmount it if the desktop mounted it:
umount /dev/sdX?* -
Write the ISO, replacing
sdXwith the stick:dd if=krak3n-YYYYMMDD.iso of=/dev/sdX bs=4M conv=fsync syncBusybox
ddprints nothing until it is done, which can take a few minutes. With GNU coreutilsdd, addstatus=progressto see how far it is.
On Windows or macOS, any tool that writes an image byte for byte works, such as Rufus (choose "DD image mode") or balenaEtcher.
Boot the computer from the stick: usually with F12, F11, F8 or Esc at
power-on, depending on the maker. The live system logs in as live
(password live); the root password is root.
Running from RAM
Choose KRAK3N (copy to RAM) in the boot menu, or add toram to the
kernel command line. The initramfs copies the whole ISO into memory
before starting, then lets go of the stick, so it can be removed once the
desktop is up. The welcome window shows it in its Boot medium row.
- It needs the size of the ISO plus 1 GiB of free memory; with less, it says so and runs from the stick as usual. 4 GB of RAM or more is a good idea.
- Booting takes longer, while the ISO is copied: from under a minute on USB 3 to a few minutes on USB 2.
- A persistence partition on the boot stick itself is not used, since it would keep the stick busy. One on another disk works as usual.
Persistence
By default the live system runs from RAM and forgets every change when it shuts down. With persistence, changes are kept on a disk partition: files in the home folder, settings, installed packages, everything.
The live system uses any ext4 partition labelled KRAK3N_PERSIST. It
looks on every disk, so the partition can be on the USB stick itself, on
a second stick, or on an internal disk.
With the tool
Boot the live system and either:
- click Set up persistence in the welcome window,
- choose Set up persistence in the app launcher (Alt+P), or
- run
doas krak3n-persistin a terminal.
It offers:
- the free space on the boot USB stick: a new partition after the ISO, using the rest of the stick (needs at least 1 GiB). The live system on the stick is not touched.
- a partition on another disk: it is erased and formatted.
Reboot, and the live system starts using it. The welcome window shows the partition in its Persistence row.
By hand
On the USB stick, after writing the ISO (replace sdX):
echo ',,L' | sfdisk -a /dev/sdX
mkfs.ext4 -L KRAK3N_PERSIST /dev/sdX4
Or on any other partition (this erases it):
mkfs.ext4 -L KRAK3N_PERSIST /dev/sdY1
For QEMU, use an image file as the second disk:
truncate -s 2G persist.img
mkfs.ext4 -L KRAK3N_PERSIST persist.img
./qemu.sh -d persist.img krak3n-YYYYMMDD.iso
Good to know
- Start without it. If a change breaks the system, choose KRAK3N (without persistence) in the boot menu. The partition is left alone.
- Start over. Format the partition again with
mkfs.ext4 -L KRAK3N_PERSIST, or delete theupperandworkfolders on it from another system. - Passwords you change are kept. The defaults are only set the first time.
- Updating the ISO. Writing a newer ISO to the stick with
ddreplaces its partition table, so a persistence partition on the stick is lost and must be made again. One on another disk survives. Files fromliverootfs/are unpacked again when they changed in the new build, replacing your edits to those files. - Unplug safely. Shut down properly before removing the stick, or the latest changes may be lost.
- The installer copies the clean system from the ISO, not your persistent changes.
Installing
Click Install KRAK3N in the welcome window, choose Install KRAK3N
in the app launcher (Alt+P), or run doas krak3n-install. It asks for the disk,
the partitioning, hostname, timezone, passwords and user, and whether to
install the limine bootloader. Nothing is written before the final
confirmation.
- Automatic erases the disk and creates a 512 MiB FAT32
/boot, an optional swap partition and a root partition with the filesystem you choose (ext4, xfs, btrfs, f2fs or jfs). - A btrfs root, automatic or manual, is split into subvolumes:
@for/,@home,@var_logand@snapshotsfor/.snapshots, mounted withnoatime,compress=zstd:1. A subvolume is left out when its directory has a partition of its own, e.g. a separate/home. In manual mode, setting/to btrfs opens a subvolume screen to pick which of these to make, add others (e.g.@var_cachefor/var/cache) and change the mount options. - Manual opens cfdisk, then lists the disk's partitions. Choose each
one to set what it is for:
/,/boot,/home, swap or any other directory, and its filesystem. A partition other than/can keep its filesystem and files, e.g. an existing/home. Choose done when/is set, and/bootif you want limine./bootmust be FAT32. On UEFI, use the EFI System partition./bootis optional. Without it the kernel and initramfs stay in/booton the root partition, limine is skipped, and you set up another bootloader yourself.- On a GPT disk booted by BIOS, also create a 1 MiB partition of type BIOS boot for limine.
/usr,/etcand the other directories needed early at boot must stay on the root partition.- done checks this against the firmware. If limine couldn't start,
e.g.
/bootisn't the EFI System partition on UEFI, you can go back to fix it or continue without limine. It also warns when/bootis too small, or too full if kept, and when no partition of an MBR disk booted by BIOS is marked bootable.
After copying the system, the installer sets INITRD, ROOTFSTYPE and
HOOKS (mdev, plus btrfs on a btrfs root) in /etc/mkinitrd.conf and
makes the initramfs again with the installed system's mkinitrd, so it
doesn't depend on the one built into the ISO. Kernel updates use the same
settings. In VMware or Hyper-V it also adds the virtual SCSI disk drivers
to MODULES.
The SLiM login theme /usr/share/slim/themes/bspwm becomes a link to
the new user's ~/.config/slim/bspwm, so changing the wallpaper
(Alt+Shift+W) recolours the login screen too. The live system does the
same for the live user, with a theme named live.