You are not logged in.

#1 2013-05-02 16:42:19

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 569
Website

Replace systemd with busybox + minirc

For the minimalists out there, who want to know what is going on on their computer, who use a simple setup that doesn't depend on the fancy features of systemd and who want to get rid of it without going back to sysvinit, there is hope:

BUSYBOX!!

Busybox contains an init program, which does the thing an init program is supposed to do: Be the parent of all processes. But what about initscripts? It turns out that if you know exactly what you want your system to do, you can easily script it yourself.

I wrote an init script to do that, called "minirc" for "minimalistic rc script". Obviously it should be adapted to your use case, it just works on my machine^TM:

https://github.com/hut/minirc

It starts up udev, sets the hostname, mounts the file systems and starts the daemons and so on.

Later, in the user space, you can use it to list currently running daemons and individually start or stop them.

Comparison chart between sysvinit, upstart, systemd and minirc:
http://ranger.nongnu.org/minirc.html

Screenshot:
screenshot.png

How to install?
1. Read the README
2. Read the source code. If you don't understand what it does, you don't want it. Trust me.

Disclaimer: This probably exists already somewhere. Please don't hit me.

Last edited by hut (2014-04-07 17:54:26)


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#2 2013-05-02 17:16:00

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: Replace systemd with busybox + minirc

That's actually kind of awesome… Really tempted to put this on my laptop and see how fast of a boot I can manage…

All the best,

-HG

Offline

#3 2013-05-02 17:21:34

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 569
Website

Re: Replace systemd with busybox + minirc

HalosGhost wrote:

That's actually kind of awesome… Really tempted to put this on my laptop and see how fast of a boot I can manage…

All the best,

-HG

The boot will be slower due to a lack of parallelization. Though you can just write a "&" after the commands and start them all at once ^_^


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#4 2013-05-02 17:22:42

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: Replace systemd with busybox + minirc

hut wrote:

The boot will be slower due to a lack of parallelization. Though you can just write a "&" after the commands and start them all at once ^_^

And there I was, once a systemd/User convert, now questioning all that I had come to understand…

All the best,

-HG

Offline

#5 2013-05-02 18:05:08

moetunes
Member
From: A comfortable couch
Registered: 2010-10-09
Posts: 1,033

Re: Replace systemd with busybox + minirc

I'd be interested in hearing about what udev you are using, since it is now incorporated into systemd afaik.

I'll be giving this a go, thanks for reminding me about busybox.

Just a heads up, you missed a 'to' in the README :
"This works on my machine^TM.  You absolutely need to read"


You're just jealous because the voices only talk to me.

Offline

#6 2013-05-02 19:28:15

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 569
Website

Re: Replace systemd with busybox + minirc

It's systemd's udev. If you're daring, you can instead give busybox-mdev a try, it's commented out in the script. When I tried it, I had no sound and no keyboard/mouse in Xorg sad.


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#7 2013-05-02 19:37:51

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: Replace systemd with busybox + minirc

Okay, the more and more I contemplate this, the more and more I'm tempted to try it as one of those "just because I can" projects. Have you contemplated setting up your "minit" with a PKGBUILD so this can be installed and maintained as a package?

All the best,

-HG

Offline

#8 2013-05-02 19:55:57

moetunes
Member
From: A comfortable couch
Registered: 2010-10-09
Posts: 1,033

Re: Replace systemd with busybox + minirc

This gives me enough confidence to try out how it works with mdev... I'd like to remove systemd if I'm not going to use it.
Time to dust off the old laptop and experiment. wink


You're just jealous because the voices only talk to me.

Offline

#9 2013-05-02 20:16:54

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 569
Website

Re: Replace systemd with busybox + minirc

HalosGhost wrote:

Have you contemplated setting up your "minit" with a PKGBUILD so this can be installed and maintained as a package?

Yeah but this script will not work for everyone without modification, and if it did, it would be less minimalistic. But I don't know, maybe we get there at some point.

moetunes wrote:

This gives me enough confidence to try out how it works with mdev... I'd like to remove systemd if I'm not going to use it.
Time to dust off the old laptop and experiment. wink

Systemd-udev does more than mdev, like loading modules. We'd have to see what exactly systemd-udev does and reproduce it in the script.

Last edited by hut (2013-05-02 20:42:05)


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#10 2013-05-02 20:46:27

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: Replace systemd with busybox + minirc

mdev loads modules too.

One thing you'll lose by going with mdev is udev's ACL handing to give you permissions for audio, video and such. Ditching systemd also means losing logind, so anything using polkit (udisks, networkmanager, ...) won't work. It's possible to handle all that with good old unix groups though: https://gist.github.com/4013294/ccacedd … 92d6a2bddb

The other thing you'll lose is X's input hotplug handling. Which means you'll need to configure X by using InputDevice sections so that the xf86-input-keyboard/xf86-input-mouse drivers will be used instead of evdev. The mdev-like-a-boss stuff will be of help here: https://github.com/slashbeast/mdev-like-a-boss

Offline

#11 2013-05-03 10:20:56

nbvcxz
Member
From: Poland
Registered: 2007-12-29
Posts: 202

Re: Replace systemd with busybox + minirc

Little offtop. I just wonder if it is possible to replace with busybox not only init subsystem but also other parts of core. Does anyone succeed or have experience with it? I tried long time ago but with no luck :-(
Here nice wiki poage with PKGBUILDs links https://wiki.archlinux.org/index.php/Base2busybox


Lenovo G50 | LXQT-git | compton | conky

Offline

#12 2013-05-03 18:00:11

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Replace systemd with busybox + minirc

@ Hut, from your post here, the udev process isn't called systemd-udevd, did you extract it from the systemd package?

Offline

#13 2013-05-03 18:29:18

Doomcide
Member
Registered: 2011-08-22
Posts: 221

Re: Replace systemd with busybox + minirc

You might want to reconsider the name: http://www.fefe.de/minit/.
Btw I think this is worth a look, when searching for a small init system.

Offline

#14 2013-05-03 19:27:50

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 569
Website

Re: Replace systemd with busybox + minirc

Doomcide wrote:

You might want to reconsider the name: http://www.fefe.de/minit/.
Btw I think this is worth a look, when searching for a small init system.

Ack, I'll rename it to minirc (it's a more fitting name too, since it's no init program but a rc script)

x33a wrote:

@ Hut, from your post here, the udev process isn't called systemd-udevd, did you extract it from the systemd package?

I use /usr/bin/udevd which is owned by the systemd package.

Gusar wrote:

mdev loads modules too.

Then it loads considerably less modules, for example my video and network driver modules weren't loaded


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#15 2013-05-03 20:08:34

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: Replace systemd with busybox + minirc

hut wrote:

Then it loads considerably less modules, for example my video and network driver modules weren't loaded

It uses the exact same method as udev - modalias. Maybe you haven't configured it well.

From the mdev-like-a-boss page I linked to:

$MODALIAS=.* root:root 660 @modprobe "$MODALIAS"

That's very similar to how udev used to do it:

DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe -bv $env{MODALIAS}"

Offline

#16 2013-05-04 09:28:02

Shinryuu
Member
From: /dev/urandom
Registered: 2010-02-27
Posts: 339

Re: Replace systemd with busybox + minirc

This is really interesting stuff. I got it to work but I get "failed to connect to init daemon" everytime I try to run a command like reboot, shutdown etc.

Offline

#17 2013-05-04 09:30:21

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: Replace systemd with busybox + minirc

Shinryuu wrote:

This is really interesting stuff. I got it to work but I get "failed to connect to init daemon" everytime I try to run a command like reboot, shutdown etc.

Do you have those commands correctly linked to busybox? It provides those binaries, and it wouldn't shock me if they would need to be used rather than the default ones.

All the best,

-HG

Offline

#18 2013-05-04 09:45:57

Shinryuu
Member
From: /dev/urandom
Registered: 2010-02-27
Posts: 339

Re: Replace systemd with busybox + minirc

I don't know about that linking because I just followed the README and edited rc-script to work with my computer. I uncommented reboot/shutdown things from inittab and it gives the same error with 'ctrl+alt+del' shutdown method too.

Last edited by Shinryuu (2013-05-04 09:47:29)

Offline

#19 2013-05-04 09:57:12

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: Replace systemd with busybox + minirc

Shinryuu wrote:

I don't know about that linking because I just followed the README and edited rc-script to work with my computer. I uncommented reboot/shutdown things from inittab and it gives the same error with 'ctrl+alt+del' shutdown method too.

While running then, try `busybox reboot` and see what happens. I have a feeling that it might work just fine. Not sure though.

[Edit]: P.S., this might be relevant.

All the best,

-HG

P.S., hut, the pull request I just sent was meant partially to be fun, but also to give this project a bit of extra character. I won't be unhappy if you don't accept it.

Last edited by HalosGhost (2013-05-04 11:49:58)

Offline

#20 2013-05-04 14:02:46

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 569
Website

Re: Replace systemd with busybox + minirc

As HalosGhost said, the FAQ describes a way to shutdown the system (kill -USR2 1). Don't know how to reboot yet. The line about reboot was removed recently from the inittab because it doesn't work, as you pointed out.

Also, don't be shy about submitting patches :)

Last edited by hut (2013-05-04 14:22:12)


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#21 2013-05-04 14:19:35

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: Replace systemd with busybox + minirc

Sending TERM to init will cause a reboot. USR1 = halt (shutdown system without powering it off), USR2 = poweroff, TERM = reboot.

But that seems quite hacky to me, the proper way is creating reboot/halt/poweroff -> busybox symlinks.

Offline

#22 2013-05-04 14:23:09

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: Replace systemd with busybox + minirc

I'm with Gusar on this one. I would strongly recommend using busybox symlinks for the power functions. Seems much safer and more sane.

All the best,

-HG

Offline

#23 2013-05-04 14:34:26

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 569
Website

Re: Replace systemd with busybox + minirc

Yep, I'll add it to the README. Thank you.


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#24 2013-05-04 16:30:04

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: Replace systemd with busybox + minirc

I think we should take the time to figure out how to setup busybox mdev as the default because systemd is a huge dependency, and it'd be hilarious to have it as an optdepends tongue

All the best,

-HG

Offline

#25 2013-05-04 16:56:45

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,893
Website

Re: Replace systemd with busybox + minirc

@hut can you double check pkgbuild sha256sum for minirc.install


Mr Green

Offline

Board footer

Powered by FluxBB