3. Le premier boot!



  1. Le boot facile
  2. Ben mettez la disquette boot dans le lecteur de darkstar tout frais reconstruit, paramétrez le BIOS pour booter sur disquette, et si tout s'est bien passé, vous devriez voir apparaitre "uncompressing linux...." etc, etc... Le prompt de login devrait apparaitre. Si vous avez une erreur du genre: cannot mount VFS on device blabla, il y a de grandes chances pour que vous n'ayez pas rdev le noyau situe dessus. Remettez la disquette dans le linux, et re-executez la commande: rdev /dev/fd0 /dev/hda2 ; autre possibilitée, le PC a perdu la config du DD; il suffit de passer dans le BIOS, et hop! Assurez vous que les jumpers sont bien positionnés. Si vous avez suivi scrupulusement cette doc, le disque est passé de master (originellement) a slave, puisqu'on le gérait sous /dev/hdd. Il faut etre sur de l'avoir repositionné en maitre.

    Ca y'est, linux est installe sur la machine et viens de vivre son premier boot, félicitations :) la machine et linux se portent bien. Il n'existe pour l'instant qu'un seul utilisateur, root, et son mot de passe est vide.


  3. Les ennuis commencent
  4. Bah oui, Si vous avez bien lu les messages au boot, il y a de grandes chances pour que tout ne se passe très bien, autant dire qu'il va falloir éditer du script de démarrage, paramétrer le bazar, et s'arracher les cheveux (éventuellement dans les cas extremes, il est même possible d'insulter la machine, de taper du pied, et de la jeter par la fenêtre. Si vous la jetez par la fenetre, il y a de grandes chances pour qu'elle marche moins bien ensuite. Surtout si vous habitez au 48e étage d'un gratte-ciel. Quoique si vous projettiez (hihi) d'utiliser cette machine pour des calculs de simulation de gravité terrestre, vous avez tout bon! La première loi de la gravité stipule que tout PC jeté du haut d'un immeuble subit une poussée du haut vers le bas. Il y a de grandes chances pour qu'Isaac Newton, venant a se promener par la, se le ramasse sur le coin de la tronche, et que c'est un gag déja utilisé par Gotlib, bref.). La zipslack, c'est la distro ou il faut tout faire soi-meme. _tout_, absolument tout. En plus le clavier est en anglais qwerty. Premiere chose:

    [root@darkstar:~]# loadkeys fr-latin1  
    Loading /usr/lib/kbd/keymaps/i386/azerty/fr-latin1.map.gz
    [root@darkstar:~]# 
    

    Et mettez un mot de passe pour root!

    [root@darkstar:~]# passwd 
    Changing password for root
    Enter the new password (minimum of 5, maximum of 127 characters)
    Please use a combination of upper and lower case letters and numbers.
    

    Le clavier se parametre dans un des scripts de boot appelé rc.keymap, il est situé dans /etc/rc.d; modifiez-le pour qu'il ressemble à:

    [root@darkstar:~]# cat /etc/rc.d/rc.keymap 
    #!/bin/sh
    # Load the keyboard map.  More maps are in /usr/lib/kbd/keytables.
    echo "Chargement du clavier fr-latin1"
    if [ -x /usr/bin/loadkeys ]; then
     /usr/bin/loadkeys fr-latin1
    fi
    [root@darkstar:~]# 
    

    Maintenant que nous sommes surs que le clavier se charge bien en francais, on peut commencer a parametrer sa distro. Pourquoi cette précaution? Pour éviter les cafouillages avec les caractères utilisés par le mot de passe root. Les suisses, belges ou canadiens ou autres francophones adapteront selon leur clavier, bien sûr. (et s'il y en a un qui lit ces quelques lignes, qu'il me le fasse savoir, je rajouterais les lignes correspondantes)

    Vous avez pu lire que root a recu du mail. Tapez la commande "mail", et lisez votre courrier. (petit rappel: tapez le numero du mail pour le lire, la touche d suivi d'un espace et du numero du mail pour l'effacer, et q pour quitter. Si un mail est plus long que la taille de votre ecran, le visualiseur "more" est utilise. Touche espace pour passer de page en page, et touche q pour quitter.)


  5. Le démarrage de la slackware

  6. Attention!!

    Vous allez modifier les scripts d'initialisation de la machine. Un bon réflexe a prendre est de faire une sauvegarde des fichiers avant toute modification. J'ai personnelement opté pour une solution simple. Lorsque je modifie pour la première fois un fichier, je le copie avec le suffixe .original et je travaille sur le fichier. Si je veux affiner un script fonctionnel, je le copie avant avec le suffixe .quimarche. Ca permet de revenir sur ses pas en cas de betises.


    le boot par le menu

    Lorsque le noyau a fini de booter, il lit le fichier /etc/inittab qui contient le runlevel dans lequel le boot doit se poursuivre, et l'initialisation du systeme. Regardons le en détail:

    Les fichiers ici édités sont ceux d'une zipslack correspondant a la slackware 7.1; j'ai installé des zipslack 8, grosso-modo, les fichiers n'ont pas des masses changés, vous devriez vous y retrouver sans trop de mal

    Et pourquoi je ne me sers pas de la zipslack8? Ben tout simplement parceque le Cd sur lequel elle est gravée est quelque part, mais dans un quelque part que j'ignore vachement parceque je n'arrive plus a avoir la moindre idée du debut du commencement de l'endroit ou chercher.

    [root@darkstar:~]# cat etc/inittab 
    #
    # inittab       This file describes how the INIT process should set up
    #               the system in a certain run-level.
    #
    # Version:      @(#)inittab             2.04    17/05/93        MvS
    #                                       2.10    02/10/95        PV
    #                                       3.00    02/06/1999      PV
    #
    # Author:       Miquel van Smoorenburg, 
    # Modified by:  Patrick J. Volkerding, 
    #
    
    # These are the default runlevels in Slackware:
    #   0 = halt
    #   1 = single user mode
    #   2 = unused (but configured the same as runlevel 3)
    #   3 = multiuser mode (default Slackware runlevel)
    #   4 = X11 with KDM/GDM/XDM (session managers)
    #   5 = unused (but configured the same as runlevel 3)
    #   6 = reboot
    
    # Default runlevel. (Do not set to 0 or 6)
    id:3:initdefault:
    
    # System initialization (runs when system boots).
    si:S:sysinit:/etc/rc.d/rc.S
    
    # Script to run when going single user (runlevel 1).
    su:1S:wait:/etc/rc.d/rc.K
    
    # Script to run when going multi user.
    rc:2345:wait:/etc/rc.d/rc.M
    
    # What to do at the "Three Finger Salute".
    ca::ctrlaltdel:/sbin/shutdown -t5 -rf now
    
    # Runlevel 0 halts the system.
    l0:0:wait:/etc/rc.d/rc.0
    
    # Runlevel 6 reboots the system.
    l6:6:wait:/etc/rc.d/rc.6
    
    # What to do when power fails (shutdown to single user).
    pf::powerfail:/sbin/shutdown -f +5 "THE POWER IS FAILING"
    
    # If power is back before shutdown, cancel the running shutdown.
    pg:0123456:powerokwait:/sbin/shutdown -c "THE POWER IS BACK"
    
    # If ps:S:powerokwait:/sbin/init 3
    
    # The getties in multi user mode on consoles an serial lines.
    #
    # NOTE NOTE NOTE adjust this to your getty or you will not be
    #                able to login !!
    #
    # Note: for 'agetty' you use linespeed, line.
    # for 'getty_ps' you use line, linespeed and also use 'gettydefs'
    c1:1235:respawn:/sbin/agetty 38400 tty1 linux
    c2:1235:respawn:/sbin/agetty 38400 tty2 linux
    c3:1235:respawn:/sbin/agetty 38400 tty3 linux
    c4:1235:respawn:/sbin/agetty 38400 tty4 linux
    c5:1235:respawn:/sbin/agetty 38400 tty5 linux
    c6:12345:respawn:/sbin/agetty 38400 tty6 linux
    
    # Serial lines
    #s1:12345:respawn:/sbin/agetty 19200 ttyS0 vt100
    #s2:12345:respawn:/sbin/agetty 19200 ttyS1 vt100
    
    # Dialup lines
    #d1:12345:respawn:/sbin/agetty -mt60 38400,19200,9600,2400,1200 ttyS0 vt100
    #d2:12345:respawn:/sbin/agetty -mt60 38400,19200,9600,2400,1200 ttyS1 vt100
    
    # Runlevel 4 used to be for an X window only system, until we discovered
    # that it throws init into a loop that keeps your load avg at least 1 all 
    # the time. Thus, there is now one getty opened on tty6. Hopefully no one
    # will notice. ;^)
    # It might not be bad to have one text console anyway, in case something 
    # happens to X.
    x1:4:wait:/etc/rc.d/rc.4
    
    # End of /etc/inittab
    power comes back in single user mode, return to multi user mode.
    [root@darkstar:~]#
    

    On peut voir que le runlevel est le 3. Au boot, le noyau executera le fichier /etc/rc.d/rc.S ; ensuite, il executera le fichier /etc/rc.d/rc.M . Suit quelques considerations sur la conduite a tenir en cas d'appui sur les touches ctrl-alt-del et en cas de coupure de courant, et le lancement des consoles virtuelles.

    Hint! Sur les machines avec peu de RAM, vous pouvez gratter quelques ko en diminuant le nombre de consoles virtuelles. Modifiez les lignes getty qui sont:

    # Note: for 'agetty' you use linespeed, line.
    # for 'getty_ps' you use line, linespeed and also use 'gettydefs'
    c1:1235:respawn:/sbin/agetty 38400 tty1 linux
    c2:1235:respawn:/sbin/agetty 38400 tty2 linux
    c3:1235:respawn:/sbin/agetty 38400 tty3 linux
    c4:1235:respawn:/sbin/agetty 38400 tty4 linux
    c5:1235:respawn:/sbin/agetty 38400 tty5 linux
    c6:12345:respawn:/sbin/agetty 38400 tty6 linux
    

    Effacer les consoles c3 c4 c5 c6, et modifiez c2 pour obtenir

    # Note: for 'agetty' you use linespeed, line.
    # for 'getty_ps' you use line, linespeed and also use 'gettydefs'
    c1:1235:respawn:/sbin/agetty 38400 tty1 linux
    c2:12345:respawn:/sbin/agetty 38400 tty2 linux
    

    Vous ne disposez maintenant que de deux consoles accessibles par [ALT][F1] et [ALT][F2]

    C'est un fonctionnement de boot qui peut surprendre les personnes habituées au boot genre systemV (redhat par exemple), mais il se revele tres souple et tres simple.


    le fichier de démarrage système rc.S

    Que contient-il?

    [root@darkstar:~]# cat /etc/rc.d/rc.S
    #!/bin/sh
    #
    # /etc/rc.d/rc.S:  System initialization script.
    #
    # Mostly written by:  Patrick J. Volkerding, 
    #
    
    PATH=/sbin:/usr/sbin:/bin:/usr/bin
    
    # enable swapping
    /sbin/swapon -a
    
    # Start update.
    /sbin/update &
    
    # Automatic module loading.  To load and unload kernel modules
    # automatically as needed, uncomment the lines below to run kerneld.
    # In some cases, you'll need to create aliases to load the correct
    # module. For more information, see the docs in /usr/doc/modules.
    # NOTE: This is commented out by default, since running kerneld has
    # caused some experimental kernels to hang during boot.
    #if [ -x /sbin/kerneld ]; then
    #  /sbin/kerneld
    #fi
    
    # Test to see if the root partition is read-only, like it ought to be.
    READWRITE=no
    if echo -n >> "Testing filesystem status"; then
     rm -f "Testing filesystem status"
     READWRITE=yes
    fi
    
    # Check the integrity of all filesystems
    if [ ! $READWRITE = yes ]; then
     /sbin/fsck -A -a
     # If there was a failure, drop into single-user mode.
     if [ $? -gt 1 ] ; then
      echo
      echo
      echo "*******************************************************"
      echo "*** An error occurred during the file system check. ***"
      echo "*** You will now be given a chance to log into the  ***"
      echo "*** system in single-user mode to fix the problem.  ***"
      echo "*** Running 'e2fsck -v -y ' might help.  ***"
      echo "*******************************************************"
      echo
      echo "Once you exit the single-user shell, the system will reboot."
      echo
    
      PS1="(Repair filesystem) \#"; export PS1
      sulogin
    
      echo "Unmounting file systems..."
      umount -a
      mount -n -o remount,ro /
      echo "Rebooting system..."
      sleep 2
      reboot
     fi
     # Remount the root filesystem in read-write mode
     echo "Remounting root device with read-write enabled."
     /sbin/mount -w -v -n -o remount /
    else
     echo "Testing filesystem status: read-write filesystem"
     if cat /etc/fstab | grep ' / ' | grep umsdos 1> /dev/null 2> /dev/null ; then
      ROOTTYPE="umsdos"
     fi
    fi
    
    # remove /etc/mtab* so that mount will create it with a root entry
    /bin/rm -f /etc/mtab* /etc/nologin /etc/shutdownpid 
    
    # mount file systems in fstab (and create an entry for /)
    # but not NFS because TCP/IP is not yet configured
    /sbin/mount -a -v -t nonfs
    
    # Clean up temporary files on the /var volume:
    /bin/rm -f /var/run/utmp /var/run/*.pid /var/log/setup/tmp/*
    
    # Looks like we have to create this.
    cat /dev/null > /var/run/utmp
    
    # Set the system time from the hardware clock using hwclock
    if [ -x /sbin/hwclock ]; then
      echo "Setting system time from hardware clock..."
      if [ -e /etc/hardwareclock ]; then
        HC=`cat /etc/hardwareclock | while read LINE ; do
          if [ "$LINE" = "UTC" -o "$LINE" = "utc" ]; then
            echo utc
            break;
          elif [ "$LINE" = "localtime" ]; then
            echo localtime
            break;
          fi
        done`
      else
        # Default to localtime if there is no /etc/hardwareclock:
        HC=localtime
      fi
      # /sbin/hwclock --$HC --hctosys
      # The line above *should* work with --localtime, but doesn't.  Omitting
      # the argument defaults it to localtime, so use that.
      if [ "$HC" = "utc" ]; then
        /sbin/hwclock --utc --hctosys
      else
        /sbin/hwclock --hctosys
      fi
    fi
    
    if [ "$ROOTTYPE" = "umsdos" ]; then # we need to update any files added in DOS:
     echo "Synchronizing UMSDOS directory structure:"
     echo "  umssync -r99 -v- /"
     umssync -r99 -v- /
    fi
    
    # Setup the /etc/issue and /etc/motd to reflect the current kernel level:
    # THESE WIPE ANY CHANGES YOU MAKE TO /ETC/ISSUE AND /ETC/MOTD WITH EACH
    # BOOT. COMMENT THEM OUT IF YOU WANT TO MAKE CUSTOM VERSIONS.
    echo > /etc/issue
    echo Welcome to Linux `/bin/uname -a | /bin/cut -d\  -f3`. >> /etc/issue
    echo >> /etc/issue
    echo "`/bin/uname -a | /bin/cut -d\  -f1,3`." > /etc/motd
    
    # Configure ISA Plug-and-Play devices:
    if [ -r /etc/isapnp.conf ]; then
      if [ -x /sbin/isapnp ]; then
        /sbin/isapnp /etc/isapnp.conf
      fi
    fi
    
    # This loads any kernel modules that are needed.  These might be required to
    # use your CD-ROM drive, bus mouse, ethernet card, or other optional hardware.
    if [ -x /etc/rc.d/rc.modules ]; then
      . /etc/rc.d/rc.modules
    fi
    
    # Initialize PCMCIA devices:
    #
    # NOTE: This had been closer to the top of this script so that PCMCIA devices
    # could be fsck'ed along with the other drives.  This had some unfortunate
    # side effects, however, since root isn't yet read-write, and /var might not
    # even be mounted the .pid files can't be correctly written in /var/run and
    # the pcmcia system can't be correctly shut down.  If you want some PCMCIA
    # partition to be mounted at boot (or when the card is inserted) then add
    # the appropriate lines to /etc/pcmcia/scsi.opts.
    #
    if [ -x /etc/rc.d/rc.pcmcia ] ; then
      . /etc/rc.d/rc.pcmcia start
    fi
    
    # Run serial port setup script:
    # (CAREFUL! This can make some systems hang if the rc.serial script isn't
    # set up correctly. If this happens, you may have to edit the file from a
    # boot disk)
    #
    # . /etc/rc.d/rc.serial
    
    # Carry an entropy pool between reboots to improve randomness.
    # Load and then save 512 bytes, which is the size of the entropy pool.
    if [ -f /etc/random-seed ]; then
      echo "Using /etc/random-seed to initialize /dev/urandom..."
      cat /etc/random-seed >/dev/urandom
    fi
    dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
    
    

    Ca correspond bien a l'idée du boot d'un système. Par "boot système" j'entends par la tout les trucs essentiels et nécéssaires. Dans le détail, on a (je ne fais que relire en langage plus humain le script)

    Fin du script rc.S

    Editez le (après en avoir fait une copie de sauvegarde, bien entendu). Commentez les lignes qui ne concernent pas votre machine, et adaptez celle qui ne vous vont pas. Ca devrait concerner le pcmcia, les messages de bienvenue (éventuellement), et peut etre le PnP; a vous d'adapter selon l'hardware du PC


    Le fichier de démarrage rc.M


    Que contient il?

    [root@darkstar:~]# cat /etc/rc.d/rc.M
    #!/bin/sh
    #
    # rc.M		This file is executed by init(8) when the system is being
    #		initialized for one of the "multi user" run levels (i.e.
    #		levels 1 through 6).  It usually does mounting of file
    #		systems et al.
    #
    # Version:	@(#)/etc/rc.d/rc.M	2.02	02/26/93
    #
    # Author:	Fred N. van Kempen, 
    #		Heavily modified by Patrick Volkerding 
    #
    
    # Tell the viewers what's going to happen...
    echo "Going multiuser..."
    
    # Screen blanks after 15 minutes idle time.
    /bin/setterm -blank 15
    
    # Look for a CD-ROM in a CD-ROM drive, and if one is found,
    # mount it under /cdrom.  This must happen before any of the
    # binaries on the CD are needed.
    #
    # If you don't have a CD-ROM and want to disable this, set the
    # /etc/rc.d/rc.cdrom permissions to non-executable: chmod 644 /etc/rc.d/rc.cdrom
    # 
    if [ -x /etc/rc.d/rc.cdrom ]; then
      . /etc/rc.d/rc.cdrom
    fi
    
    # If there's no /etc/HOSTNAME, fall back on this default:
    if [ ! -r /etc/HOSTNAME ]; then
     echo "darkstar.example.net" > /etc/HOSTNAME
    fi
    
    # Set the hostname.  This might not work correctly if TCP/IP is not 
    # compiled in the kernel.
    /bin/hostname `cat /etc/HOSTNAME | cut -f1 -d .`
    
    # Initialize the NET subsystem.
    if [ -x /etc/rc.d/rc.inet1 ]; then
      . /etc/rc.d/rc.inet1
      . /etc/rc.d/rc.inet2
    else
      if [ -x /usr/sbin/syslogd ]; then
        /usr/sbin/syslogd
        sleep 1 # Prevents a race condition with SMP kernels
        # '-c 3' displays level 'error' or higher messages on the console
        /usr/sbin/klogd -c 3
      fi
      if [ -x /usr/sbin/lpd ]; then
        /usr/sbin/lpd
      fi
    fi
    
    # Start netatalk. (a file/print server for Macs using Appletalk)
    #if [ -x /etc/rc.d/rc.atalk ]; then
    #  /etc/rc.d/rc.atalk
    #fi
    
    # Start crond (Dillon's crond):
    # If you want cron to actually log activity to /var/adm/cron, then change
    # -l10 to -l8 to increase the logging level.
    /usr/sbin/crond -l10 >>/var/adm/cron 2>&1
    
    # Start atd (manages jobs scheduled with 'at'):
    /usr/sbin/atd -b 15 -l 1
    
    # Remove stale locks and junk files (must be done after mount -a!)
    /bin/rm -f /vr/lock/* /var/spool/uucp/LCK..* /tmp/.X*lock /tmp/core /core 1> /dev/null 2> /dev/null
    
    # Remove stale hunt sockets so the game can start.
    if [ -r /tmp/hunt -o -r /tmp/hunt.stats ]; then
      echo "Removing your stale hunt sockets from /tmp..."
      /bin/rm -f /tmp/hunt*
    fi
    
    # Ensure basic filesystem permissions sanity.
    chmod 755 /
    chmod 1777 /tmp /var/tmp
    
    # Update all the shared library links automatically
    /sbin/ldconfig
    
    # Slackware-Mini-Quota-HOWTO:
    # To really activate quotas, you'll need to add 'usrquota' to the appropriate
    # partitions as listed in /etc/fstab.  Here's an example:
    # /dev/hda2   /home   ext2   defaults,usrquota    1   1
    # You'll then need to setup initial quota files at the top of the partitions
    # to support quota, like this:
    # touch /home/quota.user /home/quota.group
    # chmod 600 /home/quota.user /home/quota.group
    # Then, reboot to activate the system.
    # To edit user quotas, use 'edquota'.  See 'man edquota'.  Also, the
    # official Quota Mini-HOWTO has lots of useful information.  That can be found
    # here:  ftp://ftp.cdrom.com/pub/linux/slackware/docs/mini/Quota
    
    # Check quotas and then turn quota system on:
    if fgrep quota /etc/fstab 1> /dev/null 2> /dev/null ; then
      if [ -x /sbin/quotacheck ]; then
        echo "Checking filesystem quotas..."
        /sbin/quotacheck -avug
      fi
      if [ -x /sbin/quotaon ]; then
        echo "Activating filesystem quotas..."
        /sbin/quotaon -avug
      fi
    fi
    
    # Start the sendmail daemon:
    if [ -x /usr/sbin/sendmail ]; then
      echo "Starting sendmail daemon (/usr/sbin/sendmail -bd -q15m)..."
      /usr/sbin/sendmail -bd -q15m
    fi
    
    # Start the APM daemon if APM is enabled in the kernel:
    if [ -x /usr/sbin/apmd ]; then
      if cat /proc/apm 1> /dev/null 2> /dev/null ; then
        echo "Starting APM daemon..."
        /usr/sbin/apmd
      fi
    fi
    
    # Load a custom screen font if the user has an rc.font script.
    if [ -x /etc/rc.d/rc.font ]; then
      . /etc/rc.d/rc.font
    fi
    
    # Load a custom keymap if the user has an rc.keymap script.
    if [ -x /etc/rc.d/rc.keymap ]; then
      . /etc/rc.d/rc.keymap
    fi
    
    # iBCS Emulation for Linux
    # The Intel Binary Compatibility Specification, or iBCS, specifies the
    # interfaces between application programs and the surrounding operating
    # system environment for i386 based systems. There are however several
    # flavours of iBCS in use - SVR4, SVR3 plus several vendor specific
    # extensions to SVR3 which are slightly different and incompatible. The
    # iBCS emulator for Linux supports all flavours known so far.
    if [ -x /etc/rc.d/rc.ibcs2 ]; then
      . /etc/rc.d/rc.ibcs2
    fi
    
    # Start Web server:
    if [ -x /etc/rc.d/rc.httpd ]; then
      . /etc/rc.d/rc.httpd
    fi
    
    # Start Samba (a file/print server for Win95/NT machines):
    if [ -x /etc/rc.d/rc.samba ]; then
      . /etc/rc.d/rc.samba
    fi
    
    # Start the GPM mouse server:
    if [ -x /etc/rc.d/rc.gpm ]; then
      . /etc/rc.d/rc.gpm
    fi
    
    # If there are SystemV init scripts for this runlevel, run them.
    if [ -x /etc/rc.d/rc.sysvinit ]; then
      . /etc/rc.d/rc.sysvinit
    fi
    
    # Start the local setup procedure.
    if [ -x /etc/rc.d/rc.local ]; then
      . /etc/rc.d/rc.local
    fi
    
    # All done.
    [root@darkstar:~]# 
    

    Et de nouveau, si je le lis en langage humain, ca donne:

    (et de nouveau, puisque vous allez editer ce fichier, faites-en une sauvegarde au préalable!) (scrogneugneu, vous ne pourrez pas dire que vous n'avez pas été prévenu.)

    Commentaires au sujet de ce fichier rc.M

    Le fonctionnement en fait est simple. Ce script teste a chaque fois si le fichier rc.bidule existe et est executable; si oui, il le lance. Facile. Vous voulez qu'un script ne se lance pas? un chmod -x rc.script, et la messe est dite. Une autre solution est de le renommer. Les scripts dont je ne veux pas voir le lancement ont ete renommés en rc.script-OFF (et laissé éxécutables). Un simple ls dans le répertoire permet de savoir les scripts lancés de ceux qui ne le sont pas. Vous voulez le lancer quand meme? Tapez le chemin complet /etc/rc.d/rc.script-OFF et le voila chargé. (au passage, la notation rc. n'a rien d'obligatoire. Et viens la question: que signifie ce "rc" qu'on voit de partout? Bah ca signifie Run Command.) . Si vous installez apache avec le gestionnaire de paquetage slack, le fichier /etc/rc.d/rc.httpd sera mis en place. Au reboot, apache se lance. Comme je disais, simple, sobre et efficace.

    Pour lancer d'autres services au démarrage, vous avez deux solutions.


    Les autres fichiers d'init, rc.inet, rc.gpm etc, etc..

    Un cas simple: rc.local

    [root@darkstar:~]# cat /etc/rc.d/rc.local
    #!/bin/sh
    #
    # /etc/rc.d/rc.local:  Local system initialization script.
    #
    # Put any local setup commands in here:
    [root@darkstar:~]# 
    

    Le fichier ... ne fait rien! :) Comme dit plus haut, si vous voulez lancer des trucs a vous sans vous prendre la tete, mettez les ici.


    le fichier rc.inet1

    [root@darkstar:~]# cat /etc/rc.d/rc.inet1
    #! /bin/sh
    #
    # rc.inet1	This shell script boots up the base INET system.
    #
    # Version:	@(#)/etc/rc.d/rc.inet1	2.00	10/06/1999
    #
    
    HOSTNAME=`cat /etc/HOSTNAME`
    
    # Attach the loopback device.
    /sbin/ifconfig lo 127.0.0.1
    /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
    
    # IF YOU HAVE AN ETHERNET CONNECTION, use these lines below to configure the 
    # eth0 interface.
    
    # Edit these values to set up a static IP address:
    IPADDR="127.0.0.1"	# REPLACE with YOUR IP address!
    NETMASK="255.255.255.0"	# REPLACE with YOUR netmask!
    NETWORK="127.0.0.0"	# REPLACE with YOUR network address!
    BROADCAST=""	# REPLACE with YOUR broadcast address, if you
    			# have one. If not, leave blank and edit below.
    GATEWAY=""	# REPLACE with YOUR gateway address!
    
    # To use DHCP instead of a static IP, set this value to "yes":
    DHCP="no"            # Use DHCP ("yes" or "no")
    
    # OK, time to set up the interface:
    if [ "$DHCP" = "yes" ]; then # use DHCP to set everything up:
      echo "Attempting to configure eth0 by contacting a DHCP server..."
      /sbin/dhcpcd
    elif [ ! "$IPADDR" = "127.0.0.1" ]; then # set up IP statically:
      # Set up the ethernet card:
      echo "Configuring eth0 as ${IPADDR}..."
      /sbin/ifconfig eth0 ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK}
    
      # If that didn't succeed, give the system administrator some hints:
      if [ ! $? = 0 ]; then
        cat << EOF
    Your ethernet card was not initialized properly.  Here are some reasons why this
    may have happened, and the solutions:
    1. Your kernel does not contain support for your card.  Including all the 
       network drivers in a Linux kernel can make it too large to even boot, and
       sometimes including extra drivers can cause system hangs.  To support your
       ethernet, either edit /etc/rc.d/rc.modules to load the support at boottime,
       or compile and install a kernel that contains support.
    2. You don't have an ethernet card, in which case you should comment out this
       section of /etc/rc.d/rc.inet1.  (Unless you don't mind seeing this error...)
    EOF
      fi
    
      # Older kernel versions need this to set up the eth0 routing table:
      KVERSION=`uname -r | cut -f 1,2 -d .`
      if [ "$KVERSION" = "1.0" -o "$KVERSION" = "1.1" \
       -o "$KVERSION" = "1.2" -o "$KVERSION" = "2.0" -o "$KVERSION" = "" ]; then
        /sbin/route add -net ${NETWORK} netmask ${NETMASK} eth0
      fi
    
      # If there is a gateway defined, then set it up:
      if [ ! "$GATEWAY" = "" ]; then
        /sbin/route add default gw ${GATEWAY} netmask 0.0.0.0 metric 1
      fi
    fi
    
    # End of rc.inet1
    [root@darkstar:~]# 
    

    La partie intéressante (pour vous) est au début du fichier. Pendant longtemps, comme je ne comprenais rien a ce que ce fichier racontait, je l'avais renomme en rc.inet1.illisible, et je me servais d'un autre fichier rc.inet1 qui contenait:

    [root@darkstar:~]# cat /etc/rc.d/rc.inet1
    #! /bin/sh
    #
    
    # et je configure le bin's
    /sbin/ifconfig lo 127.0.0.1
    /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
    /sbin/ifconfig eth0 192.168.1.4
    [root@darkstar:~]# 
    

    Ca, c'est parceque je dispose d'une carte réseau. Si vous n'en avez pas, seule les lignes traitant du loopback sont importantes. Pourquoi ne pas mettre de route pour eth0? Parceque j'ai remarque qu'elle se mettait en place automatiquement avec le ifconfig. N'oubliez pas que ce sont des scripts qui sont prévus pour s'adapter a toutes les situations. Vous, vous devez les faire correspondre a votre machine seulement. Forcément, il y a moyen de simplifier pas mal les choses.


    To be continued, je finirais de depiauter le boot plus tard; pour les presses, ben y z'ont qu'a lire les fichiers, tout est tres bien commente, d'abord


Chapitre suivant

Table des matières de ce chapitre, Table des matières générale

Début du document, Début de ce chapitre