You are not logged in.

#76 2013-09-13 01:46:29

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

Re: Replace systemd with busybox + minirc

No, it is on boot. If I don't prefix it with sudo, it says connection can't own net.connman or whatever...

hut wrote:
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)

Offline

#77 2013-09-16 23:30:39

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

Re: Replace systemd with busybox + minirc

Finally had an oppurtunity to set this up this morning. Have started with udev to make it a bit easier at the start.
Once I added a couple of modprobe lines and a few echoes to /etc/minirc.local things booted up pretty much like normal. So far. Me still using netcfg helped a bit but I still need a bit more time to test.
One thing I've noticed is memory used is down alot after boot.

It's all been rather painless.
Cheers


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

Offline

#78 2013-09-17 20:57:47

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

Re: Replace systemd with busybox + minirc

Mounting nfs shares from fstab fails as mount -a is run before the rpcbind daemon is started, not sure what to do about that yet.

EDIT: sorted
made a custom_start for rpcbind which runs mount -a again.
Had to add an echo line to see that the rpcbind daemon was being started though.

Last edited by moetunes (2013-09-17 22:28:56)


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

Offline

#79 2013-11-10 20:35:12

Neuromatic
Member
From: Germany
Registered: 2013-05-31
Posts: 65

Re: Replace systemd with busybox + minirc

I've installed minirc and it runs perfectly. But I want to replace udev without using mdev. So I choosed eudev. It runs, but it cannot handle the network interfaces; how can I fix that?


/* No Comment */

Offline

#80 2013-11-11 21:59:40

Reznor
Member
From: BiH
Registered: 2012-06-23
Posts: 76

Re: Replace systemd with busybox + minirc

I have similar problem
I cant get wicd working
As output it throws me to check if dbus is running which is.
And I can't shutdown, or reboot.
I get message 'Failed to talk to init'.
At least it boots without problem.


rm -rf /
github

Offline

#81 2013-11-13 14:41:32

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

Re: Replace systemd with busybox + minirc

Make sure to use the busybox versions of the poweroff/reboot commands. The minirc package should install those to /sbin/poweroff and /sbin/reboot. In doubt, use "busybox poweroff" or "busybox reboot".

And you could fix the wicd problem by switching to wpa_supplicant.


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

Offline

#82 2013-11-27 19:18:38

z3bra
Member
From: France
Registered: 2012-03-19
Posts: 41
Website

Re: Replace systemd with busybox + minirc

You made my day big_smile

I'm using it along with eudev, and it works flawlessly on my notebook smile

Thanks for the script, it's awesome !


Hobbes: Shouldn't we read the instructions?
Calvin: Do I look like a sissy ?

Offline

#83 2013-11-28 14:48:32

Neuromatic
Member
From: Germany
Registered: 2013-05-31
Posts: 65

Re: Replace systemd with busybox + minirc

Network Problem is solved. Eudev do not manage interfaces dynamicly. In worst case, sombody
have to start the interfaces manuell


/* No Comment */

Offline

#84 2013-12-05 14:24:57

z3bra
Member
From: France
Registered: 2012-03-19
Posts: 41
Website

Re: Replace systemd with busybox + minirc

I've ran into a problem with minirc. I'm french, so I use that crappy AZERTY keyboard. And I've found that the "best" way to load my keymap on boot, is to modify the /sbin/rc script, to add loadkeys fr in the on_boot() function.

Is that possible to add a custom_boot() function to the minirc.conf ? So that, in the rc script we would find:

custom_boot()   { on_boot "$@"; }

source /etc/minirc.conf
...
case "$1" in
init)
  custom_boot();;
...

And in minirc.conf:

custom_boot() {
#
#  user defined commands to run on boot
#
    on_boot();
}

Thanks in advance

Last edited by z3bra (2013-12-05 14:29:50)


Hobbes: Shouldn't we read the instructions?
Calvin: Do I look like a sissy ?

Offline

#85 2013-12-05 16:12:21

2ManyDogs
Member
Registered: 2012-01-15
Posts: 1,657

Re: Replace systemd with busybox + minirc

There is nothing wrong with adding code to the on_boot function, if that works for you.

If you want a "better" way, you can just put your code in /etc/minirc.local, which is run at boot if it exists.

Minirc will run /etc/minirc.local on boot if the file exists and has the
executable bit set. This allows the user to run commands in addition to the
basic startup that minirc provides.

Or use a similar procedure to minirc.local.shutdown -- create a file called "/etc/minirc.local.onboot" and put your boot script in it, then run it from the rc on_boot function.

The way you are suggesting will probably work too, but there are easier ways, IMO.

Last edited by 2ManyDogs (2013-12-05 16:51:42)

Offline

#86 2013-12-09 12:33:23

z3bra
Member
From: France
Registered: 2012-03-19
Posts: 41
Website

Re: Replace systemd with busybox + minirc

Aaaah I missed the minirc.local point! Thanks for the reminder wink


Hobbes: Shouldn't we read the instructions?
Calvin: Do I look like a sissy ?

Offline

#87 2014-01-04 21:11:18

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

Re: Replace systemd with busybox + minirc

I've just noticed the settings in /etc/sysctl.conf weren't being applied so I added a line in minirc.local for that.

sysctl -p &> /dev/null

Without the redirection the tty gets a bit noisey...


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

Offline

#88 2014-01-04 21:48:31

progandy
Member
Registered: 2012-05-17
Posts: 2,146

Re: Replace systemd with busybox + minirc

moetunes wrote:

I've just noticed the settings in /etc/sysctl.conf weren't being applied so I added a line in minirc.local for that.

Without the redirection the tty gets a bit noisey...

What about

sysctl -q -p 

Offline

#89 2014-01-05 00:07:44

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

Re: Replace systemd with busybox + minirc

I should have checked the man page better...
Cheers


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

Offline

#90 2014-02-06 13:51:43

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

Re: Replace systemd with busybox + minirc

I use busybox for init, and it's great - here are my scripts:

/etc/init.d/rc (this is lengthy, all-in-one, hopefully interesting!)
/etc/inittab (calls rc at init & shutdown/reboot)
/etc/acpi/handler.sh (calls poweroff when power button is pressed)
/usr/share/udhcpc/default.script (if using busybox's udhcpc instead of e.g. dhcpcd)

This is with the following as symlinks to /bin/busybox: /sbin/{init,getty,killall5,halt,poweroff,rdev,reboot} /bin/ash

Optional symlink: /sbin/udhcpc (busybox's nicely lightweight dhcpcd replacement)

And in /root/.bashrc:

alias poweroff="setsid /etc/init.d/rc shutdown"
alias reboot="setsid /etc/init.d/rc reboot"

Edit: Shutdowns are clean, don't need to consider pivot_root anymore smile
Edit2: Added getty, to use from busybox, instead of mingetty.
Edit3: Added rdev, to help identify the root partition, for filesystem check.
Edit4: Added setsid to the 2 aliases above, to work when run over SSH.

Last edited by brebs (2014-05-25 13:58:09)

Offline

#91 2014-02-06 18:12:02

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

Re: Replace systemd with busybox + minirc

brebs wrote:

I use busybox for init, and it's great - here are my scripts:

/etc/init.d/rc (this is lengthy, all-in-one, hopefully interesting!)
/etc/inittab (calls rc at init & shutdown/reboot)
/etc/acpi/handler.sh (calls poweroff when power button is pressed)

This is with the following as symlinks to /bin/busybox: /sbin/{init,killall5,halt,poweroff,reboot} /bin/ash

Getting a clean unmount of / has been a problem, after e.g. recompiling glibc - I wonder if the mystical pivot_root, or mount --bind might be needed?

What I don't understand here is, how do you reboot? inittab calls "rc shutdown" and will do so even when you run reboot. So how exactly does the last section of the rc file (the case switches) come into play?

Oh, and my patch for killall5 to ignore kernel processes got accepted, so you can drop your workarounds for this.

Offline

#92 2014-02-06 18:39:49

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

Re: Replace systemd with busybox + minirc

Gusar wrote:

the case switches

That "case" section is necessary for any of the rc file to be run wink Because everything above it are just functions. Same as in a sysv initscript.

Edit: So for reboot, taking as an example the power button, what I think happens is:

I press power button, acpid runs /etc/acpi/handler.sh, which runs: exec poweroff
/sbin/poweroff (which is a symlink to busybox) signals /sbin/init, which (from /etc/inittab) runs: /etc/init.d/rc shutdown (this is the "run_actions(SHUTDOWN)" line in busybox's init/init.c)
Busybox then performs its own shutdown procedures (including quickly killing any remaining processes that weren't killed by my script), and final shutdown.

patch for killall5

I noticed - that's the patch to return 2 if there are no processes to signal.

The little "omit" bit in my rc file is mostly for safety, especially since I was toying with having it run by dash (running util-linux's killall5, I think), rather than busybox's ash, to see if there was any speed difference.

Edit2: You might be thinking of my "lsof" & "ps" commands, which are just for debugging info.

Last edited by brebs (2014-02-06 19:37:31)

Offline

#93 2014-02-06 19:56:59

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

Re: Replace systemd with busybox + minirc

brebs wrote:

I press power button, acpid runs /etc/acpi/handler.sh, which runs: exec poweroff
/sbin/poweroff (which is a symlink to busybox) signals /sbin/init, which (from /etc/inittab) runs: /etc/init.d/rc shutdown (this is the "run_actions(SHUTDOWN)" line in busybox's init/init.c)
Busybox then performs its own shutdown procedures (including quickly killing any remaining processes that weren't killed by my script), and final shutdown.

I asked about rebooting, not poweroff. How does the reboot part of that case switch get called, when inittab only ever invokes either "rc init" or "rc shutdown"?

brebs wrote:

Edit2: You might be thinking of my "lsof" & "ps" commands, which are just for debugging info.

Yeah, that part. I took a closer look and see the comments now, it's indeed just to see which were the problematic processes.

Offline

#94 2014-02-06 21:12:08

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

Re: Replace systemd with busybox + minirc

Gusar wrote:

How does the reboot part of that case switch get called.

Ah, it doesn't, in the current setup. That's a remnant from when I was playing with calling /etc/init.d/rc from BASH. I'll tidy it up.

I'm used to using the command "shutdown", rather than "poweroff". In fact, I put in /root/.bashrc:

alias shutdown="poweroff"

Last edited by brebs (2014-02-06 21:15:55)

Offline

#95 2014-02-06 22:10:42

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

Re: Replace systemd with busybox + minirc

brebs wrote:

Ah, it doesn't, in the current setup.

Thought so. So how do you reboot in your current setup?

The thing is, I want to find a way for a shutdown script to know whether reboot or poweroff was called. Currently I hack busybox to export a RUNLEVEL variable (0 or 6), like sysvinit does. But I don't know if it's the right solution or if there's another way.

Offline

#96 2014-02-06 22:39:54

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

Re: Replace systemd with busybox + minirc

Gusar wrote:

So how do you reboot

/sbin/reboot (a symlink to /bin/busybox) works fine. /etc/init.d/rc shutdown gets called first, just as with /sbin/poweroff smile

know whether reboot or poweroff was called

Why?

I suppose you could have /root/bin/reboot, which should take priority in your $PATH, to do things before an exec /sbin/reboot

I assume /root/bin/reboot could even be a /bin/ash script which exports a variable, which /etc/init.d/rc can read.

Or e.g. write to a file in /tmp/, that was set at startup with root-only permissions.

Offline

#97 2014-02-06 23:01:35

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

Re: Replace systemd with busybox + minirc

brebs wrote:

Why?

For a trick from the old initscripts:

if [[ $RUNLEVEL = 0 ]]; then
	printhl "${C_H2}POWER OFF"
	poweroff -f
else
	printhl "${C_H2}REBOOTING"
	reboot -f
fi

We've already killed everything earlier in the script, so in the end we run -f to skip init's internal killing mechanism. You know, cos boot/shutdown times are the most important thing in the world tongue.

Offline

#98 2014-02-06 23:22:29

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

Re: Replace systemd with busybox + minirc

I see. That was basically the original idea that I had, with aliases, e.g.:

alias poweroff="/etc/init.d/rc shutdown"

And then have the shutdown function in /etc/init.d/rc that runs:

go_down
poweroff -f

Same for reboot.

In fact, now I'm more confident about what busybox is doing, I might just do that wink Edit: done smile

Last edited by brebs (2014-02-06 23:30:47)

Offline

#99 2014-02-13 05:39:04

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

Re: Replace systemd with busybox + minirc

The latest update to libpulse requires libsystemd-journal.so.0 so things like mpv won't work if systemd has been removed. I added libpulse to the ignore line in pacman.conf which should work for a little while...


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

Offline

#100 2014-02-15 17:12:22

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

Re: Replace systemd with busybox + minirc

big_smile Really love this!

Works out of the box. Not everything of course, but got X running w/o a problem.
(Though using systemd udev, really don't care.)

As for wicd/dbus it seems that one has to create a /run/dbus directory before starting dbus to get the system_bus_socket.
(No idea why, found this hint here: http://daemonforums.org/showthread.php?t=5502#post43223.)

Got wicd running, so I think I'll use

mkdir /run/dbus
/usr/bin/dbus-daemon --system

as custom dbus startup.

Ah yes also the default_poll for dbus doesn't work I think... but I'm not sure for the regex hmm ...

pgrep "^$1\$" >& /dev/null;;

Shouldn't even be too hard to use this with sinit (https://bbs.archlinux.org/viewtopic.php?id=176854) and get rid of inittab...

Edit: I checked the openrc script for dbus and they do it aswell, a bit more elaborate:

start() {
    ebegin "Starting D-BUS system messagebus"
    /usr/bin/dbus-uuidgen --ensure=/etc/machine-id

    # We need to test if /run/dbus exists, since script will fail if it does not
    [ ! -e /run/dbus ] && mkdir /run/dbus

    start-stop-daemon --start --pidfile /run/dbus/pid --exec /usr/bin/dbus-daemon -- --system
    eend $?

Last edited by rebootl (2014-02-15 18:45:56)


Personal website: cem.revamp-it.ch
GitHub: github.com/rebootl

Offline

Board footer

Powered by FluxBB