Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Can somebody tell me or point me a link which exactly tells what are the programs or process that gets execututed when a linux start. ie starting from the grub (linux bootloader)

You can choose your favorite flavor.

share|improve this question

migrated from serverfault.com Aug 2 '10 at 22:36

This question came from our site for professional system and network administrators.

    
Thanks everybody for your answers. Great answers! –  nepsdotin Aug 3 '10 at 3:43

3 Answers 3

up vote 1 down vote accepted

RHEL3/4/5:

  1. grub
  2. kernel loaded (defined by grub)
  3. kernel loads and mounts the initrd defined by grub
  4. kernel looks for and runs some stuff from initrd (generally just enough to get the modules needed to mount your root filesystem)
  5. initrd and/or kernel mount /
  6. /sbin/init is run
  7. init parses /etc/inittab, gets argument about what runlevel to be in and uses that or the default to decide which items to run. Normally that would be "/etc/rc.d/rc.sysinit" first, then "/etc/rc.d/rc 3". It also runs a /sbin/mingetty for the first 6 ttys.
  8. /etc/rc.d/rc.sysinit has all the fsck stuff and mounts all the other non-network filesystems
  9. "/etc/rc.d/rc 3" runs everything in /etc/rc3.d with a "K" starting the name with a "stop" param and everything with an "S" starting the name with a "start" param (these are symlinks to /etc/init.d scripts), in numerical order. Those scripts start the network, start iptables, mount network filesystems and start up all the other services.

In Ubuntu 10 and RHEL6(beta for now), the classic init has been replaced with "Upstart" which uses an /etc/init directory instead of /etc/inittab. /etc/init has a bunch of individual files with configuration of what they do and what conditions cause them to run. One of those is equivalent to /etc/rc.d/rc.sysinit, most of the rest are equivalent to the /etc/init.d scripts.

share|improve this answer

The boot process, following kernel startup is actually fairly simple. The kernel starts init, which parses /etc/inittab and starts everything else via scripts. These scripts start up the various daemon programs that might be running in the background during normal system operation. init also spawns any getty processes, which service user logons on the console (typically) and sometimes other interfaces (serial, most often).

Different distributions of Linux use different methods for identifying the scripts and their order to be executed (somestiems differentiating for a given runlevel if it's a SysV style init). The Wikipedia page for init can give you more detail, but basically it breaks down into style choices for the method of storing / referencing the scripts that init will call. The kernel itself is agnostic to the type of init conventions used-- it just starts init as the first user-level process.

In a SysV-style init system, a runlevel (basically, a method to allow the system to be booted in a variety of potential startup configurations. You can analogize to Windows "Hardware Profiles", "Safe Mode", etc, if you're familiar with Windows.) determines what scripts are executed. In a BSD-style init system, a series of rc scripts determine what starts on each boot.

Some distributions start init out of an initial RAM disk. The initrd is a filesystem used during boot to load kernel modules and bootstrap the system to the point where the "real" root filesystem can be mounted and accessed.

share|improve this answer

On most Linuxes the first process that gets started is /sbin/init which then uses the file /etc/inittab (man) to start other processes.

If you are using an Ubuntu dirivetive you may be using upstart the first binary is also called /sbin/init but files in /etc/init/ are used to configure the startup behavior.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.