home / linux / linit (navigation links)

Ni olvido ni perdón - Margarita Nelken.

Linux booting process


  Red Hat


  init and /etc/inittab

As the init man page states, init is the father of all processes. Its primary role is to create processes by parsing /etc/inittab and running scripts in /etc/rc.d according to either a default or desired runlevel. Each script can start or stop a service, such as a networking, mail, news, or Web service. In general, the scripts under /etc/rc.d/init.d are designed to respond to commands of the following form :

     script { start | stop | status | restart }
as apache (http server), or inetd (internet super server), but providing its name without parameters shall display the allowed options, as
 [sebas@mitp init.d] inetd
 Usage: inetd {start|stop|status|restart|reload}
Caution : some commands require a special SIG to perform certain actions, as inetd. killall -1 inetd sends a SIGHUP signal to inetd to re-read its configuration file.


  /etc/inittab and System States

One of the most important scripts in /etc/inittab is rc.sysinit, the system initialization script.
Here you can find the "Welcome to Red Hat Linux" message. It also does :

  • sets some initial $PATH variables
  • configures networking
  • starts swapping for virtual memory
  • sets the system hostname
  • checks root filesystems for possible repairs
  • checks root filesystems quotas
  • turns on user and group quotas for root filesystems
  • remounts the root filesystems read/write
  • clears the mounted filesystems table /etc/mtab
  • enters the root filesystem into mtab
  • readies the system for loading modules
  • finds module dependencies
  • checks filesystems for possible repairs
  • mounts all other filesystems
  • clears out several /etc files : /etc/mtab, /etc/fastboot, and /etc/nologin
  • deletes UUCP lock files
  • deletes stale subsystem files
  • deletes stale pid files
  • sets the system clock
  • turns on swapping
  • initializes the serial ports
  • loads modules
  • After the rc.sysinit is run by init, init runs rc.local.

    The next init task is to run the scripts for each runlevel. The real scripts are placed under /etc/rc.d/init.d directory, and symbolic links are set in /etc/rc.d/rcN.d directory, where "N" is the runlevel. The symbolic links are numbered to run in the proper order and to start or stop services that might be interdependent.


      Run levels

    See /etc/inittab and man runlevel, man init, man inittab.
    id:3:initdefault: selecciona que l'arrencada quedi a nivell 3.

     

    0 used to halt the system  
    1 single user mode  
    2 multiuser, without NFS  
    3 full multiuser mode  
    4 unused  
    5 X11  
    6 used to reboot the system  


      RedHat runlevel 0 : /etc/rc.d/rc0.d


      SuSE boot specifics

    Under 6.4, booting starts under control of /etc/inittab, but immediatelly gives control to /sbin/init.d/boot, that will also call the user selection detailed in /sbin/init.d/boot.local, and the rest of /sbin/init.d/rc N, being N in the range (0 thru 6).
    After SuSE 8.1, the system startup scripts that used to be in /etc/rc.d have their equivalent files in /etc/init.d - see /etc/init.d/README and /sbin/init.d.README - according to the LSB, Linux Standard Base specs. See the SuSE Linux manual, in /docu on the first CDROM, or in package books.rpm

    [8.2] /sbin/init uses configuration in /etc/inittab.

     # The default runlevel is defined here
     id:5:initdefault:
    
     # First script to be executed, if not booting in emergency (-b) mode
     si::bootwait:/etc/init.d/boot
    
     # /etc/init.d/rc takes care of runlevel handling
     l0:0:wait:/etc/init.d/rc 0
     l1:1:wait:/etc/init.d/rc 1
     l2:2:wait:/etc/init.d/rc 2
     l3:3:wait:/etc/init.d/rc 3
     #l4:4:wait:/etc/init.d/rc 4
     l5:5:wait:/etc/init.d/rc 5
     l6:6:wait:/etc/init.d/rc 6
    
     # what to do in single-user mode
     ls:S:wait:/etc/init.d/rc S
     ~~:S:respawn:/sbin/sulogin
    
    
    1. /sbin/init calls /etc/initd/boot, that calls all scripts in /etc/initd/boot.d and /etc/initd/boot.local
    2. switches to run level specified in /etc/inittab
    3. calls /etc/init.d/rc scripts in /etc/init.d/rc<N>.d
    { from /sbin/init.d.README }
    linux8.2:/etc/init.d/boot.d # dir
    
     S01boot.proc                 -> ../boot.proc
     S01setserial                 -> ../setserial
     S02boot.md                   -> ../boot.md
     S03boot.lvm                  -> ../boot.lvm
     S04boot.localfs              -> ../boot.localfs
     S05boot.crypto               -> ../boot.crypto
     S05boot.loadmodules          -> ../boot.loadmodules
     S05boot.scpm                 -> ../boot.scpm
     S06boot.idedma               -> ../boot.idedma
     S06boot.restore_permissions  -> ../boot.restore_permissions
     S06boot.swap                 -> ../boot.swap
     S07boot.clock                -> ../boot.clock
     S08boot.quota                -> ../boot.quota
     S09boot.ldconfig             -> ../boot.ldconfig
     S10boot.isapnp               -> ../boot.isapnp
     S10boot.localnet             -> ../boot.localnet
     S11boot.ipconfig             -> ../boot.ipconfig
     S11boot.klog                 -> ../boot.klog
    
    

    To start a new service, start with /etc/init.d/skeleton and use insserv !

      SuSE run levels

    Matches LSB.
    0 halt  
    1 single user  
    2 no remote networking  
    3 with network  
    4 unused  
    5 network + xdm  
    6 reboot  


      SuSE runlevel 0 : /etc/init.d/rc0.d

     S20halt -> ../halt
    
    

      SuSE runlevel S : /etc/init.d/rcS.d

     K01single -> ../single
     K09splash -> ../splash
     S12kbd    -> ../kbd
     S12splash -> ../splash
     S20single -> ../single
    
    

      SuSE runlevel 1 : /etc/init.d/rc1.d

     K01single  -> ../single
     K09splash  -> ../splash
     K10fbset   -> ../fbset
     K14hotplug -> ../hotplug
     S07hotplug -> ../hotplug
     S11fbset   -> ../fbset
     S12kbd     -> ../kbd
     S12splash  -> ../splash
     S20single  -> ../single
    
    

      SuSE runlevel 2 : /etc/init.d/rc2.d

     K08hwscan          -> ../hwscan
     K09splash          -> ../splash
     K09splash_late     -> ../splash_late
     K10cron            -> ../cron
     K10fbset           -> ../fbset
     K11smpppd          -> ../smpppd
     K12splash_early    -> ../splash_early
     K13resmgr          -> ../resmgr
     K14hotplug         -> ../hotplug
     K15syslog          -> ../syslog
     K16network         -> ../network
     K20alsasound       -> ../alsasound
     K20atd             -> ../atd
     K20isdn            -> ../isdn
     K20random          -> ../random
     K20rpmconfigcheck  -> ../rpmconfigcheck
     S01alsasound       -> ../alsasound
     S01atd             -> ../atd
     S01isdn            -> ../isdn
     S01random          -> ../random
     S01rpmconfigcheck  -> ../rpmconfigcheck
     S05network         -> ../network
     S06syslog          -> ../syslog
     S07hotplug         -> ../hotplug
     S08resmgr          -> ../resmgr
     S09splash_early    -> ../splash_early
     S10smpppd          -> ../smpppd
     S11cron            -> ../cron
     S11fbset           -> ../fbset
     S12kbd             -> ../kbd
     S12splash          -> ../splash
     S12splash_late     -> ../splash_late
     S13hwscan          -> ../hwscan
    
    

      SuSE runlevel 3 : /etc/init.d/rc3.d

     K08hwscan          -> ../hwscan
     K09splash          -> ../splash
     K09splash_late     -> ../splash_late
     K10cron            -> ../cron
     K10fbset           -> ../fbset
     K11nscd            -> ../nscd
     K11postfix         -> ../postfix
     K11smpppd          -> ../smpppd
     K12portmap         -> ../portmap
     K12smbfs           -> ../smbfs
     K12splash_early    -> ../splash_early
     K12sshd            -> ../sshd
     K13resmgr          -> ../resmgr
     K14hotplug         -> ../hotplug
     K15syslog          -> ../syslog
     K16network         -> ../network
     K20alsasound       -> ../alsasound
     K20atd             -> ../atd
     K20isdn            -> ../isdn
     K20random          -> ../random
     K20rpmconfigcheck  -> ../rpmconfigcheck
     S01alsasound       -> ../alsasound
     S01atd             -> ../atd
     S01isdn            -> ../isdn
     S01random          -> ../random
     S01rpmconfigcheck  -> ../rpmconfigcheck
     S05network         -> ../network
     S06syslog          -> ../syslog
     S07hotplug         -> ../hotplug
     S08resmgr          -> ../resmgr
     S09portmap         -> ../portmap
     S09smbfs           -> ../smbfs
     S09splash_early    -> ../splash_early
     S09sshd            -> ../sshd
     S10nscd            -> ../nscd
     S10postfix         -> ../postfix
     S10smpppd          -> ../smpppd
     S11cron            -> ../cron
     S11fbset           -> ../fbset
     S12kbd             -> ../kbd
     S12splash          -> ../splash
     S12splash_late     -> ../splash_late
     S13hwscan          -> ../hwscan
    
    

      SuSE runlevel 4 : /etc/init.d/rc4.d

         < empty >
    

      SuSE runlevel 5 : /etc/init.d/rc5.d

     K07xdm             -> ../xdm
     K08hwscan          -> ../hwscan
     K09splash          -> ../splash
     K09splash_late     -> ../splash_late
     K10cron            -> ../cron
     K10fbset           -> ../fbset
     K11nscd            -> ../nscd
     K11postfix         -> ../postfix
     K11smpppd          -> ../smpppd
     K12portmap         -> ../portmap
     K12smbfs           -> ../smbfs
     K12splash_early    -> ../splash_early
     K12sshd            -> ../sshd
     K13resmgr          -> ../resmgr
     K14hotplug         -> ../hotplug
     K15syslog          -> ../syslog
     K16network         -> ../network
     K20alsasound       -> ../alsasound
     K20atd             -> ../atd
     K20isdn            -> ../isdn
     K20random          -> ../random
     K20rpmconfigcheck  -> ../rpmconfigcheck
     S01alsasound       -> ../alsasound
     S01atd             -> ../atd
     S01isdn            -> ../isdn
     S01random          -> ../random
     S01rpmconfigcheck  -> ../rpmconfigcheck
     S05network         -> ../network
     S06syslog          -> ../syslog
     S07hotplug         -> ../hotplug
     S08resmgr          -> ../resmgr
     S09portmap         -> ../portmap
     S09smbfs           -> ../smbfs
     S09splash_early    -> ../splash_early
     S09sshd            -> ../sshd
     S10nscd            -> ../nscd
     S10postfix         -> ../postfix
     S10smpppd          -> ../smpppd
     S11cron            -> ../cron
     S11fbset           -> ../fbset
     S12kbd             -> ../kbd
     S12splash          -> ../splash
     S12splash_late     -> ../splash_late
     S13hwscan          -> ../hwscan
     S14xdm             -> ../xdm
     S90apache2         -> ../apache2
    
    

      SuSE runlevel 6 : /etc/init.d/rc6.d

     S20reboot -> ../reboot
    
    

      Debian way

    First of all, we find /etc/rcN.d, with N in [0..6, S]. Also, there is inittab !

     # /etc/inittab: init(8) configuration.
     # $Id: inittab,v 1.8 1998/05/10 10:37:50 miquels Exp $
    
     # The default runlevel.
     id:2:initdefault:
    
     # Boot-time system configuration/initialization script.
     # This is run first except when booting in emergency (-b) mode.
     si::sysinit:/etc/init.d/rcS
    
    
    See own Debian page

      Run levels

    0 halt  
    1 single user  
    2-5 multiuser  
    6 reboot  


      Debian runlevel 0 : /etc/rc0.d

     K11cron         -> ../init.d/cron
     K12kerneld      -> ../init.d/kerneld
     K14ppp          -> ../init.d/ppp
     K20inetd        -> ../init.d/inetd
     K20logoutd      -> ../init.d/logoutd
     K20makedev      -> ../init.d/makedev
     K20samba        -> ../init.d/samba
     K20ssh          -> ../init.d/ssh
     K25hwclock.sh   -> ../init.d/hwclock.sh
     K30setserial    -> ../init.d/setserial
     K89atd          -> ../init.d/atd
     K90sysklogd     -> ../init.d/sysklogd
     S10portmap      -> ../init.d/portmap
     S20sendsigs     -> ../init.d/sendsigs
     S30urandom      -> ../init.d/urandom
     S31umountnfs.sh -> ../init.d/umountnfs.sh
     S35networking   -> ../init.d/networking
     S40umountfs     -> ../init.d/umountfs
     S90halt         -> ../init.d/halt
    
    

      Debian runlevel S : /etc/rcS.d

     S05keymaps-lct.sh    -> ../init.d/keymaps-lct.sh
     S10checkroot.sh      -> ../init.d/checkroot.sh
     S15isapnp            -> ../init.d/isapnp
     S20modutils          -> ../init.d/modutils
     S30checkfs.sh        -> ../init.d/checkfs.sh
     S30procps.sh         -> ../init.d/procps.sh
     S30setserial         -> ../init.d/setserial
     S35devpts.sh         -> ../init.d/devpts.sh
     S35mountall.sh       -> ../init.d/mountall.sh
     S39dns-clean         -> ../init.d/dns-clean
     S40hostname.sh       -> ../init.d/hostname.sh
     S40networking        -> ../init.d/networking
     S40pump              -> ../init.d/pump
     S41portmap           -> ../init.d/portmap
     S45mountnfs.sh       -> ../init.d/mountnfs.sh
     S48console-screen.sh -> ../init.d/console-screen.sh
     S50hwclock.sh        -> ../init.d/hwclock.sh
     S55bootmisc.sh       -> ../init.d/bootmisc.sh
     S55urandom           -> ../init.d/urandom
     S70nviboot           -> ../init.d/nviboot
    
    

      Debian runlevel 1 : /etc/rc1.d

     K11cron     -> ../init.d/cron
     K12kerneld  -> ../init.d/kerneld
     K14ppp      -> ../init.d/ppp
     K20inetd    -> ../init.d/inetd
     K20logoutd  -> ../init.d/logoutd
     K20makedev  -> ../init.d/makedev
     K20samba    -> ../init.d/samba
     K20ssh      -> ../init.d/ssh
     K89atd      -> ../init.d/atd
     K90sysklogd -> ../init.d/sysklogd
     S20single   -> ../init.d/single
    
    

      Debian runlevel 2 : /etc/rc2.d

     S10sysklogd  -> ../init.d/sysklogd
     S12kerneld   -> ../init.d/kerneld
     S14ppp       -> ../init.d/ppp
     S20inetd     -> ../init.d/inetd
     S20logoutd   -> ../init.d/logoutd
     S20makedev   -> ../init.d/makedev
     S20samba     -> ../init.d/samba
     S20ssh       -> ../init.d/ssh
     S89atd       -> ../init.d/atd
     S89cron      -> ../init.d/cron
     S99rmnologin -> ../init.d/rmnologin
    
    

    3 i 4 i 5 : IGUALS !


      Debian runlevel 6 : /etc/rc6.d

     K11cron         -> ../init.d/cron
     K12kerneld      -> ../init.d/kerneld
     K14ppp          -> ../init.d/ppp
     K20inetd        -> ../init.d/inetd
     K20logoutd      -> ../init.d/logoutd
     K20makedev      -> ../init.d/makedev
     K20samba        -> ../init.d/samba
     K20ssh          -> ../init.d/ssh
     K25hwclock.sh   -> ../init.d/hwclock.sh
     K30setserial    -> ../init.d/setserial
     K89atd          -> ../init.d/atd
     K90sysklogd     -> ../init.d/sysklogd
     S10portmap      -> ../init.d/portmap
     S20sendsigs     -> ../init.d/sendsigs
     S30urandom      -> ../init.d/urandom
     S31umountnfs.sh -> ../init.d/umountnfs.sh
     S35networking   -> ../init.d/networking
     S40umountfs     -> ../init.d/umountfs
     S90reboot       -> ../init.d/reboot
    
    

    Window manager startup

      Suse 8.2

    /etc/init.d/rc5.d/S16xdm -> /etc/init.d/xdm

    /etc/init.d/xdm has "SAGSAG+++" message, found in /var/log/boot.msg if /etc/inittab contains id:5:initdefault:

      Debian / Linex

    /etc/rc2.d/S99gdm -> /etc/init.d/gdm

    Networking startup


      Red Hat

    In /etc/rc.d/rc2.d we can find S10network, a symbolic link to /etc/rc.d/init.d/network, that will activate the network, using ifup.

      Files involved

      SuSE

      Files involved

      Debian - Linex

    A /etc/init.d/networking tinc "+++ SAGSAG +++", que no surt enlloc de /var/log.
    Raó : no s'engega la xarxa : ifconfig -a
    Només es a L0 i L6 ( i surt en pantalla el missatge, al engegar o parar la màquina ).

    Si donc ifconfig eth0 1.2.3.4 netmask 255.255.255.0 broadcast 1.2.3.255, diu no existe tal dispositivo.
    On es el YAST2 ???

    /etc/init.d/networking uses /etc/network/interfaces Abans hi tenia

      auto lo
      iface lo inet loopback
     

    lspci -v output is

     02.0c.0 Ethernet controller: MYSON Technology Inc. Unknown device 0803.
     

    Trobo que tinc [Linex + P4]

     /lib/modules/2.4.20/kernel/drivers/net/fealnx.o
     

    Acció :

    Fix :

    Debian net cfg Albert P4
    /etc/modules.conf     alias eth0 fealnx
    /etc/modules   pcnet32   fealnx (got [1])
    /etc/network/interfaces   iface eth0 inet dhcp   iface eth0 inet static (got [2])

    Modules are loadable device drivers.

    Who uses /etc/modules ?
    Andreas at Google groups says : Modules from /etc/modules are loaded by /etc/init.d/modutils script using the modprobe command. During boot, it is executed through the symlink /etc/rcS.d/S20modutils
    Other tools to use : modconf [Debian], ethtool, mii-diag [.], mii-tool

    Franzis [9.137.152.233] /var/log/kern.log [last lines]

     franzis kernel: pcnet32.c: PCI bios is present, checking for devices...
     franzis kernel: PCI Master Bit has not been set. Setting...
     franzis kernel: Found PCnet/PCI at 0x1080, irq 11.
     franzis kernel: eth0: PCnet/PCI II 79C970A at 0x1080, 00 50 56 66 32 d9 assigned IRQ 11.
     franzis kernel: pcnet32.c:v1.25kf 26.9.1999 tsbogend@alpha.franken.de
     franzis kernel: PCI Master Bit has not been set. Setting...
     franzis kernel: Found PCnet/PCI at 0x10a0, irq 10.
     franzis kernel: eth1: PCnet/PCI II 79C970A at 0x10a0, 00 50 56 66 32 da assigned IRQ 10.
     franzis kernel: pcnet32.c:v1.25kf 26.9.1999 tsbogend@alpha.franken.de
    


    Shell startup

    Types of shells in Bash [Suse 8.2] :

    X11 + Suse 8.2 :


    Resum

      SuSE 8.2 Linex
    inittab id:5:initdefault
    ls:S:wait:/etc/init.d/rc S
    si::bootwait:/etc/init.d/boot
    id:2:initdefault
    ~~:S:wait:/sbin/sulogin
    si::sysinit:/etc/init.d/rcS
    boot scripts /etc/init.d/rc /etc/init.d/rc & rcS
    scripts /etc/init.d /etc/init.d
    local boot scripts /etc/init.d/boot.local /etc/init.d/rc.boot ?
    init.d description /etc/init.d/README /usr/share/doc/sysvinit/README
    1st script on system startup
    si in inittab
    /etc/init.d/boot
    starts all scripts in /etc/init.d/boot.d/*
    gives control to /etc/init.d/boot.local
    /etc/init.s/rcS
    starts all scripts in /etc/rcS.d/*
    gives control to /etc/init.d/rc "2"
    starts all scripts in /etc/rc2.d/*
    net cfg [IP @] /etc/sysconfig/network/ifcfg-eth0 /etc/network/interfaces
    net driver /etc/modules.conf
    alias eth0 fealnx
    /etc/modules
    fealnx
    +++SAGSAG+++ /etc/init.d/apache2
    boot.local
    halt.local
    network
    xdm
    { /var/log/boot.msg }
    /etc/init.d/modutils
    networking
    { < nope > }

    Links


    Ep ! Site under construction. Escriu-me ! Actualitzat el 11 de Gener de 2011. Uf !