Pages

Sunday, September 19, 2010

Boot time tuning chapter second: OpenRC

Yesterday we saw how to install bootchart and understand what's in its report image. Today we are going to make a small step for a user but a big step for your box: install OpenRC.

Your box works with baselayout1:

"Originally Gentoo's rc system was built into baselayout 1 and written entirely in bash. This led to several limitations. For example, certain system calls need to be accessed during boot and this required C-based callouts to be added. These callouts were each statically linked, causing the rc system to bloat over time. [...] This led to a development of baselayout 2, which is written in C and only requires a POSIX-compliant shell. During the development of baselayout 2, it was determined that it was a better fit if baselayout merely provided the base files and filesystem layout for Gentoo and the rc system was broken off into its own package. Thus we have OpenRC.

OpenRC is primarily developed by Roy Marples and supports all current Gentoo variations (i.e. Gentoo Linux, Gentoo/FreeBSD, Gentoo Embedded, and Gentoo Vserver) and other platforms such as FreeBSD and NetBSD." Taken from Gentoo Handbook

So what we are going to do is upgrade to a more efficient, resource saving and newer way to boot. Please be sure to follow the guide step by step: if you make your own way you might get a useless system, unable to boot.

Let's get into the business. First we need to add the unstable keyword for the new packages: open the conf file with
nano /etc/portage/package.keywords
and append two lines. I use ~amd64 'cause I have a x86_64 kernel, use ~x86 if you have 32bit OS, or the properly key for your arch.
sys-apps/baselayout ~amd64
sys-apps/openrc ~amd64
Ready to go, let's
emerge -av openrc
wow, straight forward... actually not.
Make sure you have your conf file updated. It is critical to run dispacth-conf or cfg-update -u. Once you're done you need to take a look at rc.conf: we are moving from /etc/conf.d/rc to /etc/rc.conf so migrate your settings:
nano /etc/rc.conf
I suggest to set (as we are working there) rc_parallel="YES", so we will get a faster boot.
Now let's check for kernel modules. They were in /etc/modules.autoload.d/kernel-2.6, now moved to /etc/conf.d/modules (without any reference to kernel version). An example of how you should edit your file:
# Always load ochi1394 and ieee1394, no matter the kernel version
modules="ohci1394 ieee1394"
# Only load tun and usbserial for 2.6.x series kernels
modules_2_6="tun usbserial"
# Only load cx88_dvb for 2.6.23 kernels
modules_2_6_23="cx88_dvb"
# Only load ivtv for 2.6.23-gentoo-r5
modules_2_6_23_gentoo_r5="ivtv"

# For 2.6.23-gentoo-r5, pass video_br=2 to cx88_dvb
module_cx88_dvb_args_2_6_23_gentoo_r5="video_br=2"
# For 2.6.x series kernels, always pass vendor and product
module_usbserial_args_2_6="vendor=0x1410 product=0x2110"
# Always pass debug to ieee1394
module_ieee1394_args="debug"
Most users are done. If you have strange custom configurations please be sure to update what you need double check on gentoo handbook.


Once it's over you can reboot and taste the new experience. It should be faster and more efficient!


If you messed up with something I suggest to launch live a DVD session and to chroot if needed.

1 comment: