SlideShare a Scribd company logo
2
Most read
6
Most read
Booting Linux &
Runlevels
Understanding the Boot Process
& the different runlevels.
By John Troon
Extracting Information about the
Boot Process
● To view information logged by the Linux kernel
and modules stored in the kernel ring buffer.
● dmesg
● dmesg | less
● dmesg > boot.messages
● cat /var/log/dmesg
● system logger ( syslogd )
Locating & Interpreting Boot
Messages
● Use less and Its search functions
● Look for Hardware type names (SCSI/USB etc)
● Look for Hardware Chipset names
● Study the output from a working System
The Boot Process
 Going to the nitty gritty details of the boot process is complex.
Below is a high-level view of the boot process.
● Power the machine & CPU runs the firmware.
●
The firmware performs some tasks.
●
Boot-loader takes over from the firmware & loads a kernel.
●
Linux kernel takes over,initializing devices, mounting the root
partition & executes /sbin/init
●
The initial program gets the process ID (PID) of 1. Commonly,
/sbin/init reads the /etc/inittab
http://www.linuxdevcenter.com/pub/a/linux/excerpts/linux_kernel/ho
w_computer_boots.html
Dealing with Runlevels and the
Initialization Process
● Linux relies on runlevels (0-6) to determine what features are available.
● 0 - A transitional runlevel, on/off (shuts down).
● 1,s, or S - Single-user mode. Used for low-level system maintenance
● 2 - On Debian and its derivatives, a full multi-user mode with X.
Undefined in others.
● 3 – In most distributions, a full multi-user mode with a console.
● 4 - Usually undefined by default and therefore available for
customization.
● 5 – In most distributions, the same behavior as runlevel 3 with the
addition of having X.
● 6 - Also a transitional runlevel. Used to reboot the system.
Identifying the Services in a Runlevel
● There are two main ways to affect what
programs run when you enter a new SysV
runlevel.
1) add or delete entries in your /etc/inittab file
2) the SysV Startup Scripts
Distributions based on Upstart and systemd often
provide startup scripts that are named and work
much like on SysV-based computers; however, whe
the computer boots, it may use other startup
methods, as described later, in “Using Alternative
Boot Systems.”
Managing Runlevel Services
● # chkconfig –list
● # chkconfig --list nfs-common
● # chkconfig --level 23 nfs-common on
● # chkconfig --add nfs-common
Checking Your Runlevel
1) Checking and changingyour default runlevel.
# grep :initdefault: /etc/inittab
Edit the initdefault line in /etc/inittab & change
the runlevel field to the value you want.
2) Determining Your Current Runlevel : # runlevel
The fi rst character is the previous runlevel.
When the character is N , this means the
system hasn’t switched runlevels since booting.
Changing Runlevels on a Running
System
● Changing Runlevels with init or telinit
The init process is the fi rst process run by the
Linux kernel, but you can also use it to have the
system reread the /etc/inittab fi le and
implement changes it fi nds there or to
changeto a new runlevel.
● # init 1 - reserved for single-user mode
● # init 6 - reboot the system
A variant of init is telinit
● This program can take a runlevel number just like init to
change to that runlevel.
● It can also take the Q or q option to have the tool reread
/etc/inittab and implement any changes it finds there.
● Thus, if you’ve made a change to the runlevel in
/etc/inittab, you can immediately implement that change by
typing telinit q .
● The Upstart and systemd tools provide init and telinit
commands that work much as they do on SysV-based
computers.
Changing Runlevels with shutdown
● shutdown is invoked with a time:
# shutdown now
● The now parameter causes the change to occur
immediately. Other possible time formats include hh:mm ,
for a time in 24-hour format.
● -r reboots, -H halts, -P powers it off
● shutdown -r +10 to reboot the system in 10 min
● shutdown -h +15 “system going down for maintenance”
● shutdown -c “never mind” -c option to cancel it.
halt, reboot, and powerof
Three additional shortcut commands are halt ,
reboot , and poweroff .
In reality, reboot and poweroff are usually symbolic
links to halt . This command behaves differently
depending on the name with which it’s called.
As you might expect, these commands halt the
system (shut it down without powering it off), reboot
it, or shut it down and (on hardware that supports
this feature) turn off the power, respectively.
EXERCISE 5.1
● Page 248
● Changing Runlevels
Question(s)?
John Troon
Email: troon@linuxmail.org
Twitter: @johntroony

More Related Content

What's hot (20)

PPTX
Linux Device Tree
艾鍗科技
 
PDF
File System Hierarchy
sritolia
 
PPTX
Linux Memory Management
Ni Zo-Ma
 
PDF
Introduction to yocto
Alex Gonzalez
 
PDF
プロセスとコンテキストスイッチ
Kazuki Onishi
 
PDF
Block Drivers
Anil Kumar Pugalia
 
PPTX
Linux Initialization Process (2)
shimosawa
 
PPTX
Linux Kernel I/O Schedulers
RajKumar Rampelli
 
ODP
Linux commands
Balakumaran Arunachalam
 
PDF
Namespaces and cgroups - the basis of Linux containers
Kernel TLV
 
PDF
QEMU Disk IO Which performs Better: Native or threads?
Pradeep Kumar
 
ODP
SystemV vs systemd
All Things Open
 
PDF
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
Adrian Huang
 
PDF
Kernel Module Programming
Saurabh Bangad
 
PPTX
Linux kernel
Goutam Sahoo
 
PDF
The linux networking architecture
hugo lu
 
PDF
The Linux Kernel Implementation of Pipes and FIFOs
Divye Kapoor
 
PDF
Linux commands
debashis rout
 
PDF
Linux Kernel - Virtual File System
Adrian Huang
 
Linux Device Tree
艾鍗科技
 
File System Hierarchy
sritolia
 
Linux Memory Management
Ni Zo-Ma
 
Introduction to yocto
Alex Gonzalez
 
プロセスとコンテキストスイッチ
Kazuki Onishi
 
Block Drivers
Anil Kumar Pugalia
 
Linux Initialization Process (2)
shimosawa
 
Linux Kernel I/O Schedulers
RajKumar Rampelli
 
Linux commands
Balakumaran Arunachalam
 
Namespaces and cgroups - the basis of Linux containers
Kernel TLV
 
QEMU Disk IO Which performs Better: Native or threads?
Pradeep Kumar
 
SystemV vs systemd
All Things Open
 
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
Adrian Huang
 
Kernel Module Programming
Saurabh Bangad
 
Linux kernel
Goutam Sahoo
 
The linux networking architecture
hugo lu
 
The Linux Kernel Implementation of Pipes and FIFOs
Divye Kapoor
 
Linux commands
debashis rout
 
Linux Kernel - Virtual File System
Adrian Huang
 

Similar to Linux : Booting and runlevels (20)

PPT
101 1.3 runlevels , shutdown, and reboot
Acácio Oliveira
 
PPTX
2- System Initialization in Red Hat
Shafaan Khaliq Bhatti
 
PDF
LISA15: systemd, the Next-Generation Linux System Manager
Alison Chaiken
 
PDF
linux monitoring and performance tunning
iman darabi
 
PPT
Linux Booting Process
Rishabh5121993
 
PDF
Write a program in C or C++ which simulates CPU scheduling in an opera.pdf
sravi07
 
PPTX
Linux startup
Amin Hashemi
 
ODP
Optimizing Linux Servers
Davor Guttierrez
 
PDF
Pdf c1t tlawaxb
Susant Sahani
 
PPTX
UNIX Notes
PandurangBiradar2
 
PDF
OS - Process Concepts
Mukesh Chinta
 
PDF
Lec 3
mohamed ali
 
PDF
Linux Server Deep Dives (DrupalCon Amsterdam)
Amin Astaneh
 
PDF
Your first dive into systemd!
Etsuji Nakai
 
DOCX
Project Guide for Modifying Kernel Source
232083
 
DOCX
Programming Assignment #2CSci 430 Spring 2019Dates.docx
stilliegeorgiana
 
DOCX
Programming Assignment #2CSci 430 Spring 2019Dates.docx
denneymargareta
 
PPT
Linux
Kavi Bharathi R
 
PDF
UNIT - 3 PPT(Part- 1)_.pdf
AyushSharma651966
 
PDF
Operating System-Concepts of Process
Shipra Swati
 
101 1.3 runlevels , shutdown, and reboot
Acácio Oliveira
 
2- System Initialization in Red Hat
Shafaan Khaliq Bhatti
 
LISA15: systemd, the Next-Generation Linux System Manager
Alison Chaiken
 
linux monitoring and performance tunning
iman darabi
 
Linux Booting Process
Rishabh5121993
 
Write a program in C or C++ which simulates CPU scheduling in an opera.pdf
sravi07
 
Linux startup
Amin Hashemi
 
Optimizing Linux Servers
Davor Guttierrez
 
Pdf c1t tlawaxb
Susant Sahani
 
UNIX Notes
PandurangBiradar2
 
OS - Process Concepts
Mukesh Chinta
 
Lec 3
mohamed ali
 
Linux Server Deep Dives (DrupalCon Amsterdam)
Amin Astaneh
 
Your first dive into systemd!
Etsuji Nakai
 
Project Guide for Modifying Kernel Source
232083
 
Programming Assignment #2CSci 430 Spring 2019Dates.docx
stilliegeorgiana
 
Programming Assignment #2CSci 430 Spring 2019Dates.docx
denneymargareta
 
UNIT - 3 PPT(Part- 1)_.pdf
AyushSharma651966
 
Operating System-Concepts of Process
Shipra Swati
 
Ad

Recently uploaded (20)

PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PPTX
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
PDF
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
The Future of Artificial Intelligence (AI)
Mukul
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
Ad

Linux : Booting and runlevels

  • 1. Booting Linux & Runlevels Understanding the Boot Process & the different runlevels. By John Troon
  • 2. Extracting Information about the Boot Process ● To view information logged by the Linux kernel and modules stored in the kernel ring buffer. ● dmesg ● dmesg | less ● dmesg > boot.messages ● cat /var/log/dmesg ● system logger ( syslogd )
  • 3. Locating & Interpreting Boot Messages ● Use less and Its search functions ● Look for Hardware type names (SCSI/USB etc) ● Look for Hardware Chipset names ● Study the output from a working System
  • 4. The Boot Process  Going to the nitty gritty details of the boot process is complex. Below is a high-level view of the boot process. ● Power the machine & CPU runs the firmware. ● The firmware performs some tasks. ● Boot-loader takes over from the firmware & loads a kernel. ● Linux kernel takes over,initializing devices, mounting the root partition & executes /sbin/init ● The initial program gets the process ID (PID) of 1. Commonly, /sbin/init reads the /etc/inittab http://www.linuxdevcenter.com/pub/a/linux/excerpts/linux_kernel/ho w_computer_boots.html
  • 5. Dealing with Runlevels and the Initialization Process ● Linux relies on runlevels (0-6) to determine what features are available. ● 0 - A transitional runlevel, on/off (shuts down). ● 1,s, or S - Single-user mode. Used for low-level system maintenance ● 2 - On Debian and its derivatives, a full multi-user mode with X. Undefined in others. ● 3 – In most distributions, a full multi-user mode with a console. ● 4 - Usually undefined by default and therefore available for customization. ● 5 – In most distributions, the same behavior as runlevel 3 with the addition of having X. ● 6 - Also a transitional runlevel. Used to reboot the system.
  • 6. Identifying the Services in a Runlevel ● There are two main ways to affect what programs run when you enter a new SysV runlevel. 1) add or delete entries in your /etc/inittab file 2) the SysV Startup Scripts Distributions based on Upstart and systemd often provide startup scripts that are named and work much like on SysV-based computers; however, whe the computer boots, it may use other startup methods, as described later, in “Using Alternative Boot Systems.”
  • 7. Managing Runlevel Services ● # chkconfig –list ● # chkconfig --list nfs-common ● # chkconfig --level 23 nfs-common on ● # chkconfig --add nfs-common
  • 8. Checking Your Runlevel 1) Checking and changingyour default runlevel. # grep :initdefault: /etc/inittab Edit the initdefault line in /etc/inittab & change the runlevel field to the value you want. 2) Determining Your Current Runlevel : # runlevel The fi rst character is the previous runlevel. When the character is N , this means the system hasn’t switched runlevels since booting.
  • 9. Changing Runlevels on a Running System ● Changing Runlevels with init or telinit The init process is the fi rst process run by the Linux kernel, but you can also use it to have the system reread the /etc/inittab fi le and implement changes it fi nds there or to changeto a new runlevel. ● # init 1 - reserved for single-user mode ● # init 6 - reboot the system
  • 10. A variant of init is telinit ● This program can take a runlevel number just like init to change to that runlevel. ● It can also take the Q or q option to have the tool reread /etc/inittab and implement any changes it finds there. ● Thus, if you’ve made a change to the runlevel in /etc/inittab, you can immediately implement that change by typing telinit q . ● The Upstart and systemd tools provide init and telinit commands that work much as they do on SysV-based computers.
  • 11. Changing Runlevels with shutdown ● shutdown is invoked with a time: # shutdown now ● The now parameter causes the change to occur immediately. Other possible time formats include hh:mm , for a time in 24-hour format. ● -r reboots, -H halts, -P powers it off ● shutdown -r +10 to reboot the system in 10 min ● shutdown -h +15 “system going down for maintenance” ● shutdown -c “never mind” -c option to cancel it.
  • 12. halt, reboot, and powerof Three additional shortcut commands are halt , reboot , and poweroff . In reality, reboot and poweroff are usually symbolic links to halt . This command behaves differently depending on the name with which it’s called. As you might expect, these commands halt the system (shut it down without powering it off), reboot it, or shut it down and (on hardware that supports this feature) turn off the power, respectively.
  • 13. EXERCISE 5.1 ● Page 248 ● Changing Runlevels