I have successfully booted into a NetBSD kernel with a custom ramdisk that has a statically linked init that does nothing.
Baby steps!
Discussion
I have successfully booted into a NetBSD kernel with a custom ramdisk that has a statically linked init that does nothing.
Baby steps!
Looking at runit, it's runlevels and scripts, and manual dependency management and stuff, and that does not spark joy.
Yes, it is lean and all, but doing anything more advanced like using cgroupsv2 on Linux is a pain in the ass at best.
Nope.
mouse makes rocks do math (sickos edition)
@algernon
cgroups? I thought you were making a NetBSD distribution
@wolf480pl I am. But the goal is to be portable, and run on Linux too, and use features available on the host platform.
nitro is also a bunch of scripts, and suggests using runit's chpst for changing the service's process state (uid/gid/pwd/chroot/etc).
I like the look of nitro more than runit, but I do not want scripts. I want as little scripting in my init as possible, and definitely not shell scripts, save for a few exceptional cases (but even then, systemd-style ExecStart that just runs a script is what I'd aim for).
dinit appears to use a service description file, rather than shell scripts, so this is promising so far. It supports dependencies, working directory, environment files, running as a user - all the good stuff, and it supports the systemd socket activation protocol too, a nice boon!
Also supports redirecting stdout/stderr, though... unsure if it supports redirecting them to different places, or only one of them.
This looks like a suitable option so far. Maybe not perfect, but should be good enough for initial experimentation.
So... my next stage would be to cobble together a ramdisk that has static dinit, and a few other static binaries to mount tmpfs on /. I'm starting with static binaries, because then I don't need to copy shared libs and stuff.
Eventually, the ramdisk will by dynamically linked too. I think. There's a scenario where it will be just a statically compiled Rust program that bootstraps everything and execs the real init.
Since I don't want to use NetBSD's initd, lets look at the init systems available in pkgsrc!
We have
dinit,nitro,runit, as far as I can tell, andsysvinitinpkgsrc-wip. I will not be usingsysvinit, so lets have a quick thread about the other three!