Introduction
This lesson is about the system after boot.
Linux is not just "on" or "off". It can be in different system states:
- normal multi-user mode
- graphical mode
- rescue mode
- emergency mode
- shutdown or reboot
Older Linux systems talked about runlevels. Modern systemd-based systems talk about targets.
For LPIC-1, you should understand both ideas.
Keep this short mental model:
PID 1 controls the system state -> runlevels or targets describe that state -> shutdown and reboot change that state safely
What you should be able to do after this lesson:
- Identify the init system.
- Check the current or default runlevel/target.
- Switch to another state temporarily.
- Change the default state for the next boot.
- Shut down or reboot safely.
- Recognize SysVinit, systemd, and Upstart.
Step 1: Identify the Init System
Everything here starts with one question:
Who is PID 1?
Check it with:
ps -p 1 -o comm=
Common results:
systemdinit
Why this matters:
systemduses targets andsystemctl- SysVinit uses runlevels and tools such as
initortelinit - older Upstart-based systems also often appear as
init, but they manage jobs withinitctl
Runlevels vs Targets
The idea is the same in both worlds:
a system state is a bundle of behavior
Examples:
- text-only multi-user mode
- graphical mode
- rescue mode
- reboot mode
Simple translation
- SysVinit usually uses numbers such as
3or5 - systemd usually uses names such as
multi-user.targetorgraphical.target
You do not need to fear the naming difference. They solve the same problem.
systemd Targets
Most modern Linux distributions use systemd.
Check the default target
systemctl get-default
Example output:
graphical.target
This means the system normally boots into graphical mode.
See active targets right now
systemctl list-units --type=target --state=active
It is normal to see more than one active target.
Temporarily switch target
Use this when you want to change state right now:
sudo systemctl isolate <target>
Common examples:
sudo systemctl isolate multi-user.targetsudo systemctl isolate graphical.targetsudo systemctl isolate rescue.targetsudo systemctl isolate emergency.target
What is the difference between rescue and emergency?
rescue.target
- minimal system
- useful for maintenance
- still more complete than emergency mode
emergency.target
- even smaller environment
- very limited
- often used when normal startup is badly broken
Change the default target for future boots
sudo systemctl set-default <target>
systemctl get-default
Example:
sudo systemctl set-default multi-user.target
This means the next boot should land in text mode instead of graphical mode.
Mapping: Runlevels to Targets
This mapping helps a lot in the exam:
- Runlevel
0->poweroff.target - Runlevel
1->rescue.target - Runlevel
3->multi-user.target - Runlevel
5->graphical.target - Runlevel
6->reboot.target
It is not a perfect one-to-one copy of history, but it is the right beginner picture.
SysVinit Runlevels
Older systems, older books, and many exam questions still use runlevels.
Check the current runlevel
runlevel
Example output:
N 5
How to read it:
N= previous runlevel5= current runlevel
Change runlevel
sudo telinit <runlevel>
You may also see:
sudo init <runlevel>
Common meanings
0= halt or power off1= single-user or maintenance mode3= multi-user text mode5= multi-user graphical mode6= reboot
Runlevels 2, 3, 4, and 5 can vary by distribution, but the meanings above are the common exam picture.
SysVinit Files You Should Recognize
/etc/inittab
This classic file can define the default runlevel.
Example line:
id:3:initdefault:
/etc/init.d/
This directory contains service scripts.
/etc/rcX.d/
These are runlevel-specific links.
Simple rule:
S*links start servicesK*links stop services
Reload inittab
After editing /etc/inittab, you may see:
sudo telinit q
Upstart Awareness
Upstart is not the main init system on most modern Linux distributions, but LPIC still expects you to recognize it.
In plain words
Upstart is an event-based init system. It manages jobs instead of systemd units or classic SysV runlevels.
Common location
/etc/init/*.conf
Basic commands to recognize
initctl list | head
status <job>
start <job>
stop <job>
What you need to remember for the exam:
systemd-> units and targets- SysVinit -> scripts and runlevels
- Upstart -> jobs
Safe Shutdown and Reboot
The important idea is this:
a safe shutdown is not "cut the power"
Linux should:
- stop services
- sync and unmount filesystems
- then power off or reboot
Modern commands with systemd
sudo systemctl poweroff
sudo systemctl reboot
Classic shutdown command
sudo shutdown -h now
sudo shutdown -r now
How to read them:
-h= halt or power off-r= rebootnow= do it immediately
Schedule shutdown or reboot
sudo shutdown -h +10 "System maintenance"
sudo shutdown -r 23:30 "Planned reboot"
Meaning:
+10= in 10 minutes23:30= at 23:30- the message is shown to logged-in users
Cancel a scheduled shutdown
sudo shutdown -c
Tell users what is happening
Sometimes you want to warn users even without scheduling a shutdown:
echo "System maintenance in 5 minutes" | wall
wall means "write to all".
Classic command names you may still see
You may also meet:
rebootpoweroffhalt
The exam-friendly mindset is:
- know these names
- prefer
shutdownorsystemctlwhen you want clear and safe behavior
ACPI and acpid
ACPI is related to power events such as:
- pressing the power button
- laptop lid events
- sleep-related signals
On some systems, acpid handles these events.
Quick awareness check:
systemctl status acpid --no-pager
You do not need deep ACPI internals here. Just know that it is connected to power events.
Properly Terminating Processes
Sometimes a process does not stop when it should. You should prefer a gentle stop first.
Find a process
pgrep -a <name> | head
ps aux | head
Stop it gently
sudo kill -15 <pid>
This sends SIGTERM.
It asks the process to stop cleanly.
Force stop as a last resort
sudo kill -9 <pid>
This sends SIGKILL.
Use it only when the process refuses to stop normally.
By name instead of PID
sudo pkill -15 <name>
sudo killall -15 <name>
For the exam, the core idea is:
SIGTERMfirst,SIGKILLonly if needed
Practice Step by Step
1) Switch from graphical mode to text mode for this session
- Check PID 1:
ps -p 1 -o comm= - Check the default target:
systemctl get-default - Switch now:
sudo systemctl isolate multi-user.target - If needed, return:
sudo systemctl isolate graphical.target
2) Change the default boot state to text mode
- Check current default:
systemctl get-default - Set a new default:
sudo systemctl set-default multi-user.target - Verify:
systemctl get-default
3) Schedule a reboot and then cancel it
- Schedule:
sudo shutdown -r +5 "Planned reboot" - Optionally warn users:
echo "Planned reboot in 5 minutes" | wall - Cancel:
sudo shutdown -c
4) Stop a stuck process the safe way
- Find it:
pgrep -a <name> - Try graceful stop:
sudo kill -15 <pid> - Only if needed:
sudo kill -9 <pid>
Cheat Sheet
ps -p 1 -o comm== identify the init systemsystemctl get-default= show the default targetsystemctl isolate <target>= switch target nowsystemctl set-default <target>= change default target for next bootrunlevel= show current runleveltelinit <runlevel>orinit <runlevel>= switch runlevel/etc/inittab= classic SysVinit configuration file/etc/init.d/= classic service scripts/etc/rcX.d/= runlevel linkstelinit q= reloadinittab/etc/init/*.conf= Upstart job filesinitctl list= list Upstart jobsshutdown -h now= power off nowshutdown -r now= reboot nowshutdown -h +10 "message"= schedule shutdownshutdown -c= cancel scheduled shutdownwall= send a message to all logged-in userskill -15= graceful stopkill -9= forced stoppkillandkillall= stop by namesystemctl status acpid= check ACPI event handling service
Test Your Knowledge
Complete the quiz to assess your understanding of this course's concepts.
