Wednesday, May 16, 2012

different runlevels in gentoo

Different default runlevels isn't something which is quite popular because usually one default runlevel is enough. Nonetheless sometimes it's quite useful.
Since i play around with xen it's very handy to have two different default runlevels. One where the xen services xenconsoled and xenstored get started and one without these services.
The reason is, when starting gentoo without xen these services would crash and thus would slow down the boot process.

To create a new runlevel called "xen" you have todo following:

# mkdir /etc/runlevels/xen
# cd /etc/runlevels/default
# for service in *; do rc-update add $service xen; done
# rc-update add xenstored xen
# rc-update add xenconsoled xen

This would copy all services from the default runlevel into xen and would add both xen init scripts too. Next you need to configure the bootloader and add the softlevel parameter to /boot/grub/grub.conf.

title Gentoo Linux XEN
root (hd0,0)
kernel /boot/xen.gz dom0_mem=8192M,max:8192M iommu=1 xsave=1 dom0_max_vcpus=4 dom0_vcpus_pin 
module /boot/gentoo-3.4.0-rc6 root=/dev/md3 softlevel=xen

Finish, that's all. Quite easy and really useful for xen. A more detailed howto about runlevels can be found at gentoo's offical documentation: Link

No comments:

Post a Comment