SysV startup sequence
|OS startup sequence (SysV)
|At startup /sbin/init executes all instructions on /etc/inittab . This script at first switches to the default runlevel…
|… then it runs the following script (same for all runlevels) which configures peripheral hardware, applies kernel parameters, sets hostname, and provides disks initialization…
|… and then, for runlevel N, it calls the script/etc/init.d/rc N (i.e. with the runlevel number as parameter) which launches all services and daemons specified in the following startup directories:
The startup directories contain symlinks to the init scripts in /etc/init.d/ which are executed in numerical order. Links starting with K are called with argument stop, links starting with S are called with argument start.
lrwxrwxrwx. 1 root root 14 Feb 11 22:32 K88sssd -> ../init.d/sssd
lrwxrwxrwx. 1 root root 15 Nov 28 14:50 K89rdisc -> ../init.d/rdisc
lrwxrwxrwx. 1 root root 17 Nov 28 15:01 S01sysstat -> ../init.d/sysstat
lrwxrwxrwx. 1 root root 18 Nov 28 14:54 S05cgconfig -> ../init.d/cgconfig
lrwxrwxrwx. 1 root root 16 Nov 28 14:52 S07iscsid -> ../init.d/iscsid
lrwxrwxrwx. 1 root root 18 Nov 28 14:42 S08iptables -> ../init.d/iptables
The last script to be run is S99local -> ../init.d/rc.local ; therefore, an easy way to run a specific program on boot is to add it to this script file.
/etc/init.d/boot.local runs only at boot time, not when switching runlevel.
/etc/init.d/before.local (SUSE) runs only at boot time, before the scripts in the startup directories.
/etc/init.d/after.local (SUSE) runs only at boot time, after the scripts in the startup directories.
|To add or remove services at boot sequence:
||update-rc.d service defaults update-rc.d -f service remove
||chkconfig –add service chkconfig –del service
||Parameters supported by the init scripts
||Start the service
||Stop the service
||Restart the service (stop, then start)
||Display daemon PID and execution status
||Reload configuration if the service supports this option, otherwise restart the service
||Restart the service only if already running
||Reload service configuration
service service start (Red Hat) Start a service
rcservice start (SUSE)
||Single user / maintenance mode
||Multi-user mode (default)
||Multi-user mode without network
||Multi-user mode with network
||Unused, for custom use
||Multi-user mode with network and X(default)
||Single user / maintenance mode (usually accessed through runlevel 1)
The default runlevels are 2 3 4 5
|Display the previous and the current runlevel
|shutdown -h now
|Halt the system
|shutdown -r now
|Reboot the system
||Shut down the system in a secure way: all logged in users are notified via a message to their terminal, and login is disabled.
This command can be run only by the root user and by those users (if any) listed in
|shutdown -h 16:00 message
||Schedule a shutdown for 4 PM and send a warning message to all logged in users
||Non-root users that are listed in /etc/shutdown.allow can use this command to shut down the system
||Skip fsck on reboot
||Force fsck on reboot
||Cancel an already running shutdown
|POST (Power-On Self Test)
||Low-level check of PC hardware.
|BIOS(Basic I/O System)
||Detection of disks and hardware.
(GRand Unified Bootloader)
|GRUB stage 1 is loaded from the MBR and executes GRUB stage 2 from filesystem.GRUB chooses which OS to boot on.The chain loader hands over to the boot sector of the partition on which resides the OS.
The chain loader also mounts initrd, an initial ramdisk (typically a compressed ext2 filesystem) to be used as the initial root device during kernel boot; this make possible to load kernel modules that recognize hard drives hardware and that are hence needed to mount the real root filesystem. Afterwards, the system runs /linuxrc with PID 1. (From Linux 2.6.13 onwards, the system instead loads into memory initramfs, a cpiocompressed image, and unpacks it into an instance of tmpfs in RAM. The kernel then executes /init from within the image.)
||Kernel decompression into memory.Kernel execution.Detection of devices.
The real root filesystem is mounted on / in place of the initial ramdisk.
||Execution of init, the first process (PID 1).The system tries to execute in the following order:/sbin/init
If none of these succeeds, the kernel will panic.
||The system loads startup scripts and runlevel scripts.
||(Optional) The X Display Manager starts the X Server.
Some newer systems use UEFI (Unified Extensible Firmware Interface). UEFI does not use the MBR boot code; it has knowledge of partition table and filesystems, and stores its application files required for launch in a EFI System Partition, mostly formatted as FAT32.
After the POST, the system loads the UEFI firmware which initializes the hardware required for booting, then reads its Boot Manager data to determine which UEFI application to launch. The launched UEFI application may then launch another application, e.g. the kernel and initramfs in case of a boot loader like the GRUB.
Quite good entry level training material for IPv6 stuff:
Part 1: Basics of IPv6 Addressing
Part 2: Types of IPv6 Addresses
Part 3: IPv6 Subnetting
Part 4: IPv4/IPv4 Transition Technologies
Addresses types summary:
Unicast Global = Public Address – will always begin with either a hexadecimal value of 2 (0010) or a hexadecimal value of 3 (0011). The IPv6 address of 2001::1 is an example of a global unicast address.
Unicast Local = Private Address – The first seven bits of a ULA are always 1111110, which means the eighth bit can be either a 0 or a 1. Therefore, a ULA will always begin with the hexadecimal values of either FC (11111100) or FD (11111101). The IPv6 address of FC01::1 is an example of a ULA.
Link-local Unicast Address = Automatic Private IP Address – The first eight bits of a link-local address are always 11111110, which is the binary equivalent of the hexadecimal value of FE. The next four bits can be any binary value in the range from 1000 through 1011. Thus a link-local address will always begin with one of the following values: FE8 (111111101000), FE9 (111111101001), FEA (111111101010), or FEB (111111101011).
Multicast Address – Always starts with FF
Loopback address – ::1
Topic 101: System Architecture
101.1 Determine and configure hardware settings
- Weight: 2
- Description: Candidates should be able to determine and configure fundamental system hardware.
Key Knowledge Areas
- Enable and disable integrated peripherals.
- Configure systems with or without external peripherals such as keyboards.
- Differentiate between the various types of mass storage devices.
- Set the correct hardware ID for different devices, especially the boot device.
- Know the differences between coldplug and hotplug devices.
- Determine hardware resources for devices.
- Tools and utilities to list various hardware information (e.g. lsusb, lspci, etc.)
- Tools and utilities to manipulate USB devices
- Conceptual understanding of sysfs, udev, hald, dbus
Terms and Utilities
General System Information Tools/Utilities
- cat /var/log/messages — is the same as dmesg
- dmesg — kernel messages given during booting.
- tail -f /var/log/messages – shows last 10 lines and keep outputting new lines
- uname -a — brief OS and kernel information.
Memory Diagnostic Tools/Utilities
- cat /proc/meminfo — static information about your RAM
- top — real-time RAM and CPU utilization printout
- free — current memory/swap utilization.
CPU Diagnostic Tools/Utilities
- hwinfo –cpu — static information about your CPU
Disk and File System Diagnostic Tools/Utilities
- cat /etc/fstab — show configuration file for file system mounting.
- df -h — current disk space usage (“-h” gives human-readable output)
- du -h — determine how much disk space is being used by current working directory, or any directory you specify after the du command (as in df, the “-h” means human-readable)
- fdisk -l [/dev/hda] — show partition table(s), leave off device name to list all
- mount or cat /etc/mtab — show currently mounted file systems.
- hwinfo –block –short — show what hard drives are available on the system
Local Devices Diagnostic Tools/Utilities
- dmidecode — get all bios information, e.g. computer type.
- hwinfo –pci — list devices on the pci bus.
- hwinfo –scsi — list all scsi devices.
- hwinfo –usb — list all usb devices.
- lsdev — list all installed hardware.
- lspci — list devices on the pci bus.
- lsscsi — list all scsi devices.
- lsusb — list all usb devices.
- setserial -bg /dev/ttyS[0-9]* — list all active serial devices(/dev/ttyS*).
- lsmod — list kernel modules currently loaded.
- modprobe is a Linux program originally written by Rusty Russell and used to add a loadable kernel module (LKM) to the Linux kernel or to remove a LKM from the kernel.
Network Diagnostic Tools/Utilities
- Directory /proc/net/
- File arp: arp cache. Maps IP address to MAC address
- File dev: byte and packet statistics on a per device basis.
- File netstat: various statistics
- File tcp: established connections.
- Directory /proc/sys/net/ipv4/
- File: ip_forward: read/write. Whether or not the kernal will forward IP packets from one interface to another. This is turned on if you want the machine to work as a router or a firewall.
- ethtool $interface — show the card’s speed, capabilities and if a link is detected
- hwinfo –netcard — show the module name, driver activation command, network card name etc.
- ifconfig -a — show all current network interface information
- ifconfig $interface — show the information for $interface (usually something like ifconfig eth0)
- ping $host — use ping to determine if $host is alive on the network (for troubleshooting your local machine $host can equal “127.0.0.1” or “localhost“
- route -n — show routing table, using numerical addresses.
X-Windows Troubleshooting Tools/Utilities
- cat /var/log/XFree86.0.log — print out the XFree86 error log.
- Note that some systems do not store this log in /var/log. Use either locate XFree86.0.log or find / -name XFree86.0.log to find it.
- glxinfo — show the status of your OpenGL subsystem.
Conceptual understanding of sysfs, udev, hald, dbus
sysfs is a virtual file system provided by the Linux kernel. By using virtual files, sysfs exports information about various kernel subsystems, hardware devices and associated device drivers from the kernel’s device model to user space.
udev is a device manager for the Linux kernel. As the successor of devfsd and hotplug, udev primarily manages device nodes in the /dev directory.
hald (hald – HAL daemon) is a daemon that maintains a database of the devices connected to the system system in real-time. The daemon connects to the D-Bus system message bus to provide an API that applications can use to discover, monitor and invoke operations on devices.
D-Bus is a message bus system, a simple way for applications to talk to one another. In addition to interprocess communication, D-Bus helps coordinate process lifecycle; it makes it simple and reliable to code a “single instance” application or daemon, and to launch applications and daemons on demand when their services are needed.