You are not logged in.

#26 2014-04-05 17:38:52

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

Re: sinit - suckless init

rebootl wrote:

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 sysvinit Arch package).

No, we are now using the AUR sysvinit package.

Offline

#27 2014-04-06 07:15:01

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

Re: sinit - suckless init

@rebootl will set up a virtual machine and test.


Mr Green

Offline

#28 2014-04-06 07:54:30

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

Re: sinit - suckless init

Would this work with sinit under arch?

http://git.2f30.org/fs/

Of course change source files to suit


Mr Green

Offline

#29 2014-04-06 14:51:49

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

Re: sinit - suckless init

I don't really know what to answer here...

There's not a principal reason that this doesn't work. I mean "changing the source files to suit" you can probably get a lot of things working... But it's using a different toolbase, different udev, rc.init does a filesystem check of / (what we (Arch) are already doing in the initramfs) etc.

Basically you can create your own set of init scripts if you want, either based on something existing or from scratch. That's what I did but using minirc as a base. Adapting it to suit my needs using inspiration from above fs, OpenRC, and from brebs script (see https://bbs.archlinux.org/viewtopic.php … 3#p1378903).


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

Offline

#30 2014-04-06 16:16:02

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

Re: sinit - suckless init

Am thinking now of using old arch initscripts and adapting to work with fs scripts and configs. My first attempt fs booted but of course it did not reach login. As you have stated it has different tool kits. Will check out your other thread....


Mr Green

Offline

#31 2014-04-06 18:00:00

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

Re: sinit - suckless init

May I ask whether you tried "minirc for sinit" (the first I suggested in post #23), respectively why you choose not to use it ?


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

Offline

#32 2014-04-06 18:31:50

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

Re: sinit - suckless init

Had used minirc in the past but did not really have any luck. Before I go headlong into initscripts I will test your version first. Know that I had problems with dbus. Fingers crossed (-;


Mr Green

Offline

#33 2014-04-06 20:40:10

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

Re: sinit - suckless init

Ah, yes, I was just wondering.

As for dbus (and wicd) I had to add a custom start/stop to get it working fully here. You can see that on my "playground": https://github.com/rebootl/minirc-playg … inirc.conf. It's similar to what OpenRC does and probably initscripts is doing something similar too. One of the advantages of minirc is that such things can be done easily in /etc/minirc.conf .

Edit: One issue I have is that sometimes (but not often) remounting / readonly at shutdown fails. It's a bit hard to debug, therefor I've added the "optional debug shell" in the poweroff/reboot functions of sminirc. You may want to use (uncomment) these for testing.
Surely there's room for improvement there. Something like what brebs has started in his script, a shutdown-ramfs would be cool wink.
Also e.g. fsck for non-root partitions is lacking I think (I'm would have to recheck but I don't think the initramfs is doing this)... However, at least partially, this should go on the mentioned (busybox-)minirc thread (the one where the brebs script is).
Sorry if I confuse or discourage you, that's not the intention. Edit: Should have put that on the readme, will do so.

Last edited by rebootl (2014-04-06 21:28:12)


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

Offline

#34 2014-04-07 06:15:17

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

Re: sinit - suckless init

Are you using the poweroff shutdown from sinit? One of the reasons I was going to use initscripts was it is more in line with arch system. Noticed that minirc has not been updated for nearly a year. From what I have seen in fs and minirc you could reduce the number of config files, just have an rc.d or svr.d for services. Dbus was an issue before and is in initscripts. Udev would be too I imagine.


Mr Green

Offline

#35 2014-04-07 07:13:26

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

Re: sinit - suckless init

sinit allows to be signaled for shutdown and reboot. But you don't have to use those "features"; you can run whatever command you want when it is time to shutdown or reboot.

If you want to signal sinit, you can use the reboot and poweroff scripts provided here (they are one-line scripts signaling init).

Alternatively, you can avoid init in your shutdown or reboot process by adding these alias :

alias reboot='/etc/rc reboot'
alias shutdown='/etc/rc shutdown'

(adapted to you init script)

Last edited by jpgg (2014-04-07 07:15:21)

Offline

#36 2014-04-08 16:45:16

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

Re: sinit - suckless init

@MrGreen: For the very final poweroff or reboot I've used the busybox commands. It's correct that you'll need a command for this. That's what I've been discussing w/ dimigon above. It might be good to create a package for this containing poweroff/reboot in some form and possibly more. As mentioned, currently, I've left this open to the (potential) user. Using the ones from sysvinit is an option.

My impression is that currently only systemd is really "in line" w/ Arch wink.


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

Offline

#37 2014-04-08 18:04:27

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

Re: sinit - suckless init

Wondering if polkit has anything to do with shutdown reboot as user, assuming dbus and udev are working. Messing with Openrc at the moment.... Arch should be anything you want it to be....


Mr Green

Offline

#38 2014-04-09 22:11:35

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

Re: sinit - suckless init

" Arch should be anything you want it to be...." Sure it is. I wasn't really serious smile

As for shutdown I don't know anything about polkit, probably. For me I simply adapted sudo and use it in a script, but it's in a pretty ugly state atm...:

#!/bin/bash
#
# main system state control script
#

# sleep modes

pre_sleep() {
    $HOME/Scripts/Shell/powermode off
}

post_sleep() {
    echo "...yawn"
    sudo hdparm -B 254 /dev/sda
    $HOME/Scripts/Shell/powermode default
    date > debug-resume-date
}

case $1 in
    do)
        case $2 in
            nip|suspend)
                echo "sweet dreams..."
                pre_sleep
                echo mem | sudo tee /sys/power/state > /dev/null
                post_sleep
                ;;
            sleep|hibernate)
                echo "good night..."
                pre_sleep
                echo disk | sudo tee /sys/power/state > /dev/null
                post_sleep
                ;;
            reboot)
                echo "see you..."
                sudo kill -s INT 1
                ;;
            poweroff)
                echo "bye..."
                sudo kill -s USR1 1
                ;;
            *)
                echo "do what?"
                ;;
        esac
        ;;
    *)
        echo "hello"
esac

lol...

The idea from jpgg, to bypass init completely is interesting. Would be a further simplification...


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

Offline

#39 2014-04-10 05:49:14

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

Re: sinit - suckless init

You can add commands to sudo that allow a user to shutdown etc... (Arch wiki page on sudo). Random thought is your user a member of power group?


Mr Green

Offline

#40 2014-04-10 15:20:47

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

Re: sinit - suckless init

"You can add commands to sudo that allow a user to shutdown etc... (Arch wiki page on sudo)."

Yeah, I think that's what I did. Everything works. I just found the script is a bit ugly, just didn't found the muse to make it better yet...


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

Offline

#41 2014-04-11 05:08:35

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

Re: sinit - suckless init

I have written a simple service manager (called servman for service manager) that works well with sinit.

I wanted to keep things simple by having three indepedent tools for the three tasks that I need on my machine :

  • an init                        (provided by sinit-git that I maintain in the AUR)

  • an rc script                (as it is only one script, I included it in my servman-git package) (don't use it without reading it)

  • a service manager    (provided by servman-git in the AUR)

For a longer description of this simple setup, you can read my README on github.

To install these three tools, you can install the two AUR packages like any other AUR package. Note that, just like dwm (if you know it), you will have to modify the config.h file in the sinit-git package before running makepkg. For example, to use my rc script, you should have this line in config.h :

static char *const rcinitcmd[] = { "/etc/init.d/rc", "init", NULL };

That's it! Simply installing the packages (with the config above) works on my machine.

WARNING: If you use the rc script provided in servman-git without adapting it to your needs, you will destroy the data on you /dev/sda4 partition. This script is only adapted to my needs.

Note: I noticed after submitting on the AUR that there was another package called serman (not serman-git). If it bothers Xyne, I can rename serman-git. EDIT: serman has been renamed servman. Links here have been modified.

Last edited by jpgg (2014-04-12 02:58:31)

Offline

#42 2014-04-11 10:35:45

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

Re: sinit - suckless init

Hey. Looks good. I like it's simplicity.

Just a few little things I noticed, glancing over it:
(Note: Actually I noticed that they all consider the rc script and not serman, nevermind wink)
- The rc script is in /etc/init.d but since it's a script I've expected it in /usr/bin. You could take out the first line where you set up the daemons into a config file and include it via source. Yeah, I know it's a bit more complicated.
- What happens if you log in a getty and then log out ? Is the getty respawned ? You may want to have a look at "respawn" from .. Oops http://git.2f30.org/fs/ seems to be gone... (@dimigon ? ) I've used a copy and I hope it's okay to link it here https://github.com/rebootl/minirc-playg … in/respawn (again @dimigon ? )
- Ah yes and you've remounted / ro to fsck all the filesystems, but / is already checked in the initramfs. I assume you did it intentionally to be able to simply check all filesystems. I don't have a solution for this either, as mentioned currently no fscking is done in minirc-sinit...

Please take it as constructive suggestions no obtrusion meant.

Regards

Edit: Currently I'm thinking of a simple service dependency management. Would be nice. Maybe I'll work a bit on this...

Edit: @dimigon: I think we all appreciate your work here, what happened to the fs repo? Any chance to get it back up ? I found it quite useful.

Last edited by rebootl (2014-04-11 10:55:16)


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

Offline

#43 2014-04-11 17:48:29

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

Re: sinit - suckless init

rebootl wrote:

- The rc script is in /etc/init.d but since it's a script I've expected it in /usr/bin. You could take out the first line where you set up the daemons into a config file and include it via source. Yeah, I know it's a bit more complicated.

You might be right about /usr/bin. As for the config file to set up the daemons, the rc script is meant to be maintained itself. (I put all my config in it directly, as I already did with the timezone, swap partition, etc.) I would find it strange to maintain a file in /usr/bin. On the other hand, it would be easier to call rc reboot instead of /etc/init.d/rc reboot. Actually, both solutions look strange...

- What happens if you log in a getty and then log out ? Is the getty respawned ? You may want to have a look at "respawn" from .. Oops http://git.2f30.org/fs/ seems to be gone... (@dimigon ? ) I've used a copy and I hope it's okay to link it here https://github.com/rebootl/minirc-playg … in/respawn (again @dimigon ? )

I used to use the respawn script from the (now gone) fs repo. But I removed it for simplicity. If I accidently logout before rebooting, I still have 3 other ttys. If I want to get back tty1, I can log in on tty2 and call agetty directly.

- Ah yes and you've remounted / ro to fsck all the filesystems, but / is already checked in the initramfs. I assume you did it intentionally to be able to simply check all filesystems. I don't have a solution for this either, as mentioned currently no fscking is done in minirc-sinit...

Yes, mkinitcpio only checks /. I check all the filesystems in /etc/fstab as well.

Offline

#44 2014-04-12 01:21:00

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: sinit - suckless init

jpgg wrote:

Note: I noticed after submitting on the AUR that there was another package called serman (not serman-git). If it bothers Xyne, I can rename serman-git.

Arch policy requires unique package names to prevent confusion. This applies to VCS packages as well so foo, foo-git, foo-svn, foo-hg, etc. should all package variants of the same project. When two separate projects bear the same name some sort of qualifier must be added to distinguish them. "Serman" as an abbreviation of "service manager" is relatively self-evident so I don't feel that I can ask you to rename your project, but given that a package named "serman" already exists I will ask you to rename your package. Thanks.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#45 2014-04-12 02:55:30

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

Re: sinit - suckless init

I renamed it servman. I can see you are a Trusted User. You can now delete the package serman-git in the AUR.

Last edited by jpgg (2014-04-12 02:58:46)

Offline

#46 2014-04-12 13:30:07

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: sinit - suckless init

done, thanks


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#47 2014-04-16 09:41:48

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

Re: sinit - suckless init

Hi all,

Yes I removed http://git.2f30.org/fs/ because it was out of date (I put it back now with a warning at the top).

The fs repo now is simply a package in our ports which you can find here: http://git.2f30.org/ports/tree/fs.

This is the place where development is happening.

Offline

#48 2014-04-16 09:43:32

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

Re: sinit - suckless init

As regards the respawn script, it probably makes sense to be rewritten in C and include it in ubase along with the other tools.

Offline

#49 2014-04-16 17:37:15

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

Re: sinit - suckless init

Thanks dimigon. I missed (did not see) the ports repo.

As for respawn, maybe I could try to do this as a little learning experience, if it's not done already...

Currently I'm still working on a little dependency based init script. While the goal is to have something working it is really more a fun/play thing.

Last edited by rebootl (2014-04-16 18:12:10)


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

Offline

#50 2014-04-16 19:09:32

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

Re: sinit - suckless init

rebootl wrote:

Thanks dimigon. I missed (did not see) the ports repo.

As for respawn, maybe I could try to do this as a little learning experience, if it's not done already...

Currently I'm still working on a little dependency based init script. While the goal is to have something working it is really more a fun/play thing.

It is not done yet, should be trivial to do.

Is your work somewhere public atm?

Offline

Board footer

Powered by FluxBB