Vi följer startordningen, men den här gången lite mera noggrant. Där ej annat anges ligger skripten i /etc/rc.d. Kärnan-->/sbin/init-->/etc/inittab-->rc.S--(med rc.modules-->rc.serial--)--> rc.M--[-->rc.pcmcia-->rc.inet1--(med rc.inet1.conf)-->rc.hotplug-->rc.inet2--(med rc.syslog-->rc.firewall--> rc.sshd-->rc.yp-->rc.nfsd.)-->rc.cups-->rc.atalk-->rc.sendmail-->rc.acpdi-->rc.font-->rc.keymap--> rc.httpd-->rc.samba-->rc.gpm-->rc.sysvinit-->rc.local]-->rc.4.
Min dator är "ensam"(stand-alone), kör ingen server, tillåter inte inloggning utifrån, och har "dynamisk"(inte fast IP-adress) inloggning via kabelmodem(dhcp) till internet.
Det första program, som börjar köras under Slackware, förutom linuxkärnan, är init(8). Detta program läser filen /etc/inittab(5) för att se, hur systemet skall köras. Det kör skriptet /etc/rc.d/rc.S för att förbereda systemet innan det går in i önskad körnivå (runlevel).
# # 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 # 4.00 04/10/2002 PV # # Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org> # Modified by: Patrick J. Volkerding, <volkerdi@slackware.com> # # 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) -->Detta är förvalt. # 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:4:initdefault: -->Jag har ändrat till grafisk inloggning. # System initialization (runs when system boots). si:S:sysinit:/etc/rc.d/rc.S -->Startar systemet. # Script to run when going single user (runlevel 1). -->Används när systemet "bråkar", se rc.K su:1S:wait:/etc/rc.d/rc.K # Script to run when going multi user. rc:2345:wait:/etc/rc.d/rc.M -->När du går till "fleranvändarläge". # What to do at the "Three Finger Salute". ca::ctrlaltdel:/sbin/shutdown -t5 -r now -->Startar om med "ctrl+alt+del". # 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. pf::powerfail:/sbin/genpowerfail start # If power is back, cancel the running shutdown. pg::powerokwait:/sbin/genpowerfail stop # These are the standard console login getties in multiuser mode: -->Nås via ctrl+alt+"F1-F6", c1:1235:respawn:/sbin/agetty 38400 tty1 linux som synes finns bara 1 console i c2:1235:respawn:/sbin/agetty 38400 tty2 linux grafiskt läge,ctrl+alt+F6. 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 # Local serial lines: #s1:12345:respawn:/sbin/agetty -L ttyS0 9600 vt100 #s2:12345:respawn:/sbin/agetty -L ttyS1 9600 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 -->Startar grafisk inloggning. # End of /etc/inittab
#!/bin/sh # # /etc/rc.d/rc.S: System initialization script. # # Mostly written by: Patrick J. Volkerding, <volkerdi@slackware.com> # PATH=/sbin:/usr/sbin:/bin:/usr/bin -->Sökvägar till program du har tillgång till. # Start devfsd if necessary -->Om du har "devfs"-filsystem, jag har det inte. if [ -r /dev/.devfsd ]; then if [ -x /sbin/devfsd ]; then echo "Starting devfs daemon: /sbin/devfsd /dev" /sbin/devfsd /dev fi fi # enable swapping -->Startar swap-partitionen. /sbin/swapon -a # Test to see if the root partition is read-only, like it ought to be. -->"/"-partitionen monteras i READWRITE=no "read-only" läge för ev. tester. if echo -n >> "Testing filesystem status"; then rm -f "Testing filesystem status" READWRITE=yes fi # See if a forced filesystem check was requested at shutdown: if [ -r /etc/forcefsck ]; then FORCEFSCK="-f" fi # Check the root filesystem: if [ ! $READWRITE = yes ]; then if [ ! -r /etc/fastboot ]; then echo "Checking root filesystem:" /sbin/fsck $FORCEFSCK -C -a / RETVAL=$? fi # An error code of 2 or higher will require a reboot. if [ $RETVAL -ge 2 ]; then # An error code equal to or greater than 4 means that some errors # could not be corrected. This requires manual attention, so we # offer a chance to try to fix the problem in single-user mode: if [ $RETVAL -ge 4 ]; then echo echo echo "***********************************************************" echo "*** An error occurred during the root filesystem check. ***" echo "*** You will now be given a chance to log into the ***" echo "*** system in single-user mode to fix the problem. ***" echo "*** ***" echo "*** If you are using the ext2 filesystem, running ***" echo "*** 'e2fsck -v -y <partition>' might help. ***" echo "***********************************************************" echo echo "Once you exit the single-user shell, the system will reboot." echo PS1="(Repair filesystem) \#"; export PS1 sulogin else # With an error code of 2 or 3, reboot the machine automatically: echo echo echo "***********************************" echo "*** The filesystem was changed. ***" echo "*** The system will now reboot. ***" echo "***********************************" echo fi echo "Unmounting file systems." umount -a -r mount -n -o remount,ro / echo "Rebooting system." sleep 2 reboot -f fi # Remount the root filesystem in read-write mode -->Startar "/" i "read-write"-läge. echo "Remounting root device with read-write enabled." /sbin/mount -w -v -n -o remount / if [ $? -gt 0 ] ; then echo echo "Attempt to remount root device as read-write failed! This is going to" echo "cause serious problems." echo echo "If you're using the UMSDOS filesystem, you **MUST** mount the root partition" echo "read-write! You can make sure the root filesystem is getting mounted " echo "read-write with the 'rw' flag to Loadlin:" echo echo "loadlin vmlinuz root=/dev/hda1 rw (replace /dev/hda1 with your root device)" echo echo "Normal bootdisks can be made to mount a system read-write with the rdev command:" echo echo "rdev -R /dev/fd0 0" echo echo "You can also get into your system by using a boot disk with a command like this" echo "on the LILO prompt line: (change the root partition name as needed)" echo echo "LILO: mount root=/dev/hda1 rw" echo echo "Please press ENTER to continue, then reboot and use one of the above methods to" echo -n "get into your machine and start looking for the problem. " read junk; fi 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 if [ ! "$ROOTTYPE" = "umsdos" ]; then # no warn for UMSDOS echo echo "*** ERROR: Root partition has already been mounted read-write. Cannot check!" echo echo "For filesystem checking to work properly, your system must initially mount" echo "the root partition as read only. Please modify your kernel with 'rdev' so that" echo "it does this. If you're booting with LILO, add a line:" echo echo " read-only" echo echo "to the Linux section in your /etc/lilo.conf and type 'lilo' to reinstall it." echo echo "If you boot from a kernel on a floppy disk, put it in the drive and type:" echo " rdev -R /dev/fd0 1" echo echo "If you boot from a bootdisk, or with Loadlin, you can add the 'ro' flag." echo echo "This will fix the problem *AND* eliminate this annoying message. :^)" echo echo -n "Press ENTER to continue. " read junk; fi fi # Done checking root filesystem # Any /etc/mtab that exists here is old, so we delete it to start over: -->?? /bin/rm -f /etc/mtab* # Remounting the / partition will initialize the new /etc/mtab: /sbin/mount -w -o remount / # Initialize the Logical Volume Manager. -->?? # This won't start unless /etc/lvmtab is found, which is created by /sbin/vgscan. # Therefore, to use LVM you must run /sbin/vgscan yourself the first time. if [ -r /etc/lvmtab ]; then # Mount /proc early (it's needed for vgscan): /sbin/mount -a -t proc # Scan for new volume groups: /sbin/vgscan if [ $? = 0 ]; then # Make volume groups available to the kernel: /sbin/vgchange -ay fi fi # Check all the non-root filesystems: -->Kollar dom andra, /home, /usr/local m.m. if [ ! -r /etc/fastboot ]; then (om du har någon sådan partition.) echo "Checking non-root filesystems:" /sbin/fsck $FORCEFSCK -C -R -A -a fi # mount non-root file systems in fstab (but not NFS or SMB -->Monterar din "/etc/fstab", # because TCP/IP is not yet configured): utom nätverket. /sbin/mount -a -v -t nonfs,nosmbfs # Clean up some temporary files: -->Rensar filer, här kan du lägga till fler om du vill. ( cd /var/log/setup/tmp && rm -rf * ) /bin/rm -f /var/run/utmp /var/run/*pid /etc/nologin /var/run/lpd* \ /var/run/ppp* /etc/dhcpc/dhcpcd-eth0.pid /etc/forcefsck /etc/fastboot # Create a fresh utmp file: -->?? cat /dev/null > /var/run/utmp 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/motd to reflect the current kernel level: -->?? # THIS WIPES ANY CHANGES YOU MAKE TO /ETC/MOTD WITH EACH BOOT. # COMMENT THIS OUT IF YOU WANT TO MAKE A CUSTOM VERSION. echo "`/bin/uname -sr`." > /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 # Set the system time from the hardware clock using hwclock --hctosys. -->Ställer klockan. # Detect SGI Visual Workstation, since hwclock will make those freeze up: if fgrep -l Cobalt-APIC /proc/interrupts 1> /dev/null 2> /dev/null ; then echo "SGI Visual Workstation detected. Not running hwclock." elif [ -x /sbin/hwclock ]; then if grep "^UTC" /etc/hardwareclock 1> /dev/null 2> /dev/null ; then echo "Setting system time from the hardware clock (UTC)." /sbin/hwclock --utc --hctosys else echo "Setting system time from the hardware clock (localtime)." /sbin/hwclock --localtime --hctosys fi fi # This loads any kernel modules that are needed. These might be required to -->Laddar kärn-moduler. # use your ethernet card, sound card, or other optional hardware. if [ -x /etc/rc.d/rc.modules -a -r /proc/modules ]; then . /etc/rc.d/rc.modules 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
Fleranvändarstart, /etc/rc.d/rc.M (multiuser mode, runlevel 2 och 3), men med den standardmässiga textbaserade inloggningen. Detta är förinställd körnivå i Slackware. Körnivåerna 2, 3 och 4 startar även nätverkstjänster via /etc/rc.d/inet1, /etc/rc.d/inet2 och /etc/inetd.conf.
#!/bin/sh Gröna värden=mina värden # # 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.23 Wed Feb 26 19:20:58 PST 2003 # # Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> # Heavily modified by Patrick Volkerding <volkerdi@slackware.com> # # Tell the viewers what's going to happen. echo "Going multiuser..." # Screen blanks after 15 minutes idle time. /bin/setterm -blank 15 # 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. /bin/hostname `cat /etc/HOSTNAME | cut -f1 -d .` # Initialize PCMCIA devices: # # NOTE: This used to be started near the top of rc.S 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 # The cards might need a little extra time here to initialize. # if [ -r /var/run/cardmgr.pid ]; then # sleep 5 # fi #fi # Initialize the networking hardware: if [ -x /etc/rc.d/rc.inet1 ]; then . /etc/rc.d/rc.inet1 fi
# Initialize the hotplugging subsystem for PCI, Cardbus, and USB devices: if [ -x /etc/rc.d/rc.hotplug -a -r /proc/modules ]; then # Don't run hotplug if 'nohotplug' was given at boot. if ! grep nohotplug /proc/cmdline 1> /dev/null 2> /dev/null ; then . /etc/rc.d/rc.hotplug start fi fi
# Start networking daemons: if [ -x /etc/rc.d/rc.inet2 ]; then . /etc/rc.d/rc.inet2 else # Start the system logger. Normally this is started by # rc.inet2 because /usr might be mounted via NFS. if [ -x /etc/rc.d/rc.syslog ]; then . /etc/rc.d/rc.syslog start fi fi
# Remove stale locks and junk files (must be done after mount -a!) /bin/rm -f /var/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 / 2> /dev/null chmod 1777 /tmp /var/tmp # Update all the shared library links: if [ -x /sbin/ldconfig ]; then echo "Updating shared library links: /sbin/ldconfig" /sbin/ldconfig fi # Update the X font indexes: if [ -x /usr/X11R6/bin/fc-cache ]; then echo "Updating X font indexes: /usr/X11R6/bin/fc-cache" /usr/X11R6/bin/fc-cache fi # Start the print spooling system. This will usually be LPD or CUPS. if [ -x /etc/rc.d/rc.cups ]; then # Start CUPS: /etc/rc.d/rc.cups start #elif [ -x /usr/sbin/lpd ]; then # Start LPD: #echo "Starting the line printer daemon: /usr/sbin/lpd" #/usr/sbin/lpd 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 smartd, which monitors the status of S.M.A.R.T. compatible # hard drives and reports any problems. Note some devices (which aren't # smart, I guess ;) will hang if probed by smartd, so it's commented out # by default. #if [ -x /usr/sbin/smartd ]; then # /usr/sbin/smartd #fi # Monitor the UPS with genpowerd. # To use this, uncomment it and edit in your serial device and UPS type. For # more information, see "man genpowerd" or the extensive documentation in the # /usr/doc/genpower-1.0.1 directory. You can see a list of supported UPS # devices by running genpowerd from the command line. # You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want # support for stopping the UPS's inverter after the machine halts. #if [ -x /sbin/genpowerd ]; then # echo "Starting genpowerd daemon..." # /sbin/genpowerd /dev/ttyS4 tripp-nt #fi # Turn on process accounting. To enable process accounting, make sure the # option for BSD process accounting is enabled in your kernel, and then # create the file /var/log/pacct (touch /var/log/pacct). By default, process # accounting is not enabled (since /var/log/pacct does not exist). This is # because the log file can get VERY large. #if [ -x /sbin/accton -a -r /var/log/pacct ]; then # /sbin/accton /var/log/pacct # chmod 640 /var/log/pacct # echo "Process accounting turned on." #fi # Start crond (Dillon's crond): # If you want cron to actually log activity to /var/log/cron, then change # -l10 to -l8 to increase the logging level. #if [ -x /usr/sbin/crond ]; then # /usr/sbin/crond -l10 >>/var/log/cron 2>&1 #fi # Start atd (manages jobs scheduled with 'at'): #if [ -x /usr/sbin/atd ]; then # /usr/sbin/atd -b 15 -l 1 #fi # 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: /usr/doc/Linux-mini-HOWTOs/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 -avugM" # /sbin/quotacheck -avugM # fi # if [ -x /sbin/quotaon ]; then # echo "Activating filesystem quotas: /sbin/quotaon -avug" # /sbin/quotaon -avug # fi #fi # Start the sendmail daemon: #if [ -x /etc/rc.d/rc.sendmail ]; then # . /etc/rc.d/rc.sendmail start #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" /usr/sbin/apmd fi fi
# Start the ACPI (Advanced Configuration and Power Interface) daemon: #if [ -x /etc/rc.d/rc.acpid ]; then # . /etc/rc.d/rc.acpid start #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
# Start Web server: #if [ -x /etc/rc.d/rc.httpd ]; then # . /etc/rc.d/rc.httpd start #fi # Start Samba (a file/print server for Win95/NT machines). # Samba can be started in /etc/inetd.conf instead. #if [ -x /etc/rc.d/rc.samba ]; then # . /etc/rc.d/rc.samba start #fi # Start the GPM mouse server: if [ -x /etc/rc.d/rc.gpm ]; then . /etc/rc.d/rc.gpm start 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.
#! /bin/sh #Gröna värden=mina värden # # rc.4 This file is executed by init(8) when the system is being # initialized for run level 4 (XDM) # # Version: @(#)/etc/rc.d/rc.4 2.00 02/17/93 # # Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> # At least 47% rewritten by: Patrick J. Volkerding <volkerdi@slackware.com> # # Tell the viewers what's going to happen... echo "Starting up X11 session manager..." # Try to use GNOME's gdm session manager: #if [ -x /usr/bin/gdm ]; then # exec /usr/bin/gdm -nodaemon #fi # Not there? OK, try to use KDE's kdm session manager: if [ -x /opt/kde/bin/kdm ]; then exec /opt/kde/bin/kdm -nodaemon #Läser från/etc/X11/xdm/Xsession fi # If all you have is XDM, I guess it will have to do: #if [ -x /usr/X11R6/bin/xdm ]; then # exec /usr/X11R6/bin/xdm -nodaemon #fi # error echo echo "Hey, you don't have KDM, GDM, or XDM. Can't use runlevel 4 without" echo "one of those installed." sleep 30 # All done.