You are not logged in.

#51 2013-05-18 18:11:30

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

Re: Replace systemd with busybox + minirc

FYI, there is an exhaustive comparison chart between sysvinit, upstrart, systemd and minirc:

http://ranger.nongnu.org/minirc.html


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

Offline

#52 2013-05-19 13:03:23

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

Re: Replace systemd with busybox + minirc

Nice comparison.

Love the green "No" and red "Yes" tongue. But at the bottom, you have used green for "Yes", and this is confusing. I think there should be consistency.

Offline

#53 2013-05-19 16:24:53

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: Replace systemd with busybox + minirc

x33a wrote:

But at the bottom, you have used green for "Yes", and this is confusing. I think there should be consistency.

It's not a mistake. Read the summary if you don't get it.

Offline

#54 2013-05-19 18:39:17

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

Re: Replace systemd with busybox + minirc

I am talking about the colour coding. Usually a colour is associated with a context, for example, green for positive, red for negative.

I guess the context here is that green is for minirc's features.

Offline

#55 2013-05-19 19:50:37

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: Replace systemd with busybox + minirc

No, it says an init system has two tasks:
1. Be the parent of all processes. So for table item, "Is the parent of all processes," YES is green, NO is red.
2. Run scripts on boot and shutdown. So for table item, "Run scripts on boot and shutdown," YES is green, NO is red.
Other tasks are not for an init system. So for other table items NO is green and YES is red.

Offline

#56 2013-05-24 07:29:13

W.F.Cody
Member
From: Ghent
Registered: 2010-11-18
Posts: 155

Re: Replace systemd with busybox + minirc

nbvcxz wrote:

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


It would be awesome if someone could pick up where I left off smile Especially a busybox-based init system would be great.
Also if the default sh could point to busybox ash.

There may be even more base packages that can be converted to busybox symlinks (tar, cpio, ...)

A meta-package for a base2busybox conversion of Arch would be very nice too...


My AUR packages
Any package of mine is up for grabs. If you think you could mantain it better - just contact me!

Offline

#57 2013-05-24 14:48:58

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

Re: Replace systemd with busybox + minirc

W.F.Cody wrote:
nbvcxz wrote:

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


It would be awesome if someone could pick up where I left off :) Especially a busybox-based init system would be great.
Also if the default sh could point to busybox ash.

What do you mean with a busybox-based init system, other than what is presented in this thread? ^^
Minirc also works in busybox ash by the way.


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

Offline

#58 2013-05-25 22:23:13

Ypnose
Member
From: Jailed in the shell
Registered: 2011-04-21
Posts: 353
Website

Re: Replace systemd with busybox + minirc

Interesting project. If I have enough time, I'll try to fork you repo on GitHub (and I'm also thinking add it in my upcoming distro).


Github -- My terminal font Envypn

Offline

#59 2013-05-26 12:25:57

W.F.Cody
Member
From: Ghent
Registered: 2010-11-18
Posts: 155

Re: Replace systemd with busybox + minirc

hut wrote:
W.F.Cody wrote:
nbvcxz wrote:

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


It would be awesome if someone could pick up where I left off smile Especially a busybox-based init system would be great.
Also if the default sh could point to busybox ash.

What do you mean with a busybox-based init system, other than what is presented in this thread? ^^
Minirc also works in busybox ash by the way.

Sorry about not being clear. I meant the bigger-picture project of a "base2busybox" conversion package, where obviously a busybox-based init would be a part of it.


My AUR packages
Any package of mine is up for grabs. If you think you could mantain it better - just contact me!

Offline

#60 2013-05-27 16:32:59

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: Replace systemd with busybox + minirc

I was just reading through the minirc code and I thought I'd point out that the following function isn't very portable:

echo_color() {
  color=$1
  shift
  echo -e "[1;3${color}m$@[0m"
}

"echo -e" isn't portable. You should use:

printf "\033[01;3${color}m$@\033[00m\n"

It's not worth forking, branching, committing and making a pull request just for that smile

Last edited by jakobcreutzfeldt (2013-05-27 16:33:58)

Offline

#61 2013-05-28 00:22:12

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

Re: Replace systemd with busybox + minirc

Thank you, jakobcreutzfeldt. I applied your modification.


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

Offline

#62 2013-08-13 00:45:27

2ManyDogs
Forum Moderator
Registered: 2012-01-15
Posts: 4,645

Re: Replace systemd with busybox + minirc

At the risk of a necrobump, is anyone still working on this? I have it working well with udev, but I'm not sure how to make it work with busybox mdev. I've read Gusar's posts and the topics he linked, (and this) but I'm still not sure how to proceed.

Last edited by 2ManyDogs (2013-08-13 00:56:32)


How to post. A sincere effort to use modest and proper language and grammar is a sign of respect toward the community.

Offline

#63 2013-08-13 08:05:28

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

Re: Replace systemd with busybox + minirc

I wouldn't call it a necrobump but thanks for bringing this thread to the front page since I had forgotten about it. Just had to do some workarounds for the new systemd being unfriendlier so it's time I set this up.
I want to use mdev so I'll make some noise about how it goes.
Cheers

Last edited by moetunes (2013-08-13 08:06:11)


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

Offline

#64 2013-08-13 10:36:39

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

Re: Replace systemd with busybox + minirc

Well, mdev should "work". It's just a matter of configuring the hell out of it until it suits your needs. I sadly haven't gotten around to it, perhaps I've been spoiled too much by the modern udev variants that do everything out of the box.


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

Offline

#65 2013-08-13 15:38:36

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Replace systemd with busybox + minirc

inittab seems a little extreme at shutdown, which is basically: send TERM, wait just 1 second, then send KILL.

It would be much nicer to have a sensible polling timeout, e.g. in BASH:

signals() {
    # sync first (as in Debian), so disk flushing does not affect timeout
    sync

    echo -n "Sending all processes the TERM signal... "
    killall5 -15 -o 1  # SIGTERM

    # Taken from /debian/src/initscripts/etc/init.d/ in:
    # http://packages.ubuntu.com/source/saucy/sysvinit
    for n in `seq 1 20` ; do
        # Use SIGCONT/signal 18 to check if there are processes left
        killall5 -18 -o 1
        # https://mailman.archlinux.org/pipermail/arch-projects/2011-July/001434.html
        if [[ $? -eq 2 ]] ; then
            echo "terminated in $n."
            return 0
        fi
        sleep 0.5
    done

    # Not all died voluntarily
    echo -n "Killing stubborn... "
    killall5 -9 -o 1  # SIGKILL
    echo "done."
}

Regarding mdev, I would suggest eudev instead.

Offline

#66 2013-08-14 01:43:21

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: Replace systemd with busybox + minirc

brebs wrote:

Regarding mdev, I would suggest eudev instead.

On one of my desktops I have been using https://aur.archlinux.org/packages/eudev-git/ for 2 months now without problems, so I didn't feel compelled to try mdev.

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#67 2013-08-31 00:21:11

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,444
Website

Re: Replace systemd with busybox + minirc

brebs wrote:

inittab seems a little extreme at shutdown, which is basically: send TERM, wait just 1 second, then send KILL.

I'm just checking this out, and I'm curious why any of this is even in inittab.  Busybox's init already handles this internally - admittedly via the method that brebs is questioning, but if you put this in inittab, then you send TERM to all processes, wait 1 second, then send KILL to all processes ... then busybox's init sends TERM to all processes, waits 1 second, then sends KILL to all processes.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#68 2013-08-31 01:23:07

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

Re: Replace systemd with busybox + minirc

Trilby wrote:
brebs wrote:

inittab seems a little extreme at shutdown, which is basically: send TERM, wait just 1 second, then send KILL.

I'm just checking this out, and I'm curious why any of this is even in inittab.  Busybox's init already handles this internally - admittedly via the method that brebs is questioning, but if you put this in inittab, then you send TERM to all processes, wait 1 second, then send KILL to all processes ... then busybox's init sends TERM to all processes, waits 1 second, then sends KILL to all processes.

Busybox kills everything at the last moment before rebooting. Doing it manually is the only way* to first kill all processes, then unmounting all partitions, then shutting down the comuter, in that order. I need to be able to unmount partitions *after* killing all processes because otherwise umount may fail when a process is accessing the hard drive, leaving the file system in an unclean state.

* except modifying busybox, of course.

Last edited by hut (2013-08-31 01:23:45)


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

Offline

#69 2013-08-31 01:29:41

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,444
Website

Re: Replace systemd with busybox + minirc

Thanks - I figured I might be missing something - that makes complete sense.

I just started digging around in busybox's code, and saw that, and it struck me as a bit odd.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#70 2013-08-31 03:44:50

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Replace systemd with busybox + minirc

brebs wrote:

killall5 -18 -o 1
# https://mailman.archlinux.org/pipermail … 01434.html
if [[ $? -eq 2 ]] ; then

I just took a quick look at procps/kill.c in busybox 1.21.1, and it seems that there is no need for "-o 1", since 1 is automatically omitted:

            if (p->sid == (unsigned)sid
             || p->pid == (unsigned)pid
             || p->pid == 1
            ) {
                continue;

However, the value of 2 doesn't seem to be returned by busybox's killall5 - it would need patching to work more like sysvinit's patched-up killall5. Edit: busybox 1.22.0 includes Gusar's patch smile


One thing that took me ages to debug, with sysvinit, was the occasional unclean (i.e. filesystem not unmounted) shutdown, if I'd recompiled system libs - I finally traced it back to it needing "telinit u", which restarts PID 1. The real solution was to compile sysvinit as statically linked:

LDFLAGS+=" -static"

Which can be done in busybox's config with CONFIG_STATIC, although it increased the filesize from 800k to 1.8mb.

Last edited by brebs (2014-01-02 22:47:17)

Offline

#71 2013-08-31 20:08:31

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

Re: Replace systemd with busybox + minirc

brebs wrote:

However, the value of 2 doesn't seem to be returned by busybox's killall5 - it would need patching to work more like sysvinit's patched-up killall5.

Yep. I made such a patch, it's very simple:

diff -ur busybox.orig/procps/kill.c busybox/procps/kill.c
--- busybox.orig/procps/kill.c	2012-07-18 17:32:32.000000000 +0200
+++ busybox/procps/kill.c	2012-08-12 15:11:35.792678564 +0200
@@ -158,7 +158,7 @@
 	if (killall5) {
 		pid_t sid;
 		procps_status_t* p = NULL;
-		int ret = 0;
+		int ret = 2;
 
 		/* Find out our session id */
 		sid = getsid(pid);
@@ -172,6 +172,7 @@
 			if (p->sid == (unsigned)sid
 			 || p->pid == (unsigned)pid
 			 || p->pid == 1
+			 || p->sid == 0
 			) {
 				continue;
 			}
@@ -200,6 +201,7 @@
 					goto dont_kill;
 			}
 			kill(p->pid, signo);
+			ret = 0;
  dont_kill: ;
 		}
  resume:

Offline

#72 2013-09-06 03:50:53

gothmog123
Member
Registered: 2012-10-31
Posts: 120

Re: Replace systemd with busybox + minirc

Great project! Could anyone help me how to add connman to the custom_start bottom part of minirc.conf? Thanks.

edit: I'm asking because connman simply says "cannot connect to socket" ... also ufw just gives a bunch of iptables errors. I can't really figure out how to add any new daemons.

edit: socket is /run/dbus/system_bus_socket - something is going wrong when starting dbus

Last edited by gothmog123 (2013-09-07 09:24:35)

Offline

#73 2013-09-12 22:31:14

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

Re: Replace systemd with busybox + minirc

gothmog123 wrote:

Great project! Could anyone help me how to add connman to the custom_start bottom part of minirc.conf? Thanks.

edit: I'm asking because connman simply says "cannot connect to socket" ... also ufw just gives a bunch of iptables errors. I can't really figure out how to add any new daemons.

edit: socket is /run/dbus/system_bus_socket - something is going wrong when starting dbus

Well, the first step is to figure out what commands you need to run in order to start the daemon. Once you know them, just add them like this:

custom_start () {
    case "$1" in
    connman)
        <your commands here>
        ;;
    *)
        default_start "$@";;  # keep the default as fall-back
    esac
}

Sorry, I don't know anything about connman.


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

Offline

#74 2013-09-13 00:16:51

gothmog123
Member
Registered: 2012-10-31
Posts: 120

Re: Replace systemd with busybox + minirc

Thanks hut. I did some tinkering and turns out dbus is not started properly. I did a dirty hack to make it work but I don't want to run my system like this. If anyone knows how to do this properly....

My hack is to rm -r /run/dbus && mkdir /run/dbus in the rc script....

Also after an update connman only runs with sudo in the custom start script. lol

Offline

#75 2013-09-13 00:26:45

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

Re: Replace systemd with busybox + minirc

gothmog123 wrote:

Also after an update connman only runs with sudo in the custom start script. lol

Make sure to run the "rc start connman" command as root. (I'm guessing this problem occurs when you start it manually as a user, not on boot)


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

Offline

Board footer

Powered by FluxBB