sinit - init system

Forum rules
General talk about software - if the program is not in the repos, please links to the developer's page or github.
pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

sinit - init system

Unread post by pidsley » Tue Jun 10, 2014 9:53 pm

Here's another one; "suckless init." Basically written to replace the busybox init function because the author says "the busybox code sucks" it uses the minirc script we used for busybox, but with some modifications. Discussion is here: https://bbs.archlinux.org/viewtopic.php?id=176854

I have this working, but just barely. I personally don't like it nearly as much as busybox, but it is an interesting experiment, and you will probably learn some new things if you try it.

I am not going to write a detailed how-to for this one, mostly because as I said I barely have it working myself, so I have no confidence in my ability to show you how to use it correctly. I will just give you an outline of how you might proceed if you want to try this. This assumes you first have busybox init working, so if you haven't tried that yet, go try it and come back later.

1. Copy your busybox init script (you will be modifying it for sinit)

Code: Select all

# cp /sbin/rc /sbin/sinitrc
2. Get the sinit code from suckless (http://git.suckless.org/sinit/) and unpack it where you can build it.
3. Copy config.def.h to config.h and modify the file. Make sure the first line of code says

Code: Select all

static char *const rcinitcmd[] = { "/sbin/sinitrc", "init", NULL };
4. make && sudo make install
5. Get the "respawn" bash script from here: https://github.com/rebootl/minirc-playg ... in/respawn
6. Put the script in /sbin, or somewhere else in root's PATH
7. Open the modified "sminirc" script from here: https://github.com/rebootl/minirc-playg ... in/sminirc
8. Look at how the respawn function is used. Copy and add at least the first two tty lines to your sinitrc script.
9. Look at how the "poweroff" and "reboot" services are scripted in sminirc. Add these to your sinitrc script if you like them.
10. Either create a new GRUB entry for sinit, and add "init=/usr/local/bin/sinit" to the end of the kernel line, or symlink /usr/local/bin/sinit to /sbin/init.
11. As the exherbo install instructions say "reboot, sacrifice a goat and pray."

I think these are all the steps you will need to get it working as well as I have. You may still have problems, and I may have missed a step or two. Good luck. Please post your results.

Image

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: sinit - init system

Unread post by machinebacon » Wed Jun 11, 2014 6:24 am

Had to laugh about the goat :)

Thanks for the instructions, though I am a bit hesitant to really do it on my main PC :D Maybe when the next monsoon comes (so, tomorrow?)

Have you found some advantages or disadvantages using sinit? Or anything that doesn't work as good as in/with busybox?
..gnutella..

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: sinit - init system

Unread post by pidsley » Wed Jun 11, 2014 6:39 am

No major advntages as far as I can tell. Seems to use about the same amount of memory as busybox init. I learned a little more about my system, so that is an advantage.

Disadvantages are that it requires adding additional complexity to the init script to spawn terminals and handle shutdown and reboot. Also, and I am sure this is something I'm doing wrong and just haven't figured out, I get "inappropriate ioctl for device, no job control in this shell" errors in the ttys when they start up. Running tmux or startx in the shells works fine, but sudo cannot be used until tmux or X are started.

I'll stick with busybox.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: sinit - init system

Unread post by machinebacon » Wed Jun 11, 2014 7:01 am

A quick google shows that ioctl errors are indeed related to ENOTTY and the wrong permissions (which does not necessarily mean you are doing wrong, it might be simply the concept that you have to care for this part first). Anyway interesting it doesn't use the inittab but spawns the TTYs inside of the rc file, and it also creates the "API filesystem" there. I noticed there is a little difference in the way they are mounted here on Debian, slight difference, and it probably doesn't make a difference.

Guess I won't follow the suckless path :)
..gnutella..

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5878
Joined: Tue Sep 03, 2013 7:05 am

Re: sinit - init system

Unread post by GekkoP » Wed Jun 11, 2014 2:58 pm

You made it! :)
I'll see if I can do something with this one.

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5878
Joined: Tue Sep 03, 2013 7:05 am

Re: sinit - init system

Unread post by GekkoP » Fri Jun 13, 2014 10:52 am

Everything's working here.

Image

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: sinit - init system

Unread post by pidsley » Fri Jun 13, 2014 2:40 pm

^ Nice work GP.

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5878
Joined: Tue Sep 03, 2013 7:05 am

Re: sinit - init system

Unread post by GekkoP » Fri Jun 13, 2014 2:44 pm

^ Thanks.
It works fine, but as you said, it forces you to add code whereas busybox doesn't. Funny thing: I got the same amount of RAM at boot with busybox, sinit and spark.

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: sinit - init system

Unread post by pidsley » Fri Jun 13, 2014 2:58 pm

^ Yes, I noticed that as well. I actually get a slightly lighter memory use with busybox. Of course, low memory isn't everything, but it is an interesting data point.

Post Reply