You are not logged in.

#1 2014-02-07 13:55:11

dimigon
Member
Registered: 2009-03-07
Posts: 139
Website

sinit - suckless init

Hi all,

In case anyone is interested, the initial discussion took place here: http://lists.suckless.org/dev/1402/19944.html

To jump straight to the code, have a look here: http://git.suckless.org/sinit/

Last edited by dimigon (2014-04-23 11:55:23)

Offline

#2 2014-02-07 14:21:00

mmix
Member
Registered: 2014-01-11
Posts: 33

Re: sinit - suckless init

Hi, oh i like anything which something new,
would love to see it with bootstrap-linux.

Offline

#3 2014-02-07 14:23:21

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

Re: sinit - suckless init

Any idea what they didn't like about busybox?

Offline

#4 2014-02-07 14:30:19

dimigon
Member
Registered: 2009-03-07
Posts: 139
Website

Re: sinit - suckless init

brebs wrote:

Any idea what they didn't like about busybox?

The busybox code sucks.

I am slowly trying to replace the busybox utils with sbase[1] and ubase[2].
That's the main reason I wrote sinit as well.

It is a lot of work and will take a long time before I get there.

[1] http://git.suckless.org/sbase/
[2] http://git.suckless.org/ubase/

Offline

#5 2014-02-07 14:33:46

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

Re: sinit - suckless init

dimigon wrote:
brebs wrote:

Any idea what they didn't like about busybox?

The busybox code sucks.

This tells us nothing. Can you be more specific? Exactly what "sucks" about the busybox code?


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

Offline

#6 2014-02-07 14:41:57

dimigon
Member
Registered: 2009-03-07
Posts: 139
Website

Re: sinit - suckless init

2ManyDogs wrote:
dimigon wrote:
brebs wrote:

Any idea what they didn't like about busybox?

The busybox code sucks.

This tells us nothing. Can you be more specific? Exactly what "sucks" about the busybox code?

Try to read it and understand it.

Offline

#7 2014-02-07 17:18:08

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

Re: sinit - suckless init

@dimigon,

Here's another lightweight init (minirc), in case you haven't heard about it. But it does make use of busybox.

https://bbs.archlinux.org/viewtopic.php?id=162606&p=1

Offline

#8 2014-02-07 17:24:13

dimigon
Member
Registered: 2009-03-07
Posts: 139
Website

Re: sinit - suckless init

x33a wrote:

@dimigon,

Here's another lightweight init (minirc), in case you haven't heard about it. But it does make use of busybox.

https://bbs.archlinux.org/viewtopic.php?id=162606&p=1

Interesting, will have a look at it.

Note, that's an init script not an implementation of init(8).

Offline

#9 2014-02-09 00:28:36

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: sinit - suckless init

@dimigon did you look at toybox[1]?
Just curious. Good luck on sinit!

[1]: http://www.landley.net/toybox/


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#10 2014-02-09 18:20:39

dimigon
Member
Registered: 2009-03-07
Posts: 139
Website

Re: sinit - suckless init

cactus wrote:

@dimigon did you look at toybox[1]?
Just curious. Good luck on sinit!

[1]: http://www.landley.net/toybox/

Yeah I've seen it.  Much nicer than busybox!

Offline

#11 2014-02-24 19:34:32

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: sinit - suckless init

@dimigon:
Hey.
I'd like to try this out with my Arch together with a customized version of the minirc scripts (not yet ready). smile

Therefor I created a PKGBUILD, but I encountered a little problem doing so. Please see: https://bbs.archlinux.org/viewtopic.php?id=177624

It apparently has to do with your Makefile not creating $DESTDIR/usr/bin . I don't know about Makefiles so I can't provide a patch currently. Maybe you could have a look at this occasionally.

As you can see in above link it works now using a little workaround, so I don't know. Maybe it's Arch specific cause we're using /usr/bin...

Thanks!

Ah, please tell if there's another place to report issues appropriately, couldn't find right now. (Edit: would probably simply be the dev list above or e-mail to you, sometimes I'm searching too far...;)

Last edited by rebootl (2014-02-25 20:21:45)


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

#12 2014-02-27 15:32:32

dimigon
Member
Registered: 2009-03-07
Posts: 139
Website

Re: sinit - suckless init

Thanks for reporting this.

Fixed upstream: http://git.2f30.org/sinit/commit/?id=a7 … dbf42fdb5d

Offline

#13 2014-02-27 17:12:32

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: sinit - suckless init

Great! I'll update the PKGBUILD.

I've progressed a bit with the adaption of the minirc scripts and have just booted the first time w/ sinit:

$ pstree
sinit─┬─acpid
      ├─bash───firefox───31*[{firefox}]
      ├─crond
      ├─2*[dbus-daemon]
      ├─dbus-launch
      ├─dhcpcd
      ├─i3bar───i3status
      ├─ntpd
      ├─respawn───login───bash───startx───xinit─┬─X───2*[{X}]
      │                                         └─i3
      ├─3*[respawn───agetty]
      ├─syslog-ng───syslog-ng
      ├─systemd-udevd
      ├─urxvtd───bash─┬─pstree
      │               └─wicd-client
      ├─wicd───wicd-monitor
      ├─wpa_supplicant
      └─xautolock

smile


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

#14 2014-02-27 17:21:20

dimigon
Member
Registered: 2009-03-07
Posts: 139
Website

Re: sinit - suckless init

Can you post your PKGBUILD + patches?

Offline

#15 2014-02-27 18:17:51

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: sinit - suckless init

Sure. I'll do.

The patch I have for sinit is really nothing, just calling (adapted) minirc from config.def.h.

You want minirc adaptions as well?
I'll put them on github but I'd like to test at least a shutdown wink I've put it together from minirc, brebs scripts (see also the busybox init topic) and your fs scripts...

Edit: The PKGBUILD for sinit I posted (https://bbs.archlinux.org/viewtopic.php?id=177624) should work now.

The patch is
call-minirc-sinit.patch

--- config.def.h.old	2014-02-23 16:59:05.233280130 +0100
+++ config.def.h	2014-02-23 17:10:28.345049818 +0100
@@ -1,5 +1,5 @@
 /* See LICENSE file for copyright and license details. */
 
-static char *const rcinitcmd[] = { "/bin/rc.init", NULL };
-static char *const rcrebootcmd[] = { "/bin/rc.shutdown", "reboot", NULL };
-static char *const rcpoweroffcmd[] = { "/bin/rc.shutdown", "poweroff", NULL };
+static char *const rcinitcmd[] = { "/usr/bin/rc-sinit", "init", NULL };
+static char *const rcrebootcmd[] = { "/usr/bin/rc-sinit", "reboot", NULL };
+static char *const rcpoweroffcmd[] = { "/usr/bin/rc-sinit", "poweroff", NULL };

As you can see I changed the minirc name from rc to rc-sinit to avoid a conflict... I'm not sure I want to provide patches for minirc but instead simply a forked/adapted branch...

Edit2:
You might want to put it on the AUR, evtl. w/o the patch and I'll provide a patched version that should probably better called something like sinit-minirc-git once a custom minirc is ready... (edit3: or you could do that then of course if you want.)

Regards and thanks for sinit so far.

Last edited by rebootl (2014-02-27 19:58:34)


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

#16 2014-03-02 19:26:14

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: sinit - suckless init

So, here we go.

sinit has run >24h w/o an issue, mem usage is at 1024kB VIRT in top (could evtl. be drastically reduced by compiling differently).

minirc for sinit
------------------

Had some pain to establish a convenient workflow but I think I got it now...
There's: https://github.com/rebootl/minirc-playground/tree/sinit
My playground and providing a "working" example, see the README there.

Then: https://github.com/rebootl/minirc/tree/adapted-sinit
A fork of minirc adapted to work w/ sinit.
I took care to modify the least possible. Basically commands from inittab are in rc (renamed to sminirc) now.
Also see the README there.

At least: https://github.com/rebootl/Arch-pkgs PKGBUILDs for both (minirc-sinit and sinit-minirc).
Please use this instead of the above stuff (post #15).

So, I guess I'll switch to sdinit now big_smile
(I won't, but I'd like to try it out...)

Edit: Ah, yes. minirc uses a minimal amount of things in rc, and I think this is good. Things like hwclock, random seed, tmpfs, swap etc. can go into the .local files.

Last edited by rebootl (2014-03-02 19:52:21)


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

#17 2014-03-02 20:55:48

axs
Member
Registered: 2009-01-23
Posts: 71
Website

Re: sinit - suckless init

rebootl wrote:

sinit has run >24h w/o an issue, mem usage is at 1024kB VIRT in top (could evtl. be drastically reduced by compiling differently).

If that's for sinit itself, you're doing something wrong. Possibly linking glibc. With shell parts, that's too little actually. Sh is  not the way to get a small init.

With dietlibc, I get 168kB, of which 136 is stack and 16kB (4 pages) is code.
You can view the numbers in /proc/(pid)/status
For reference, that's just one page less code that sdinit.
That's a lot for exec and a couple of signal handlers, if you care about code size.

You can get down to one page if you drop printf.
Replace ewprintf, the whole file, with diee and strerror from my telinit (not init, you don't need that stuff), it will work right away.
https://gist.github.com/arsv/9313535
And build with dietlibc of course.
dietlibc gcc -Os -o sinit sinit.c

And I renamed my project because of THIS?! Sorry guys not funny.

Last edited by axs (2014-03-02 20:56:51)

Offline

#18 2014-03-02 23:26:28

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: sinit - suckless init

If that's for sinit itself, you're doing something wrong. Possibly linking glibc.

That's what I meant by "(could evtl. be drastically reduced by compiling differently)".

That's a lot for exec and a couple of signal handlers, if you care about code size.

Yeah. I don't really care.

I just like the fact that I can run a fully fledged Arch w/ an init(8) that has, completely, about 150 SLOCs. tongue

Last edited by rebootl (2014-03-03 00:09:17)


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

#19 2014-03-08 16:29:20

dimigon
Member
Registered: 2009-03-07
Posts: 139
Website

Re: sinit - suckless init

axs wrote:

And I renamed my project because of THIS?! Sorry guys not funny.

Sorry `s' is reserved for suckless.

Offline

#20 2014-03-08 16:55:16

dimigon
Member
Registered: 2009-03-07
Posts: 139
Website

Re: sinit - suckless init

@rebootl

You may want to have a look at http://git.2f30.org/ubase/tree/ - this is complementary to sbase and in there you will find killall5 and halt.

Note halt, does a hard poweroff/reboot, usually called at the end of the shutdown script.

We also have a suckless getty there.

Offline

#21 2014-04-03 05:27:33

jpgg
Member
Registered: 2014-01-15
Posts: 43

Re: sinit - suckless init

This is very nice! It is now possible for me to truly understand the boot process. I was successfully able to make my system boot to a tty with sinit. My script is not quite polished yet, but it looks good so far (I am talking about sinit, not my script wink ).

Do you know if sinit is planned to be added on the suckless.org site as one of the "official" tools?

I also put a PKGBUILD on the AUR : https://aur.archlinux.org/packages/sinit-git/

I will keep testing it in the next days.

Last edited by jpgg (2014-04-03 05:27:58)

Offline

#22 2014-04-05 11:27:46

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

Re: sinit - suckless init

I just quickly built and booted with sinit, but of course it failed as I got an error execvp not found. Guess I do need to look at config.h :-;

Have tried and built an iso using minirc in the past but never got to a point where I considered it stable. Think main issues were network and dubs.

A basic config.h might help me


Mr Green

Offline

#23 2014-04-05 13:56:33

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: sinit - suckless init

Hey cool some people trying out there!

@Mr Green: I'm not sure for the execvp error...
Remember that this is only an implementation of init and not an entire init system. So you'll need something (rc, scripts etc.) to do the actual boot/reboot or shutdown processing.

These are defined in the config.def.h in the source.

In case you would want to try minirc as the processing scripts you could try out the version I posted above (Post #16). PKGBUILDs are also there, see the last link. I might be able to assist you w/ this version... Edit: You'll need both:
sinit-minirc-git-pkg + patch (provides sinit patched for minirc, the patch is an adaption to config.def.h, you might want to look at it)
minirc-sinit-git-pkg (provides minirc for sinit)

@dimigon: killall5, halt - Yes, currently I've left this open to the (potential) user. When this evolves it might be best to provide a package w/ these and evtl. some more as it was discussed on the Arch OpenRC thread (they had an issue but it got resolved, they're still using the sysvinit Arch(AUR) package).

Edit: corrected ref. to post #26 below

Last edited by rebootl (2014-04-05 18:34:37)


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

#24 2014-04-05 17:00:44

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

Re: sinit - suckless init

@rebootl that might be why it did not work, cannot remember if minirc clashes with systemd. Running both at least allows you to boot and make changes as required


Mr Green

Offline

#25 2014-04-05 17:26:08

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: sinit - suckless init

Eh? I didn't mention systemd. There's no conflict between them. In fact you'll need systemd if you want to use systemd-udevd. Running both at the same time is not possible but having both installed and then switch between them using the appropriate boot kernel parameter is no problem, as you mentioned it's even useful in case booting fails.


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

Board footer

Powered by FluxBB