Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How 2 activate Busybox in OpenRC? [ORPHAN]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
CaptainBlood
Veteran
Veteran


Joined: 24 Jan 2010
Posts: 1103

PostPosted: Fri Jul 25, 2014 5:29 pm    Post subject: How 2 activate Busybox in OpenRC? [ORPHAN] Reply with quote

Hi dear all,

OpenRC Gentoo Wiki (http://wiki.gentoo.org/wiki/OpenRC) is unclear about what should be removed in:
Quote:
cat /etc/inittab
#
# /etc/inittab: This file describes how the INIT process should set up
# the system in a certain run-level.
#
# Author: Miquel van Smoorenburg, <miquels@cistron.nl>
# Modified by: Patrick J. Volkerding, <volkerdi@ftp.cdrom.com>
# Modified by: Daniel Robbins, <drobbins@gentoo.org>
# Modified by: Martin Schlemmer, <azarah@gentoo.org>
# Modified by: Mike Frysinger, <vapier@gentoo.org>
# Modified by: Robin H. Johnson, <robbat2@gentoo.org>
#
# $Header: /var/cvsroot/gentoo-x86/sys-apps/sysvinit/files/inittab-2.87,v 1.2 2013/04/20 03:51:26 vapier Exp $

# Default runlevel.
id:3:initdefault:

# System initialization, mount local filesystems, etc.
si::sysinit:/sbin/rc sysinit

# Further system initialization, brings up the boot runlevel.
rc::bootwait:/sbin/rc boot

l0:0:wait:/sbin/rc shutdown
l0s:0:wait:/sbin/halt -dhp
l1:1:wait:/sbin/rc single
l2:2:wait:/sbin/rc nonetwork
l3:3:wait:/sbin/rc default
l4:4:wait:/sbin/rc default
l5:5:wait:/sbin/rc default
l6:6:wait:/sbin/rc reboot
l6r:6:wait:/sbin/reboot -dk
#z6:6:respawn:/sbin/sulogin

# new-style single-user
su0:S:wait:/sbin/rc single
su1:S:wait:/sbin/sulogin

# TERMINALS
c1:12345:respawn:/sbin/agetty 38400 tty1 linux
c2:2345:respawn:/sbin/agetty 38400 tty2 linux
c3:2345:respawn:/sbin/agetty 38400 tty3 linux
c4:2345:respawn:/sbin/agetty 38400 tty4 linux
c5:2345:respawn:/sbin/agetty 38400 tty5 linux
c6:2345:respawn:/sbin/agetty 38400 tty6 linux

# SERIAL CONSOLES
#s0:12345:respawn:/sbin/agetty -L 115200 ttyS0 vt100
#s1:12345:respawn:/sbin/agetty -L 115200 ttyS1 vt100

# What to do at the "Three Finger Salute".
#ca:12345:ctrlaltdel:/sbin/shutdown -r now

# Used by /etc/init.d/xdm to control DM startup.
# Read the comments in /etc/init.d/xdm for more
# info. Do NOT remove, as this will start nothing
# extra at boot if /etc/init.d/xdm is not added
# to the "default" runlevel.
x:a:once:/etc/X11/startDM.sh


So it seems like inserting
Quote:
::sysinit:/sbin/rc sysinit
::wait:/sbin/rc boot
::wait:/sbin/rc
should be OK, but I don't know:
- what 2 comment/delete.
- where 2 place each new line in respect of the section header comment ie (# Default runlevel. # System initialization, mount local filesystems, etc. # Further system initialization, brings up the boot runlevel.)

The more I read this post, the more I'm incline 2 comment each section command & replacing it with the matching new line, rank wise.
I fear 2 give a try in the wild coz I'm not ready 4 a repair session via live support

Any confirmation or idea?

Thaks 4 ur attention.


Last edited by CaptainBlood on Sat Jul 26, 2014 8:55 am; edited 2 times in total
Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1746

PostPosted: Fri Jul 25, 2014 7:15 pm    Post subject: Reply with quote

AFAIR to use busybox as init you simply have to link to it from /sbin/rc (or /sbin/runscript)

You can also try to launch it with invocation like '/bin/busybox rc' from your inittab.
Now, I'm not sure how well busybox understands runlevels, if at all. You will likely need a custom script you will run with busybox.

To make sure you won't get screwed, you might make git repo in your /etc, add ./ to it and commit before you start plaing around. This way, if you brick your PC you can run any liveCD and rollback. Well, at least if you commited changes before you broke it.
Back to top
View user's profile Send private message
CaptainBlood
Veteran
Veteran


Joined: 24 Jan 2010
Posts: 1103

PostPosted: Fri Jul 25, 2014 10:41 pm    Post subject: Reply with quote

Hi,

So first step would b 2 redirect a existing symlink 2 busybox.
Quote:
# ls -la /sbin/rc /sbin/runscript
-rwxr-xr-x 1 root root 129160 20 juil. 03:28 /sbin/rc
lrwxrwxrwx 1 root root 8 20 juil. 03:28 /sbin/runscript -> /sbin/rc
Quote:
# whereis busybox
busybox: /bin/busybox /usr/share/busybox
Quote:
# ls -la /bin/busybox /usr/share/busybox
-rwxr-xr-x 1 root root 1101576 8 juil. 12:51 /bin/busybox

/usr/share/busybox:
total 16
drwxr-xr-x 2 root root 4096 11 juin 2012 .
drwxr-xr-x 236 root root 12288 25 juil. 02:56 ..
so
Quote:
ln -s /bin/busybox /sbin/runscript
should do the trick.

Next /etc/inittab should b converted.
Think I need 2 g**gle a little 2 go any further.

Thks 4 ur attention, interest & support
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Fri Jul 25, 2014 11:19 pm    Post subject: Reply with quote

szatox wrote:
AFAIR to use busybox as init you simply have to link to it from /sbin/rc (or /sbin/runscript). You can also try to launch it with invocation like '/bin/busybox rc' from your inittab. Now, I'm not sure how well busybox understands runlevels, if at all. You will likely need a custom script you will run with busybox.

szatox ... no, init (whether sysvinit or busybox) calls rc (openrc) from inittab (and so runs 'rc sysinit', 'rc boot' and 'rc' ... which is the same as 'rc default'). If you symlink it to /bin/rc then init will run init, which of course doesn't make sense. Also, I'm fairly sure busybox doesn't have an 'rc' builtin, thats exclusively openrc.

The wiki page is correct, though it doesn't provide anything for shutdown, or getty. To have busybox as init then you should provide this as a kernel parameter ... "init=" (but you will still need for it to call {open}rc to do most of the initialisation).

@CaptainBlood ... I don't know why you want to go this route as unless this is an embedded device then you probably have enough ram to spare for the few Kbytes used by sysvinit. Note that busybox's init has no support for runlevels (hence the reason for the modifications to inittab) so you'll loose some functionality (though some runlevels are provided via openrc). I can't see any particular reason not to use sysvinit ... the whole package only takes up 385.59 KiB (here at least) ... that is unless this is embedded and ram, and disk space, is a scarce commodity.

best ... khay
Back to top
View user's profile Send private message
CaptainBlood
Veteran
Veteran


Joined: 24 Jan 2010
Posts: 1103

PostPosted: Sat Jul 26, 2014 1:59 am    Post subject: Reply with quote

Hi khayyam,

Actually I was looking 4 a way 2 speed up my boot sequence, nothing 2 do with embedded indeed.
My g**gling on the subject revealed it was beyond feasibility, at least quickly enough.
Too much of a learning curve with low visibility 2 any eventual gain.

Thks 4 your wise opinion & advice.

Time 2 close the subject I guess.

Thks 4 ur attention, interest & support.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Sat Jul 26, 2014 1:48 pm    Post subject: Reply with quote

CaptainBlood wrote:
Actually I was looking 4 a way 2 speed up my boot sequence, nothing 2 do with embedded indeed.

CaptainBlood ... I see, well, in this case you're more likely to decrease the speed (though any increase/decrease would probably be imperceptable) as busybox is larger than sysvinit's init.

Code:
# ls -lh /bin/busybox
-rwxr-xr-x 1 root root 1.8M 2013-09-14 14:38 /bin/busybox
# ls -lh /sbin/init
-rwxr-xr-x 1 root root 35K 2014-03-01 01:56 /sbin/init

That said the real time consumers in the boot process isn't loading init but the execution of the various init scripts in init.d. As these are run by /bin/sh then you might find changing the /bin/sh symlink to a leaner shell provides some increase.

Code:
# emerge --ask app-shells/dash app-admin/eselect-sh
# eselect sh list
# eselect sh set {N}

You can also remove any services that aren't needed, ie, netmount (if no network mounted filesystems are in use), local (if you're not running anything from /etc/local.d/) and possibly others.

best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum