Páginas

viernes, 14 de octubre de 2011

Migrando a OpenRC

SysV init
SysV init scripts (/etc/init.d), usados para el control de inicio y apagado del sistema. El sistema de inicio System V controla el arranque de los programas en el instante de inicio de la máquina.
OpenRC es un sistema de arranque (rc system) con gestión de dependencias que trabaja con cualquier init proporcionado por el sistema, normalmente /sbin/init.

Originalmente el sistema rc de Gentoo formaba parte de baselayout 1 y estaba escrito completamente en bash. Esto conlleva varias limitaciones. Por ejemplo, ciertas llamadas al sistema necesitan ser accedidas durante el arranque, requiriendo agregar llamadas en C. Estas llamadas eran enlazadas estáticamente, aumentando notablemente el tamaño del sistema rc a lo largo del tiempo.

Migrando una máquina con procesador Intel core 2 duo x86_64 T5750 2.00GHz. Intel Mobile GM965/GL960 Integrated Graphics Controller.

Instalar cryptsetup
# emerge -av cryptsetup
Calculating dependencies... done!
[ebuild   R    ] dev-libs/libgcrypt-1.4.6  USE="static-libs*" 0 kB
[ebuild   R    ] dev-libs/popt-1.16-r1  USE="nls static-libs*" 0 kB
[ebuild   R    ] dev-libs/libgpg-error-1.10  USE="nls static-libs* -common-lisp" 0 kB
[ebuild  N     ] sys-fs/cryptsetup-1.1.3-r3  USE="nls -dynamic (-selinux)" 488 kB

Agrego al archivo /etc/make.conf las use "nls static-libs"
# vim /etc/make.conf
USE="... nls static-libs .."

# dispatch-conf
# revdep-rebuild
# emerge -v udev

# dispatch-conf

No es necesario recompilar hal, actualmente no se utiliza.

# emerge -v sysvinit
# dispatch-conf

# emerge -v openrc

 * Please read the migration guide available at:
 * http://www.gentoo.org/doc/en/openrc-migration.xml
>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.

 * GNU info directory index is up-to-date.

 * IMPORTANT: 15 config files in '/etc' need updating.
 * See the CONFIGURATION FILES section of the emerge
 * man page to learn how to update config files.

Actualizo los 15 ficheros en /etc examinando uno por uno, son estos:

 /etc/conf.d/bootmisc          
 /etc/conf.d/consolefont       
 /etc/init.d/consolefont       
 /etc/conf.d/hostname          
 /etc/hosts                    
 /etc/conf.d/hwclock           
 /etc/conf.d/keymaps           
 /etc/init.d/keymaps           
 /etc/conf.d/modules           
 /etc/profile                  
 /etc/protocols                
 /etc/rc.conf                  
 /etc/sysctl.conf              
 /etc/conf.d/urandom
 /etc/timezone

Tiene que comprobar la migración desde /etc/modules.autoload.d/kernel-2.6 a /etc/conf.d/modules. El formato es diferente.

Llegado a este punto es "Muy Importante" comprobar los servicios que arrancarán en fase boot. Los principales están presentes: root, procfs, mtab, swap y fsck:

# ls -l /etc/runlevels/boot/
total 0
lrwxrwxrwx 1 root root 21 Oct 12 20:58 alsasound -> /etc/init.d/alsasound
lrwxrwxrwx 1 root root 20 Oct 12 20:58 bootmisc -> /etc/init.d/bootmisc
lrwxrwxrwx 1 root root 23 Oct 12 20:58 consolefont -> /etc/init.d/consolefont
lrwxrwxrwx 1 root root 25 Oct 12 20:58 device-mapper -> /etc/init.d/device-mapper
lrwxrwxrwx 1 root root 16 Oct 12 20:58 fsck -> /etc/init.d/fsck
lrwxrwxrwx 1 root root 20 Oct 12 20:58 hostname -> /etc/init.d/hostname
lrwxrwxrwx 1 root root 19 Oct 12 20:58 hwclock -> /etc/init.d/hwclock
lrwxrwxrwx 1 root root 19 Oct 12 20:58 keymaps -> /etc/init.d/keymaps
lrwxrwxrwx 1 root root 22 Oct 12 20:58 localmount -> /etc/init.d/localmount
lrwxrwxrwx 1 root root 19 Oct 12 20:58 modules -> /etc/init.d/modules
lrwxrwxrwx 1 root root 16 Oct 12 20:58 mtab -> /etc/init.d/mtab
lrwxrwxrwx 1 root root 18 Oct 12 20:58 net.lo -> /etc/init.d/net.lo
lrwxrwxrwx 1 root root 18 Oct 12 20:58 procfs -> /etc/init.d/procfs
lrwxrwxrwx 1 root root 16 Oct 12 20:58 root -> /etc/init.d/root
lrwxrwxrwx 1 root root 16 Oct 12 20:58 swap -> /etc/init.d/swap
lrwxrwxrwx 1 root root 18 Oct 12 20:58 sysctl -> /etc/init.d/sysctl
lrwxrwxrwx 1 root root 24 Oct 12 20:58 termencoding -> /etc/init.d/termencoding
lrwxrwxrwx 1 root root 19 Oct 12 20:58 urandom -> /etc/init.d/urandom

Aunque es automático durante la instalación de openrc compruebo que añade udev a sysinit correctamente:

# ls -l /etc/runlevels/sysinit
total 0
lrwxrwxrwx 1 root root 17 Oct 12 20:58 devfs -> /etc/init.d/devfs
lrwxrwxrwx 1 root root 17 Oct 12 20:58 dmesg -> /etc/init.d/dmesg
lrwxrwxrwx 1 root root 16 Oct 12 20:58 udev -> /etc/init.d/udev

Para registrar todo el arranque en /var/log/rc.log
# vim /etc/rc.conf
 rc_logger="YES"

Créditos y consultas
http://www.gentoo.org/doc/es/openrc-migration.xml
http://wiki.luispa.com

Linux es genial!.

No hay comentarios:

Publicar un comentario