Arch Minimal

Because bloat is EVIL

And there are various valid use cases for smaller installations
  • Old/minimal hardware
  • Chroots
  • Containers
  • System on USB
  • Embedded systems
  • Routers
  • Firewalls
  • NAS devices
  • ...

<rant>
Also - for such a streamlined OS what is with the install requirements...
base group needs 256MB RAM and 800MB disk ... really ...
</rant>

First line from the home page claims that it is "A simple, lightweight distribution"

I'll assume simple means for people who are already expert sysadmins...
It is my favorite "distribution" but that doesn't mean I'm such a fanboy that I can't point out flaws ;)

Requirements from the Beginners' guide

Arch Linux should run on any i686 compatible machine with a minimum of 256 MB RAM. A basic installation with all packages from the base group should take less than 800 MB of disk space.

Goals

  1. Using QEMU boot to bash as init as baseline
    1. Use plan9fs to allow Underlying ZFS Goodness (tm)
  2. Only what is required and used will be included
    1. Firewall style default deny
  3. Account for the differences between the filesystem and the packages
    1. Using the awesome find.differences ;)
  4. Modular
    1. Including a rule file should be enough to pull in everything related
    2. particularly things like locales, man pages, info pages, ...
      1. Think an NFS rule file ... maybe ... eventually
  5. Simple and modern system ... no Amish support
    1. no i'm not using rarpd or NIS (even NIS+)
    2. do i want to waste memory on nscd up to 32MB per file for a few lookups on /etc/services
  6. Follow FSHS
    1. without being stupid and possibly following some of the exception trends
  7. Self hosting
    1. Kernel and initrd are in the image
    2. initrd can be made inside the image
    3. Packages can be upgraded/installed (both minimally) from inside the VM
  8. Full init with systemd
  9. Use TOMOYO to validate what is used

Success

Managed to get a "working" if not slightly crippled boot to bash in 4.4M and 62 Files
(technically 3.6M in 18 files excluding pacman stuff in /var)

Down from 140M and 8K files from the bash baseline :)

TODO how does /tmp get created???

And as expected when you exit the shell ;)

bash-4.3# exit 34
[ 1365.738418] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00002200
[ 1365.738418]
[ 1365.740905] CPU: 0 PID: 1 Comm: bash Not tainted 4.4.5-1-ARCH #1
[ 1365.741705] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.9.1-20160216_104851-anatol 04/01/2014
[ 1365.741705]  0000000000000086 00000000dd214654 ffff880006d0fe10 ffffffff812cb391
[ 1365.741705]  ffffffff81717488 ffff880006d0fea8 ffff880006d0fe98 ffffffff81163368
[ 1365.741705]  0000000000000010 ffff880006d0fea8 ffff880006d0fe40 00000000dd214654
[ 1365.741705] Call Trace:
[ 1365.741705]  [<ffffffff812cb391>] dump_stack+0x63/0x82
[ 1365.741705]  [<ffffffff81163368>] panic+0xd3/0x215
[ 1365.741705]  [<ffffffff8115c3ee>] ? perf_event_exit_task+0xbe/0x350
[ 1365.741705]  [<ffffffff8107ab2a>] do_exit+0xb0a/0xb10
[ 1365.741705]  [<ffffffff81065426>] ? __do_page_fault+0x1a6/0x450
[ 1365.741705]  [<ffffffff8107abab>] do_group_exit+0x3b/0xb0
[ 1365.741705]  [<ffffffff8107ac34>] SyS_exit_group+0x14/0x20
[ 1365.741705]  [<ffffffff815970ee>] entry_SYSCALL_64_fastpath+0x12/0x6d
[ 1365.741705] Kernel Offset: disabled
[ 1365.741705] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000
[ 1365.741705]

The "full" filesystem

Package Notes

Notes for installed packages

Baselines

For these baselines the cache is not kept in the VM
Nor is /etc/pacman.d/gnupg
(mainly because it isn't implemented yet and doesn't help with the statistics anyway)

Baseline for pm.bootstrap

basically just filesystem and its stupid dependency on iana-etc

# du --summarize --human-readable --apparent-size new_root/
9.1M    new_root/

# find new_root/ | wc --lines
115

Baseline for pm -S bash

Installs 7 packages
(enabling qemu.start to succeed)

# du --summarize --human-readable --apparent-size new_root/
139M    new_root/

# find new_root/ | wc --lines
8125

... seriously???

140M and 8K files to use bash as init???

Baseline for pm -S base

Installs 50 packages which blossom to 125 with dependencies
(supporting my rant above)
(also allows booting into systemd && shutting down :) )

Total Installed Size:  610.27 MiB

# du --summarize --human-readable --apparent-size new_root/
627M    new_root/

# find new_root/ | wc --lines
34819

Awesome...

Though in fairness it will "boot" to bash as init in 48M of ram under QEMU
32M caused a boot-loop though this may have to do with the size of the initrd...
When booted to bash with 48M it shows 19M free ...
When booted to systemd with 48M it shows 10M free ...
The least it can boot to systemd with is 42M showing 5M free ... of course 42 is THE answer :)
(free -h)

42 is also the minimum for booting to bash showing 14M free
BUT strangely not reliably ... sometimes it actually OOMed and continued booting :(
(got to love non-deterministic testing computing)

41M and it almost boots then locks hard :P

Also keep in mind this has nothing to do with running anything real and possibly the extra RAM requirements are necessary for making it through a full installation from CD/USB without swapping or OOMing

TODO link to the answer

The current initrd with plan9 magic

Consumes

# du --summarize --human --apparent-size .
13M    .

# find . | wc --lines
343

How to do stuff with just bash...

TODO check all the built-ins and functions

cd and tab for ls

because we like cats

cat ()
{
    echo "$(<$1)" 
}

free

cat /proc/meminfo

Future Goal Options

Check the bash man page for ^INVOCATION

dash instead of bash for speed?
(watch out for bashism breakage)

Maybe look at minimal window managers there was a 9k one

Some BG dude
#232

8k init

dracut like 5 second boot

run completely from ramfs?

Is lz4 statically inside the kernel for compression?
What about cramfs for no memory overhead decompression?

Seriously 600MB of ram to install the base system???

zram
Ubuntu Linux Considers Greater Usage Of zRAM - Phoronix Forums
compcache - Performance.wiki
systemd-swap/systemd-swap.conf at master · Nefelim4ag/systemd-swap · GitHub
https://www.kernel.org/doc/Documentation/vm/zswap.txt
https://www.kernel.org/doc/Documentation/blockdev/zram.txt

use ldd and other "tricks" to figure out what libraries are necessary and what really depends on what

is readline/history built into bash for arch?

Flavors - bare minimum

can use all cheats like diet libc and busybox

Real small (emphasis on real)

using stripped packages

udev for stacked device discovery?

Only systemd - no sysv legacy crap

vim - a real editor

pacman package management

cryptsetup / encrypted root

log rotation

no additional languages by default

?standard kernel?
?All modules?

?RAID/ZFS? Or more specifically is it a recovery medium

Maybe no lvm2

Probably include i686 - for older hardware

?Self hosting for installs?

Every file and dependency should be accounted for by TOYMO (SP?)

Should follow FSHS

TODO - ADD links for TOYMO and FSHS

Boot time a priority?

Tuning?

Somewhat Related Minimal References

Linux from scratch General Libraries and Utilities
Linux from scratch which which

Archboot - ArchWiki
GNU Project - ArchWiki
From Power Up To Bash Prompt
From Power Up To Bash Prompt.
Cisco Bug: CSCub38011 - Nexus 5k might boot to bash prompt
Fabric Interconnect booting to bash? | JeffSaidSo
From Power Up To Bash Prompt
From Power Up To Bash Prompt.
From Power Up To Bash Prompt: Building Software From Source
Index of /Linux/redhat/archive.redhat.com/redhat/linux/7.1/es/doc/HOWTOS/other-formats/html/From-PowerUp-To-Bash-Prompt-HOWTO-html
Init - ArchWiki
Minimal Linux with kernel and BusyBox: /etc/inittab is ignored, only /init is executed - Unix & Linux Stack Exchange
minit
GitHub - Yelp/dumb-init: A minimal init system for Linux containers
Tim Potter's Netwinder Things - Building a Minimal Linux System
What is the minimal init.d script for Ubuntu? - Server Fault
Joshua Go's Linux Guide - Creating a Minimal Linux Filesystem
linux - Simple replacement of init to just start console - Stack Overflow
A minimal init script [LWN.net]

Old naming ideas

"bear minimum" arch linux (too many misspelled hits)
"TBV - Trust But Verify" (not sure it is intuitive)