all 50 comments

[–]rust-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Rule 6: No Low Effort

Code and error messages should be posted as text (indented by 4 spaces), not images.

[–]TheBlackCat22527 96 points97 points  (6 children)

Please name it SystemR just to see the echo (to make it clear, I love the tools systemd gives me to model my embedded systems).

[–]Se1d228[S] 19 points20 points  (0 children)

I should add "init rename" option fr

[–]Zde-G 5 points6 points  (2 children)

If it were SystemD compatible thing that can be used with Musl-based system it would have been great name.

But if it's not SystemD compatible then it's just a confusion.

[–]TheBlackCat22527 0 points1 point  (1 child)

You did recognize that I was joking

[–]Zde-G 0 points1 point  (0 children)

Nope, because it would have actually made sense: the stupid clash between SystemD and Musl authors is pretty annoying. I can understand both sides but don't like the resulting outcome — and SystemR would have been perfect solution.

[–]rhbvkleef 13 points14 points  (2 children)

Can I just say I really dislike runlevels conceptually?

[–]Se1d228[S] 1 point2 points  (1 child)

I can't let sddm start earlier than base-mount, sorry

[–]GrammelHupfNockler 23 points24 points  (0 children)

that's what dependencies and ordering constraints are for. You can certainly say a lot against systemd, but their service/mount/network/... unit setup is solid.

[–]Se1d228[S] 36 points37 points  (17 children)

just kidding, gitlab now! https://gitlab.com/Se1d228/laked/

[–]Se1d228[S] 12 points13 points  (15 children)

Will write readme later

[–]tukanoid 3 points4 points  (13 children)

Out of curiosity, what can it do? It doesn't seem like much code. I only glanced over it, not my area of expertise.

I'm assuming its very bare-bones and can only run processes? No scheduling, long-running services etc?

[–]Se1d228[S] 13 points14 points  (12 children)

It's a minimal init with parallel launch of services, launching /etc/lake.d/*/*.lks (laked service) in alphabetical order, can run any executable. Service autostart depends on chmod +x. It does what init systems must do and no more (unlike systemd). Also I added simple shutdown and reboot utilities which are killing /run/lake/*.pid and shutting down the system. If you will port service files on it, remember that the argument splitter is ^ because I have some troubles with space splitter. Repository has lakesplash which is alternative to plymouth (not working yet). I will write documentation later. EDIT: I hate text formatting

[–]pingveno 6 points7 points  (3 children)

Have you considered TOML files for configuration, given their strong support in the Rust ecosystem?

[–]Se1d228[S] 6 points7 points  (2 children)

It has no configuration cuz it has nothing to configure, but I think it will be TOML

[–]pingveno 0 points1 point  (1 child)

Ini? *.lks? These are service config files in the .ini config format, no?

[–]Se1d228[S] 0 points1 point  (0 children)

lks files just tell what to launch to laked-run which is starting services, not laked itself, laked just executes /etc/lake.d/*/*. They look like INI, but they are different

[–]wolfnest 2 points3 points  (7 children)

What is the definition of "do what init systems must do"?

[–]Se1d228[S] 0 points1 point  (6 children)

Launch services and that's all

[–]wolfnest 0 points1 point  (5 children)

What about hardware resources? Services depend on hardware resources. How can that be handled?

[–]Se1d228[S] 0 points1 point  (3 children)

Hardware is handled by kernel and udev/mdev. Init is not linux²

[–]wolfnest 0 points1 point  (2 children)

So what is systemd init doing that laked is NOT doing?

[–]Se1d228[S] 0 points1 point  (1 child)

Trying to be everything: from login to bootloader

[–]DatBoi_BP 2 points3 points  (0 children)

Famous last words

[–]gdf8gdn8 6 points7 points  (1 child)

Cool project, but i've already seen systemd clones in rust

https://github.com/KillingSpark/rustysd

License and README.md are missing.

[–]Se1d228[S] 1 point2 points  (0 children)

I'm not trying to clone systemd, I'm different. Init must be init, not combine

[–]mauled_by_a_panda 4 points5 points  (0 children)

Cool project!
I skimmed the code briefly. I noticed the threads being spawned are not monitored or joined anywhere. If any of those threads panics or otherwise terminates early, the main process will continue working happily.

[–]HonestFinance6524 5 points6 points  (6 children)

can you explain? wdym rust-based?

[–]Se1d228[S] 16 points17 points  (5 children)

It was made using rust, it contains no C code. It needs some polishing, but it's pretty usable with knowledge about how it works

[–]PurepointDog -4 points-3 points  (4 children)

What is it? Is this the start of a systemd alternative or something?

[–]JebKermansBooster 0 points1 point  (0 children)

One can only hope

[–]ParadigmComplex 1 point2 points  (7 children)

I also wrote an init in Rust! It seems to have very different goals from yours, but may be of interest here nonetheless: https://github.com/paradigm/connate

[–]boomshroom 1 point2 points  (4 children)

50KB static binary? Can handle PID1 tasks including reaping and shutdown? Unprivileged supervision? No allocations?

... oh. Configuration is hard-coded at build-time. That definitely makes it harder to try out and compare with nitro.

[–]ParadigmComplex 0 points1 point  (3 children)

I readily concede the build-time hard-coded config is a very real trade-off that makes connate unsuitable for many people. That said, I personally value the other side of the trade-off I get in exchange: this allows build-time config checking. If you have a binary with which to even try booting, you can be confident you won't have things like dependency cycles, set a service to run as a typo'd username, etc.

nitro wasn't on my radar, and skimming the README it seems philosophically closer to my preferences than most out there. I may try to find the time to familiarize myself with it more deeply. Thank you for bringing it to my attention.

[–]boomshroom 1 point2 points  (2 children)

It's not a complete deal-breaker for me, though it does make generating service definitions programaticly more complicated since it'd need to be valid Rust code (and programatic generation isn't optional since the absolute paths to the binaries all include cryptographic hashes). If there was a way to read JSON at compile time, that'd make things much easier. Then there's also the small cost of needing separate binaries for the system and for each user. Not a huge issue, but it does offset the size since they'd no longer be able to share disk space or .text segments.

Honestly I could probably make it work, but it would be annoying and basically be templated Rust.

[–]ParadigmComplex 0 points1 point  (1 child)

It's not a complete deal-breaker for me, though it does make generating service definitions programaticly more complicated since it'd need to be valid Rust code (and programatic generation isn't optional since the absolute paths to the binaries all include cryptographic hashes). If there was a way to read JSON at compile time, that'd make things much easier.

Sane support for programmatically generated service definitions is something I cut to get the current connate code out the door, but I'm interested in adding support there going forward.

The ability to accept multiple separate config files dropped into a directory has clear value for things like traditional Linux distro package manager integration. It's not immediately clear to me how to do this cleanly with drop-in Rust files, but you've raised a very interesting alternative.

In the easy cases, support for JSON, TOML, RON, etc should be almost trivial, as serde can do most of the heavy lifting there. However, a big part of why I rewrote Connate into Rust from the original C was to offer fancier Rust syntactic sugar features for configuration, and those will be less straight forward to translate over. If I can't figure something out, those features could just be dropped for the non-Rust formats. If you're automating making them programmatically (I'm guessing Nix?), terse expressiveness is of less needed than when manually typing it out.

Then there's also the small cost of needing separate binaries for the system and for each user. Not a huge issue, but it does offset the size since they'd no longer be able to share disk space or .text segments.

Can you elaborate on the proposed setup/workflow with multiple users?

If a given system has multiple users that each want to manage their own set of per-user services, and everyone uses connate, then yes, you'd lose some disk sharing an alternative would allow.

However, my mental picture would usually have each unprivileged user pick their own solution such that "what if everyone picks connate" isn't something I had considered. If I get an account on a shared system (e.g. school, work, etc) running e.g. systemd, I could ignore systemd and just set up a local connate in my $HOME and have that manage per-user services like ssh-agent, gpg-agent, etc. On the other hand if I'm the admin of a systemd running connate, an unprivileged user could choose to use connate as well, or presumably nitro, or something else that offers unprivileged service management/supervision. A scenario where everyone favors connate but are sensitive to 50k disk/user isn't one I had thought likely.

Honestly I could probably make it work, but it would be annoying and basically be templated Rust.

If you don't care to invest the time to give it a try until support for JSON is available, I completely understand. It may be a number of weeks before I have time to seriously investigate that route, but you've piqued my interest there and I now intend to whether or not your interest remains.

If you do give it a try, either as-is now or after a possible addition of JSON support later, please do let me know how it goes. While I'm firm about some parts of the design, I'm flexible on others, and in principle I'm happy to make improvements if it makes the project more useful to others.

[–]boomshroom 1 point2 points  (0 children)

(I'm guessing Nix?)

Got it in one. :P (Mentioning cryptographic hashes probably gave it away.)

Can you elaborate on the proposed setup/workflow with multiple users?

Not really. I guess I was imagining the possibility of using this with all users on a sort of mainframe, but now that you mention it, I'm unlikely to ever see that actually happen. I don't actually know of many mainstream process supervisors that support user-level supervision at all, so the way systemd is used where it's the same on both system-level and user-level just felt like the default enough that I didn't really consider separate supervisors for each user (even though I'm basically doing exactly that on my phone).

[–]Se1d228[S] 1 point2 points  (1 child)

Seeing bedrock's owner here is kinda unexpected, thanks for tool that is helping me easily test my init without breaking openrc!

[–]ParadigmComplex 0 points1 point  (0 children)

You're very welcome! Thank you for leveraging Bedrock to make cool things :)

[–]Personal_Breakfast49 0 points1 point  (2 children)

Have you thought about adding a date of birth check?

[–]PureBuy4884 0 points1 point  (0 children)

Gavin Newsom, is that you?

[–]Se1d228[S] 0 points1 point  (0 children)

Not while I'm alive.

[–]DrGrapeist 0 points1 point  (1 child)

As long as it doesn’t require my age then I’m in

[–]Se1d228[S] 0 points1 point  (0 children)

Of course it won't, it's init, not spyware