Tirunelveli Tech Community

The 10-Second Mystery:
How Your Computer
Wakes Up

ஒரு பட்டன். பத்து கைமாற்றம்.

TIRUNELVELI TECH COMMUNITYMEETUP #02
THE WHOLE TALK, ONCE

Ten runners, one baton

PSU
UEFI
KEYS
GRUB
KERNEL
INITRD
ROOT
SYSTEMD
UDEV
LOGIN

பேட்டனை கைவிட்டா, கருப்பு திரை.

Tirunelveli Tech Community02
THE ONE IDEA

Do one job. Hand over. Vanish.

RUNNER 1
does its job
RUNNER 2
takes the baton
RUNNER 3
still waiting

எல்லாரும் கொஞ்சம் வேலை. அப்புறம் அடுத்த ஆளுக்கு.

Tirunelveli Tech Community03
SECTION ONE
01

Electricity

சாஃப்ட்வேர் வர முன்னாடி, கரண்ட்.

Tirunelveli Tech Community04
01 / 10  ·  POWER SUPPLY

The button is a doorbell

கரண்ட் சரியா இருந்தா தான் CPU கண்ண திறக்கும்.

YOUR THUMB
PS_ON#
RAILS COMING UP
12V
5V
3.3V
PWR_OK"rails steady, you can start"
CPU
C
held in reset
fetch 0xFFFFFFF0
HANDS OVER TOCPU, out of reset
Tirunelveli Tech Community05
02 / 10  ·  UEFI FIRMWARE

Attendance before anything else

வீட்ல யாரு யாரு இருக்காங்கனு முதல்ல பாத்துக்கும்.

FIRST INSTRUCTION
SPI flash chip
on the motherboard
NOT YET
your SSD
still fully asleep
ROLL CALL
RAMtimings trained, size counted
CORESone wakes the rest
PCIeevery slot walked and counted
ACPItables written for the OS to read
\EFI\ubuntu\grubx64.efi
HANDS OVER TOOne .efi file on the ESP
Tirunelveli Tech Community06
03 / 10  ·  SECURE BOOT

The only bouncer in the chain

ஐடி கார்டு காட்டுங்க. இல்லனா உள்ள விடமாட்டாங்க.

db KEYS
grubx64.efi
signed · key in db
totally-legit.efi
unsigned · no key
Security Violation
mokutil --sb-statesbctl status
HANDS OVER TOA loader it trusts
Tirunelveli Tech Community07

Interval

Interval meme: Power Good, POST, Secure Boot
Tirunelveli Tech Community08
SECTION TWO
02

The disk

இப்போ தான் அசல் வேலை ஆரம்பம்.

Tirunelveli Tech Community09
04 / 10  ·  BOOTLOADER

The menu nobody reads

மூணு செகண்ட் காட்டும். யாரும் படிக்கவே மாட்டாங்க.

ON DISK · /boot
vmlinuz
initramfs.img
grub.cfg
*Ubuntu
Advanced options
Memory test
BOOTING IN31↵ Enter
IN RAM
vmlinuz
initramfs.img
root=UUID=8f2c.. ro quiet
vmlinuz
initramfs.img
HANDS OVER TOThe kernel, now in memory
Tirunelveli Tech Community10
05 / 10  ·  KERNEL

A zip file that opens itself

தானா திறந்து, தானே வேலை ஆரம்பிக்கும்.

vmlinuz · 13 MB compressed
unpacked itself · 50 MB in RAM
page tables
memory mapped
scheduler
time slicing on
SMP cores
all brought up
Decompressing Linux... done.
Booting the kernel._
CAN IT READ THE DISK?
nvme0
the driver it needs
is not inside it
HANDS OVER TO/init, inside the initramfs
Tirunelveli Tech Community11
06 / 10  ·  INITRAMFS

A rented room in RAM

வாடகை வீடு. சொந்த வீடு கிடைக்குற வரைக்கும்.

IN RAM · TEMPORARY
tiny userspace + drivers
nvme
ahci
dm-crypt
lvm
waiting for root device...
ON DISK · REAL, LOCKED
/dev/nvme0n1p3 · luks
/dev/mapper/root · open
passphrase accepted
mount -o ro /dev/mapper/root /sysroot
HANDS OVER TOThe real root, now readable
Tirunelveli Tech Community12
07 / 10  ·  SWITCH_ROOT

Same seat, new person

வீடு மாறுது. ஆனா PID 1 அதே ஆளு.

RAM · THE RENTED ROOM
/init
memory handed back, room empty
DISK · THE REAL HOUSE
/sbin/init → systemd
/ is now the real root
1PID · SAME PROCESS
exec switch_root / /sbin/init
HANDS OVER TOsystemd, on the real disk
Tirunelveli Tech Community13

Interval, round two

Interval meme: GRUB, Kernel, initramfs
Tirunelveli Tech Community14
SECTION THREE
03

Userspace

இப்போ எல்லாமே சாதாரண புரோகிராம் தான்.

Tirunelveli Tech Community15
08 / 10  ·  SYSTEMD

Queue vs everyone at once

ரேஷன் கடை கியூ இல்ல. எல்லாரும் ஒண்ணாவே கிளம்பணும்.

OLD SysV INIT · ONE AFTER ANOTHER
total: everything added up
SYSTEMD · ALL AT ONCE, THEN ONE GOAL
journald
dbus
NetworkManager
bluetooth
gdm
graphical
.target
reached
HANDS OVER TOEvery service, together
Tirunelveli Tech Community16
09 / 10  ·  UDEV

The kernel shouts, udev answers

எல்லாரும் எழுந்துட்டாங்களானு பாக்குற வேலை.

KERNEL
uevent
"found something"
add nvme0n1
add usb1
add card0
UDEV RULE
load module
push firmware
make node
/dev/nvme0
/dev/sda
/dev/input/event4
/dev/snd
/dev/dri/card0 · GPU firmware loaded
HANDS OVER TOA screen that can actually draw
Tirunelveli Tech Community17
10 / 10  ·  DISPLAY MANAGER

gdm asks. PAM decides.

இதுக்கு தான் இந்த எல்லா வேலையும்.

nellai
••••••••|
gdm greeter
user + password →
← authenticated ✓
PAM
shadow
fingerprint
ldap
the actual decision
HANDS OVER TOYou
Tirunelveli Tech Community18
DEBUGGING, THE SHORT VERSION

Which runner dropped the baton?

Security Violation
_
Runner 3 · Secure Boot
Unsigned loader. Sign it or turn it off.
Gave up waiting for root device
(initramfs) _|
Runner 6 · initramfs
Wrong root=, or the driver is missing.
Kernel panic - not syncing:
Attempted to kill init!
PID: 1
Runner 7 · switch_root
PID 1 died. Nobody is left to run.

எர்ரர் மெசேஜ் படிங்க. யாரு பேட்டனை கைவிட்டாங்கனு அது சொல்லும்.

Tirunelveli Tech Community19

Last interval

Interval meme: systemd, udev, Greeter
Tirunelveli Tech Community20
MID-RANGE LAPTOP, NVME DISK

Where the seconds go

Firmware, POST
4.2 s
GRUB menu
1.0 s
Kernel
0.8 s
initramfs
0.7 s
systemd, services
2.1 s
Greeter on screen
0.5 s

நீங்க திட்டுற லினக்ஸ் இல்ல. நேரம் ஃபர்ம்வேர்ல போகுது.

Tirunelveli Tech Community21
SAME SHAPE, OTHER NAMES

Windows runs the same relay

LINUX
WINDOWS
grubx64.efi
bootmgfw.efi
vmlinuz
ntoskrnl.exe
initramfs
boot-start drivers
systemd
smss.exe, wininit.exe
gdm greeter
winlogon.exe

பேரு வேறு. வேலை ஒண்ணு தான்.

Tirunelveli Tech Community22
THAT IS THE WHOLE TRICK
10

handoffs,
one button

நீங்க பட்டன் பிரஸ் பண்ணீங்க. பத்து பேரு வேலை முடிச்சாங்க. நன்றி.

TRY IT TONIGHT
systemd-analyze blame
Tirunelveli Tech Community
CC BY 4.0

Talk by Ebrahim Nihal