1
3
Fork
You've already forked kanit
1
Experimental init system
  • Rust 97.6%
  • Shell 2%
  • Just 0.4%
Find a file
Kate the Gay 3d96689ac3
All checks were successful
ci/woodpecker/push/test Pipeline was successful
Install lexpect in CI
2025年08月22日 22:56:16 -07:00
.cargo New error system 2024年01月07日 19:23:42 -08:00
.vscode Allow for poweroff, reboot, and halt commands 2024年09月07日 18:46:01 -07:00
.woodpecker Install lexpect in CI 2025年08月22日 22:56:16 -07:00
crates Format code 2025年08月14日 22:37:38 -07:00
docs Update email address 2025年08月14日 17:46:49 -07:00
scripts Use lexpect instead of expect 2025年02月24日 19:57:09 -08:00
src Allow for poweroff, reboot, and halt commands 2024年09月07日 18:46:01 -07:00
units Rework loader 2024年07月06日 17:33:11 -07:00
.gitignore Remove libguestfs test dependency 2024年05月24日 17:19:13 -07:00
Cargo.lock Update crates 2024年07月07日 22:11:58 -07:00
Cargo.toml Use Rust 2024 2025年02月24日 19:57:29 -08:00
justfile Add cargo test to just test 2024年07月12日 00:56:54 -07:00
LICENSE Update license 2024年09月07日 18:09:59 -07:00
readme.md Update readme 2024年09月07日 18:54:32 -07:00

Kanit

Toy init system

Testing

To test Kanit, the following dependencies are needed:

  • qemu (qemu-system-x86_64)
  • expect
  • curl
  • rust
  • just

Once all dependencies are installed, Kanit can be tested in a vm by running just. The vm's password is set to nothing by default.

Controller

Kanit can be controlled with kanit.

Units

Units are written in TOML and can be loaded for next boot with kanit service enable <unit> [level]. They must be stored at /etc/kanit to be found by kanit. Units are only ran at boot.

Units can be disabled at next boot with kanit service disable <unit> [level] and all enabled units can be displayed with kanit service list.

Blame

The time each unit takes to run can be viewed with kanit blame (or sorted with kanit blame -s).

Power

The system can be powered off, rebooted, halted, and rebooted with kexec with kanit <op> with an optional -f flag to bypass the init. In addition, the standard poweroff, reboot, and halt commands can be used.

Goal

Kanit aims to be minimal with the ability to be rolled into a single executable (multicall).

Todo

(In no particular order)

  • Fix compiling with x86_64-unknown-linux-gnu
  • Service supervision
    • kanit-supervisor
    • Avoid spawning new process and integrate directly into init
    • Record logs
  • Dynamically loading units
    • Move kanit-rc/services/* to unit files instead
    • Allow unit files to be baked into the init
    • Allow unit files to be loaded at startup
  • (Re)loading units
  • Configuration
  • Enabled units list
  • Concurrency
  • More graceful fail over
    • Emergency shell
    • Allow for continuing when unit fails to start
    • Allow for panic recovery (unable to do with panic = "abort")
  • Split kanit-rc/src/init to separate crate
  • Consider moving kanit-rc/init/* to unit files
  • *dev
    • mdev
    • udev
  • Testing
    • Smoke test
    • Unit tests
  • Syslog
    • Busybox
    • Custom
  • Logging
    • Startup logger
    • Runtime logger
  • Shutdown

Credit

  • OpenRC/Alpine for init scripts