Info

  • Started: 11/7/2025
  • Progress: 14% [1/7]
  • Stage: Research & Kernel Digging

  • mntui
mntui mntui

mntui

mntui - Simple UI for FSTAB in Linux

I wanted to democratize mount management in Linux and sometimes you just need a tool that doesn’t care about your distro, your init system, or whatever’s half-working around you. mntui is that kind of tool - a minimal, trusted mount utility that reads straight from the kernel and edits your /etc/fstab safely, without bringing any friends.

It should run the same on a polished workstation or in a panic shell with only busybox and hope.


What I started with

I wanted a mount manager that doesn’t depend on anything else - no util-linux, no systemd, no dynamic libraries quietly missing at the worst possible time.

Just a single static binary that:

  • Lists what’s mounted right now (via /proc/self/mountinfo)
  • Reads and validates /etc/fstab
  • Lets you mount, unmount, and test entries safely
  • Works even when /usr isn’t mounted yet

That’s it. Simple enough to trust. Portable enough to live on a rescue USB.


Ohh ‘kay, why though?

Most systems today assume the rest of userspace is intact - until it isn’t. In an initramfs, a chroot, or a stripped-down container, the usual helpers (findmnt, lsblk, blkid) just vanish.

mntui keeps working anyway. It’s both a recovery tool and a way to learn how Linux actually tracks mounts - through /proc, /sys, and the VFS namespace logic that glues it all together.

If nothing else, it’s a great excuse to poke around /proc/self/mountinfo and realize just how many layers there are between “mount this drive” and “why won’t this boot”.


The Guiding Rules

PrincipleMeaning
Kernel truth onlyThe kernel already knows what’s mounted - trust it.
Static & portableCompiled with musl, runs anywhere that speaks ELF.
Fail-safe editing/etc/fstab changes are atomic, validated, and backed up.
Readable outputHuman-readable by default, JSON when you need automation.
Security-firstRoot only when required; read-only mode for everyone else.
Graceful degradationKeeps running even if /sys isn’t there.

No magic daemons, no D-Bus, no guessing.


The Shape of It

+---------------------------+
| (Optional TUI Frontend) |
| ncurses / Textual client |
| consumes JSON output |
+---------------------------+
| mntui-core (C) |
|---------------------------|
| mountinfo.c - /proc |
| sysfs.c - /sys |
| fstab.c - /etc |
| actions.c - syscalls |
| json.c - encoder |
| main.c - CLI/TUI |
+---------------------------+
| Linux Kernel APIs |
| mount(2), umount2(2), |
| statfs(), open(), etc. |
+---------------------------+

The end goal is a static ELF around 200–400 KB. Tiny enough to drop in an initramfs or even embed into a Docker image.


Technical Aims

  • Parse /proc/self/mountinfo directly and safely
  • Spot mismatches between live mounts and /etc/fstab
  • Perform atomic writes when updating fstab
  • Call mount(2) and umount2(2) directly, no external tools
  • Expose structured JSON for optional frontends or scripts

Basically: findmnt meets nmtui, but doesn’t explode when you forget to mount /usr.


Progress So Far

Research & Kernel Diggingin-progress

Figure out how to talk to the kernel directly - how `/proc/self/mountinfo` and `/sys/class/block` describe what’s actually mounted, and how that ties into `mount(2)` and `umount2(2)`. Minimal C code, no dependencies. Learn it properly before touching anything.

💡
🔍🟡
🧪
🧠
🧩
🔒
🚀
📍

I’m still somewhere between discovery and architecture, but the core idea feels right: build one binary that always tells the truth about what’s actually mounted.


Why It Feels Right

Because when a system’s half-alive, it’s comforting to have one command that doesn’t lie. That’s the whole philosophy in a single line:

When nothing else runs, mntui should still tell the truth about your filesystems.


If You Want to Dig Deeper

If you want to go down the same rabbit hole:

  • man 5 proc → the /proc/self/mountinfo spec
  • man 2 mount → what all those MS_* flags mean
  • I guess that there are other sources, but maybe you search for things now, or maybe you don’t, or maybe you don’t care, or maybe you don’t care about caring - That’s so cool how you don’t care… wow, that’s amazing! That’s incredible!

What were we talking about? I am tired now.
K thx! Bye!


← Back to projects