A minimal, container-native operating system built from scratch in C.
MinOS boots a custom Linux kernel into a compressed SquashFS read-only root, layers an OverlayFS writable upper layer on top, and runs a hand-written init binary as PID 1. Containers are isolated using Linux namespaces, cgroup v2 resource limits, and a seccomp BPF syscall whitelist — all implemented without any container framework.
| Feature | Implementation |
|---|---|
Custom init (PID 1) |
init/ — mounts filesystems, starts supervisor |
| Service supervisor | supervisor/ — auto-restart, service configs |
Container runtime (minc) |
runtime/ — namespaces, OverlayFS, pivot_root |
| cgroup v2 resource limits | cgroup/ — memory, PID, CPU enforcement |
| Host bridge + NAT setup | netd/ — creates osBr0, enables IP forwarding at boot |
| Seccomp BPF filter | runtime/seccomp.c — ~165 syscall whitelist |
Session multiplexer (mintab) |
tools/mintab.c — multiple containers simultaneously |
| Network / cgroup diagnostics | tools/netstat.c, tools/nslist.c, tools/cginspect.c — interface, namespace, and cgroup inspection |
| Python 3.12 in containers | build/setup-langs.sh — musl-linked static binary |
| SquashFS + OverlayFS root | build/mksquashfs.sh, initramfs-stage1/ |
┌──────────────────────────────────────────────────┐
│ User Programs │
│ minc │ mintab │ python3 │ /bin/sh │
├──────────────────────────────────────────────────┤
│ Supervisor (service manager, auto-restart) │
├──────────────────────────────────────────────────┤
│ init (PID 1, hand-written C, no systemd) │
├──────────────────────────────────────────────────┤
│ SquashFS (read-only) + OverlayFS (writable) │
├──────────────────────────────────────────────────┤
│ Linux Kernel (custom minimal config) │
└──────────────────────────────────────────────────┘
Boot sequence:
- QEMU loads kernel + initramfs (stage 1)
- Stage-1 shell script finds and mounts SquashFS →
/squash - OverlayFS is mounted:
lower=/squash, upper=ext4 partition switch_root→ custom/sbin/init- init mounts
/proc,/sys,/dev,/run,/tmp, cgroups - Supervisor starts:
cgmgr,netd,mintab,console(shell)
MinOS/
├── init/ # PID 1 — mount, signals, zombie reaping
├── supervisor/ # Service manager — spawn, parse, restart
├── runtime/ # minc container runtime
│ ├── minc.c # CLI — arg parsing, container lifecycle
│ ├── spawn.c # clone() — PID/MNT/NET/UTS/IPC namespaces
│ ├── rootfs.c # OverlayFS setup + pivot_root
│ ├── seccomp.c # BPF syscall whitelist
│ └── namespace.c # uid/gid map helpers for CLONE_NEWUSER —
│ # written but not wired into clone() yet
├── cgroup/ # cgmgr daemon — cgroup v2 limits
├── netd/ # host bridge + NAT setup at boot; per-container
│ # veth attachment exists (bridge.c, veth.c) but
│ # isn't called from runtime/ yet — see below
├── tools/
│ ├── mintab.c # PTY session multiplexer
│ ├── nslist.c # Namespace isolation inspector
│ ├── cginspect.c # cgroup v2 resource tree viewer
│ ├── memhog.c # Memory stress tool (cgroup OOM demo)
│ ├── netstat.c # Interface / bridge / veth status
│ └── demo.sh # Container feature demo script
├── projects/
│ ├── sysmon/ # TUI process/resource monitor
│ └── pyrun/ # Container-gated Python demo runner
├── build/
│ ├── mkdisk.sh # Assemble bootable disk image
│ ├── mksquashfs.sh # Pack rootfs into SquashFS
│ ├── mkrootfs.sh # Compile all binaries + assemble rootfs/
│ ├── setup-langs.sh # Stage Python 3.12 + TCC into rootfs/
│ └── verify.sh, check_phases.sh # Post-build integrity checks
├── initramfs-stage1/ # Busybox initramfs — mounts SquashFS + overlay
├── syslinux/ # Bootloader config
├── services.d/ # Service configs (cgmgr, netd, mintab) — console's
│ # config is synthesized at build time, not stored here
├── kernel/ # Kernel config (bzImage not tracked — too large)
└── rootfs/ # Staged OS root (generated by make)
sudo apt update
sudo apt install gcc make squashfs-tools syslinux-utils \
qemu-system-x86 busybox-static rsync cpio# 1. Stage language runtimes (Python 3.12 — downloads ~50 MB, one-time)
bash build/setup-langs.sh
# 2. Build disk image (compiles all C, packs SquashFS, writes disk)
make image
# 3. Boot in QEMU
make testNote: The kernel (
kernel/bzImage) is not tracked in git — it's 14 MB.
Build it with your kernel config or download a pre-built one.
minc run /bin/sh -c "hostname && ps"minc run -t /bin/shminc run /usr/bin/python3 /home/hello.py
minc run -t /usr/bin/python3 /home/todo.py# Start background sessions
mintab new minc run -t /bin/sh
mintab new minc run -t /usr/bin/python3 /home/todo.py
# List all running sessions
mintab list
# Attach to a session (Ctrl+A then D to detach)
mintab attach 0
mintab attach 1
# Kill a session
mintab kill 0Each minc container gets:
| Isolation | Mechanism |
|---|---|
| Own PID tree (container = PID 1) | CLONE_NEWPID |
| Own filesystem root | CLONE_NEWNS + OverlayFS + pivot_root |
| Own hostname | CLONE_NEWUTS |
| Own network stack | CLONE_NEWNET |
| Own IPC | CLONE_NEWIPC |
| Memory / PID limits | cgroup v2 via cgmgr |
| Syscall restriction | seccomp BPF whitelist |
| No capability escalation | All capabilities dropped before exec |
Current limitation:
CLONE_NEWNETgives each container a genuinely isolated network namespace, but nothing currently attaches it to the host bridge — containers have loopback only, no outside connectivity yet. There is also no user-namespace UID/GID remap (CLONE_NEWUSER): containers run as literal host UID 0, so capability-drop + seccomp are the only privilege boundaries, not a mapped unprivileged UID as a backstop.
Run bash build/setup-langs.sh once before make image to stage:
- Python 3.12 — musl-linked static binary from
python-build-standalone - TCC — Tiny C Compiler, compiled statically, for in-container C execution
These are staged into rootfs/usr/ and excluded from git (too large).
# After booting:
# 1. Show OS identity
uname -a && ps
# 2. Container isolation
minc run /bin/sh -c "hostname && echo PID=\$\$"
# 3. Filesystem isolation (write inside, gone on host)
minc run /bin/sh -c "echo secret > /tmp/f && cat /tmp/f"
ls /tmp/f # not here
# 4. Python in a container
minc run /usr/bin/python3 /home/hello.py
# 5. Multiple containers simultaneously
mintab new minc run -t /bin/sh
mintab new minc run -t /usr/bin/python3 /home/todo.py
mintab list
mintab attach 0 # Ctrl+A D to detach
mintab attach 1- No systemd, no udev, no dbus
- No glibc (Python uses musl; all OS binaries are statically linked)
- No package manager
- No kernel modules (monolithic minimal config)
- No end-to-end container network connectivity yet —
netdsets up the host bridge and NAT plumbing at boot, and per-container veth attachment is fully implemented (netd/bridge.c,netd/veth.c), but it isn't yet called from the container spawn path (runtime/spawn.c), so containers currently get an isolated-but-unconnected network namespace - No user-namespace UID/GID remapping — containers run as host UID 0; capability dropping and the seccomp filter are the only privilege boundaries
- No checksum/signature verification on the staged Python/TCC toolchains downloaded by
build/setup-langs.sh