minaki
MinakiLabs command-line tools: one install, one command. Version 0.1 ships one
command, minaki grub, a read-only check that your GRUB config can boot.
pip install minaki # or: pipx install minaki
minaki grub check
minaki grub pin
minaki --help
Targets Ubuntu 24.04 first, and also Ubuntu 20.04, 22.04 and 26.04 and Debian 12.
It needs Python 3.8 or newer and only the standard library. It reads files and
runs grub-script-check (Debian/Ubuntu package grub-common). Run it as root,
since grub.cfg is often readable only by root.
minaki grub check
check reads /boot/grub/grub.cfg once and runs every check on that one copy:
| Check | Fails when |
|---|---|
exists |
the file is missing (and GRUB is installed), or cannot be read |
size |
the file is empty (--min-size BYTES raises the floor) |
no-nul-bytes |
the file has NUL bytes, as a file zero-filled after a crash does |
menuentry |
there is no menuentry line, so GRUB has nothing to boot |
sections |
a ### BEGIN /etc/grub.d/... ### section written by grub-mkconfig never reaches its ### END |
grub-script-check |
grub-script-check rejects the file (it gets the same bytes on stdin) |
The required checks are: the file exists, is not empty, has a menuentry, and
grub-script-check accepts it. Two more checks are added. no-nul-bytes
catches a file that was zero-filled after a crash. sections catches a file
that grub-mkconfig started but that ends before a section it opened is closed.
A hand-written config with no section markers skips that check.
Exit codes:
| Code | Meaning |
|---|---|
| 0 | every check passed |
| 1 | the file is bad (the output names what failed and where the last-good copy is) |
| 2 | could not check: bad usage, grub-script-check missing, permission denied, or not applicable |
On a system that boots with systemd-boot, or that has no GRUB at all, there is no
GRUB config to check. check then reports NOT APPLICABLE, exits 2, and does
not crash.
It also warns, without failing, when a grub-mkconfig or update-grub is
running at that moment (read from /proc) or when grub.cfg.new exists. Either
one means the file may be in the middle of being written.
A healthy Ubuntu 24.04 system (real output from a lab VM):
$ sudo minaki grub check
minaki 0.1.1 grub check: /boot/grub/grub.cfg
PASS exists 7918 bytes, modified 2026-11-30T05:22:46Z
PASS size 7918 bytes, not empty
PASS no-nul-bytes no NUL bytes
PASS menuentry 6 menuentry lines
PASS sections 12 generated sections, all closed
PASS grub-script-check /usr/bin/grub-script-check exit 0
Result: OK (exit 0)
A syntax error:
$ sudo minaki grub check
minaki 0.1.1 grub check: /boot/grub/grub.cfg
PASS exists 7917 bytes, modified 2026-11-30T05:23:16Z
PASS size 7917 bytes, not empty
PASS no-nul-bytes no NUL bytes
PASS menuentry 6 menuentry lines
PASS sections 12 generated sections, all closed
FAIL grub-script-check exit 1: Syntax error at line 54
Result: FAILED: grub-script-check (exit 1)
Last good copy: /var/lib/minaki/grub.cfg.last (pinned 2026-11-30T05:23:16Z, 7918 bytes, sha256 04b7dfc37181d1d8)
minaki grub pin
pin runs check. If every check passes, it saves those exact bytes to
/var/lib/minaki/grub.cfg.last, with a small grub.cfg.last.json holding the
sha256, size and time. Because it writes the bytes it checked, a file that
changes in between can never be pinned unchecked. The directory is mode 0700
and the files are 0600, since a GRUB config can hold password hashes. If the
copy already matches, it reports unchanged. If check fails, nothing is
written and the old last-good copy stays. It refuses a state directory under
/boot.
A good time to pin is after a kernel update that booted fine.
If check fails, run sudo update-grub once, with no other package manager
or update-grub running, then run minaki grub check again. The last-good copy
is there to compare against, or to restore by hand as a last resort. Before you
restore it, read it: it may name kernels that have since been removed.
--json
Both commands take --json and print one object:
{
"tool": "minaki", "plugin": "grub", "version": "0.1.1", "command": "check",
"status": "ok | failed | error | not_applicable", "exit_code": 0,
"config": {"path": "/boot/grub/grub.cfg", "size": 9123, "sha256": "...", "mtime": "..."},
"checks": [{"name": "exists", "status": "pass | fail | skip | error", "detail": "..."}],
"failed": [], "errors": [], "warnings": [], "writers": [],
"last_good": {"path": "/var/lib/minaki/grub.cfg.last", "sha256": "...", "pinned_at": "...", "matches_current": true}
}
pin adds pinned (true/false) and pin_detail.
What it never does
- It never writes to
/boot. It never runsupdate-grub,grub-mkconfigorgrub-install, and never installs wrappers or hooks. - It never touches the network: no telemetry, no update check, no account.
- It has no mode that runs two GRUB config writers at once. It reports on the race below; it is not a way to reproduce it.
What it does read: grub.cfg, /proc/*/cmdline (to spot running writers), and
the usual ESP paths (to spot systemd-boot). What it runs: grub-script-check,
which reads the config on stdin.
The concurrent update-grub race
Two GRUB config writers running at the same time (for example a package hook
and a snapshot daemon, or two services at boot, each running update-grub or
grub-mkconfig) can leave the boot config broken or missing. Public reports
of this class of problem:
- grub-btrfs issue #288
(2023): with
grub-btrfsdrunning, a config rebuild during a pacman update failed with "cannot open `/boot/grub/grub.cfg.new'". The reporter suspected the daemon and the package hook were rebuilding at the same time. - TrueNAS middleware commit a50f509
(May 2026): two boot-time listeners both ran
grub-mkconfigat the same time, "racing on/boot/grub/grub.cfg.tmp(.new)". The fix left one writer. - Launchpad #396381 (2009):
update-grubran twice during one package operation; the report suggests a dpkg trigger so it runs once.
Our report: Launchpad Bug #2178455
(2026), reported by MinakiLabs, asks Ubuntu to backport upstream GNU GRUB commit
4f07dd26
("grub-mkconfig: avoid temp-file races in concurrent runs"). This is the known
race class above, which we reproduced independently on stock Ubuntu 24.04 and
26.04 cloud images, not a new discovery. The rates in the report (for example 5
of 20 trials on each release) come from deliberately forcing two update-grub
runs at the same time; they are not how often it happens in the field, which is
not known. They count trials that left grub.cfg broken or unusable (failing
grub-script-check or with no boot entries), not machines that failed to boot.
Runs one after the other, or under one lock, and runs with the upstream change
applied, gave 0 unusable.
minaki grub does not prevent this race. It tells you whether the file on disk
right now will boot, and keeps a copy of the last one that passed.
Plugins
minaki parses only its own flags (--help, --version, --plugins) and
the command name. Everything after minaki <command> goes to that command
unchanged. Commands are plugins registered on the Python entry-point group
minaki.plugins. The core asks that group what is installed and never imports a
plugin by name.
Every plugin MinakiLabs writes ships inside the minaki package, so
pip install minaki gets all of them. Anyone can publish their own
minaki-<something> package that depends on minaki and registers on the same
group. There is no plugin store, downloader or auto-install.
Plugins build on a small SDK, minaki.sdk: an optional base class, the exit
codes, an argument parser named minaki <name>, and the standard --json. The
plugin API is versioned (now 1); a plugin that needs a newer API is refused with
a message to upgrade. minaki --plugins [--json] lists every registered
plugin, where it came from, and whether it loads.
- Guide and contract: docs/PLUGINS.md
- A complete plugin to copy: examples/minaki-hello
If two packages register the same name, the one inside minaki wins, and
minaki --help shows the clash. A plugin that fails to load is listed with its
error, and the other commands still work.
Development
python3 -m unittest discover -s tests -v # standard library only
The real grub-script-check tests run when grub-common is installed. CI runs
the suite inside Ubuntu 20.04, 22.04, 24.04 and 26.04 and Debian 12 containers,
as root and as a normal user. tests/lab/ holds the scripts we run on
throwaway VMs. Those scripts break grub.cfg on purpose, so never run them on a
machine you care about.
Tested on
Every case on a throwaway VM, 2026-11-30, minaki 0.1.0 installed from the wheel (0.1.1 changes only this README).
The cases: the real generated config passes, both as text and as JSON. pin,
then pin again, which reports unchanged. /boot is unchanged by the tool, and
the pinned copy is mode 0600 and byte-identical. Then the harness breaks the
file: empty, cut in half, cut at a clean line, syntax error, zero-filled,
missing, grub.cfg.new present, and grub-script-check removed. A run as
nobody, one real update-grub, and a final restore that is byte-identical
close it out. On the systemd-boot VM, check and pin report not applicable.
| System | Kernel | Python | Lab cases |
|---|---|---|---|
| Ubuntu 20.04 | 5.4.0-216-generic | 3.8.10 | 30 of 30 passed |
| Ubuntu 22.04 | 5.15.0-203-generic | 3.10.12 | 30 of 30 passed |
| Ubuntu 24.04 | 6.8.0-147-generic | 3.12.3 | 30 of 30 passed |
| Ubuntu 26.04 | 7.0.0-43-generic | 3.14.4 | 30 of 30 passed |
| Debian 12 | 6.1.0-56-cloud-amd64 | 3.11.2 | 30 of 30 passed |
| Ubuntu 24.04, UEFI, systemd-boot, GRUB removed | 6.8.0-151-generic | 3.12.3 | 6 of 6 passed |
License
Apache-2.0. Copyright 2026 MinakiLabs LLC. See LICENSE.
This checks the bootloader file and does not remove packages; Minaki Tuner (minakilabs.com/tuner) is the product that does.
Metadata
Release files for minaki 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| minaki-0.1.1.tar.gz | 30.9 kB | With provenance | Details for minaki-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| minaki-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for minaki-0.1.1-py3-none-any.whl |
Total release size: 54.9 kB
Release files / minaki-0.1.1.tar.gz
| Download URL | minaki-0.1.1.tar.gz |
|---|---|
| Size | 30.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9dfeeb5e0389ba6141f6cf51ac08113bf2150d2a0191f8c2266c33474d4f85ca
|
|
BLAKE2b-256 checksum How to use checksums |
22c1fdad3b2ece88aee1618e876d2b126230a0d2cff1a682b9b088b719d72e07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / minaki-0.1.1-py3-none-any.whl
| Download URL | minaki-0.1.1-py3-none-any.whl |
|---|---|
| Size | 24.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f46c311bfa850ae58ffce5d1201ecea988019e2eaabcbc1ea4cec3718bd8db19
|
|
BLAKE2b-256 checksum How to use checksums |
a374c599889ef1512ca95d26855d0d4bfd9aa17dfcfc8eaa31511ceb42717aeb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logSecurity for minaki 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for minaki-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.