[{"data":1,"prerenderedAt":1777},["ShallowReactive",2],{"page-\u002Flinux\u002F16-boot-process-and-runlevels":3},{"id":4,"title":5,"body":6,"description":16,"extension":1771,"meta":1772,"navigation":390,"path":1773,"seo":1774,"stem":1775,"__hash__":1776},"content\u002Flinux\u002F16-boot-process-and-runlevels.md","16 — Boot Process & Runlevels",{"type":7,"value":8,"toc":1746},"minimark",[9,13,17,22,203,207,274,322,326,337,407,412,480,484,491,511,590,594,650,653,746,750,844,892,896,940,944,947,982,988,993,1045,1049,1114,1121,1128,1135,1207,1215,1286,1290,1384,1388,1486,1490,1607,1611,1618,1742],[10,11,5],"h1",{"id":12},"_16-boot-process-runlevels",[14,15,16],"p",{},"Understanding the Linux boot process is essential for troubleshooting boot failures, configuring services, and recovering a broken system. This chapter covers the full path from power-on to login prompt: firmware (BIOS\u002FUEFI), bootloader (GRUB), kernel, initramfs, systemd, and targets.",[18,19,21],"h2",{"id":20},"the-boot-sequence","The Boot Sequence",[23,24,26],"code-wrapper",{"language":25},"bash",[27,28,32],"pre",{"className":29,"code":30,"language":25,"meta":31,"style":31},"language-bash shiki shiki-themes github-light github-dark","1. Power on\n   ↓\n2. Firmware (BIOS or UEFI) — POST, hardware init, find boot device\n   ↓\n3. Bootloader (GRUB) — load kernel + initramfs into RAM\n   ↓\n4. Kernel — initialize, load drivers (from initramfs), mount root filesystem\n   ↓\n5. initramfs — early userspace, mount real root, pivot_root\n   ↓\n6. systemd (PID 1) — start services, targets, login prompt\n   ↓\n7. Login\n","",[33,34,35,51,57,79,84,96,101,131,136,165,170,189,194],"code",{"__ignoreMap":31},[36,37,40,44,48],"span",{"class":38,"line":39},"line",1,[36,41,43],{"class":42},"sIsaT","1.",[36,45,47],{"class":46},"sJ6F3"," Power",[36,49,50],{"class":46}," on\n",[36,52,54],{"class":38,"line":53},2,[36,55,56],{"class":42},"   ↓\n",[36,58,60,63,66,70,73,76],{"class":38,"line":59},3,[36,61,62],{"class":42},"2.",[36,64,65],{"class":46}," Firmware",[36,67,69],{"class":68},"ssxIu"," (BIOS ",[36,71,72],{"class":46},"or",[36,74,75],{"class":46}," UEFI",[36,77,78],{"class":68},") — POST, hardware init, find boot device\n",[36,80,82],{"class":38,"line":81},4,[36,83,56],{"class":42},[36,85,87,90,93],{"class":38,"line":86},5,[36,88,89],{"class":42},"3.",[36,91,92],{"class":46}," Bootloader",[36,94,95],{"class":68}," (GRUB) — load kernel + initramfs into RAM\n",[36,97,99],{"class":38,"line":98},6,[36,100,56],{"class":42},[36,102,104,107,110,113,116,119,122,125,128],{"class":38,"line":103},7,[36,105,106],{"class":42},"4.",[36,108,109],{"class":46}," Kernel",[36,111,112],{"class":46}," —",[36,114,115],{"class":46}," initialize,",[36,117,118],{"class":46}," load",[36,120,121],{"class":46}," drivers",[36,123,124],{"class":68}," (from ",[36,126,127],{"class":46},"initramfs",[36,129,130],{"class":68},"), mount root filesystem\n",[36,132,134],{"class":38,"line":133},8,[36,135,56],{"class":42},[36,137,139,142,145,147,150,153,156,159,162],{"class":38,"line":138},9,[36,140,141],{"class":42},"5.",[36,143,144],{"class":46}," initramfs",[36,146,112],{"class":46},[36,148,149],{"class":46}," early",[36,151,152],{"class":46}," userspace,",[36,154,155],{"class":46}," mount",[36,157,158],{"class":46}," real",[36,160,161],{"class":46}," root,",[36,163,164],{"class":46}," pivot_root\n",[36,166,168],{"class":38,"line":167},10,[36,169,56],{"class":42},[36,171,173,176,179,182,186],{"class":38,"line":172},11,[36,174,175],{"class":42},"6.",[36,177,178],{"class":46}," systemd",[36,180,181],{"class":68}," (PID ",[36,183,185],{"class":184},"snvgF","1",[36,187,188],{"class":68},") — start services, targets, login prompt\n",[36,190,192],{"class":38,"line":191},12,[36,193,56],{"class":42},[36,195,197,200],{"class":38,"line":196},13,[36,198,199],{"class":42},"7.",[36,201,202],{"class":46}," Login\n",[18,204,206],{"id":205},"firmware-bios-or-uefi","Firmware — BIOS or UEFI",[208,209,210,226],"table",{},[211,212,213],"thead",{},[214,215,216,220,223],"tr",{},[217,218,219],"th",{},"Feature",[217,221,222],{},"BIOS",[217,224,225],{},"UEFI",[227,228,229,241,252,263],"tbody",{},[214,230,231,235,238],{},[232,233,234],"td",{},"Partition table",[232,236,237],{},"MBR (2 TB max)",[232,239,240],{},"GPT (8 ZB)",[214,242,243,246,249],{},[232,244,245],{},"Boot code",[232,247,248],{},"MBR (512 bytes)",[232,250,251],{},"EFI files on ESP",[214,253,254,257,260],{},[232,255,256],{},"Secure Boot",[232,258,259],{},"No",[232,261,262],{},"Yes (verify bootloader signature)",[214,264,265,268,271],{},[232,266,267],{},"Boot speed",[232,269,270],{},"Slower",[232,272,273],{},"Faster",[23,275,276],{"language":25},[27,277,279],{"className":29,"code":278,"language":25,"meta":31,"style":31},"# Complex Implementation: detect firmware type\n[ -d \u002Fsys\u002Ffirmware\u002Fefi ] && echo \"UEFI\" || echo \"BIOS\u002FLegacy\"\nefibootmgr                       # UEFI boot entries (UEFI only)\n",[33,280,281,287,314],{"__ignoreMap":31},[36,282,283],{"class":38,"line":39},[36,284,286],{"class":285},"sdCPZ","# Complex Implementation: detect firmware type\n",[36,288,289,292,296,299,302,305,308,311],{"class":38,"line":53},[36,290,291],{"class":68},"[ ",[36,293,295],{"class":294},"svdQ7","-d",[36,297,298],{"class":68}," \u002Fsys\u002Ffirmware\u002Fefi ] && ",[36,300,301],{"class":184},"echo",[36,303,304],{"class":46}," \"UEFI\"",[36,306,307],{"class":294}," ||",[36,309,310],{"class":184}," echo",[36,312,313],{"class":46}," \"BIOS\u002FLegacy\"\n",[36,315,316,319],{"class":38,"line":59},[36,317,318],{"class":42},"efibootmgr",[36,320,321],{"class":285},"                       # UEFI boot entries (UEFI only)\n",[18,323,325],{"id":324},"bootloader-grub","Bootloader — GRUB",[14,327,328,329,332,333,336],{},"GRUB loads the selected kernel (",[33,330,331],{},"vmlinuz-*",") and initramfs (",[33,334,335],{},"initrd.img-*",") into memory and passes boot parameters.",[23,338,339],{"language":25},[27,340,342],{"className":29,"code":341,"language":25,"meta":31,"style":31},"# Complex Implementation: add a kernel parameter (e.g., for recovery)\n# Edit \u002Fetc\u002Fdefault\u002Fgrub:\n# GRUB_CMDLINE_LINUX_DEFAULT=\"quiet splash systemd.unit=rescue.target\"\nsudo update-grub              # Debian\u002FUbuntu (generates grub.cfg)\nsudo grub2-mkconfig -o \u002Fboot\u002Fgrub2\u002Fgrub.cfg   # RHEL\u002FFedora\n\n# Anti-Pattern: editing \u002Fboot\u002Fgrub\u002Fgrub.cfg directly\n# It's GENERATED — update-grub overwrites it\n# Edit \u002Fetc\u002Fdefault\u002Fgrub (and \u002Fetc\u002Fgrub.d\u002F), then regenerate\n",[33,343,344,349,354,359,370,386,392,397,402],{"__ignoreMap":31},[36,345,346],{"class":38,"line":39},[36,347,348],{"class":285},"# Complex Implementation: add a kernel parameter (e.g., for recovery)\n",[36,350,351],{"class":38,"line":53},[36,352,353],{"class":285},"# Edit \u002Fetc\u002Fdefault\u002Fgrub:\n",[36,355,356],{"class":38,"line":59},[36,357,358],{"class":285},"# GRUB_CMDLINE_LINUX_DEFAULT=\"quiet splash systemd.unit=rescue.target\"\n",[36,360,361,364,367],{"class":38,"line":81},[36,362,363],{"class":42},"sudo",[36,365,366],{"class":46}," update-grub",[36,368,369],{"class":285},"              # Debian\u002FUbuntu (generates grub.cfg)\n",[36,371,372,374,377,380,383],{"class":38,"line":86},[36,373,363],{"class":42},[36,375,376],{"class":46}," grub2-mkconfig",[36,378,379],{"class":184}," -o",[36,381,382],{"class":46}," \u002Fboot\u002Fgrub2\u002Fgrub.cfg",[36,384,385],{"class":285},"   # RHEL\u002FFedora\n",[36,387,388],{"class":38,"line":98},[36,389,391],{"emptyLinePlaceholder":390},true,"\n",[36,393,394],{"class":38,"line":103},[36,395,396],{"class":285},"# Anti-Pattern: editing \u002Fboot\u002Fgrub\u002Fgrub.cfg directly\n",[36,398,399],{"class":38,"line":133},[36,400,401],{"class":285},"# It's GENERATED — update-grub overwrites it\n",[36,403,404],{"class":38,"line":138},[36,405,406],{"class":285},"# Edit \u002Fetc\u002Fdefault\u002Fgrub (and \u002Fetc\u002Fgrub.d\u002F), then regenerate\n",[408,409,411],"h3",{"id":410},"common-grub-parameters","Common GRUB Parameters",[208,413,414,424],{},[211,415,416],{},[214,417,418,421],{},[217,419,420],{},"Parameter",[217,422,423],{},"Effect",[227,425,426,436,446,456,466],{},[214,427,428,433],{},[232,429,430],{},[33,431,432],{},"quiet",[232,434,435],{},"Suppress kernel messages at boot",[214,437,438,443],{},[232,439,440],{},[33,441,442],{},"nomodeset",[232,444,445],{},"Don't load graphics drivers (for display issues)",[214,447,448,453],{},[232,449,450],{},[33,451,452],{},"systemd.unit=rescue.target",[232,454,455],{},"Boot to rescue mode (single-user)",[214,457,458,463],{},[232,459,460],{},[33,461,462],{},"init=\u002Fbin\u002Fbash",[232,464,465],{},"Bypass init (raw root shell — recovery only)",[214,467,468,473],{},[232,469,470],{},[33,471,472],{},"rw",[232,474,475,476,479],{},"Mount root read-write (default is ",[33,477,478],{},"ro"," initially)",[18,481,483],{"id":482},"initramfs-early-userspace","initramfs — Early Userspace",[14,485,486,487,490],{},"The ",[488,489,127],"strong",{}," is loaded into RAM by GRUB. It contains enough userspace to:",[492,493,494,498,501],"ol",{},[495,496,497],"li",{},"Load modules needed to see the root disk.",[495,499,500],{},"Mount the root filesystem.",[495,502,503,506,507,510],{},[33,504,505],{},"pivot_root"," into it and ",[33,508,509],{},"exec"," the real init (systemd).",[23,512,513],{"language":25},[27,514,516],{"className":29,"code":515,"language":25,"meta":31,"style":31},"# Regenerate after kernel or storage changes:\nsudo update-initramfs -u        # Debian\u002FUbuntu (current kernel)\nsudo dracut -f                  # RHEL\u002FFedora\n\n# Inspect:\nlsinitramfs \u002Fboot\u002Finitrd.img-$(uname -r) | grep ext4   # has ext4 module?\n",[33,517,518,523,536,549,553,558],{"__ignoreMap":31},[36,519,520],{"class":38,"line":39},[36,521,522],{"class":285},"# Regenerate after kernel or storage changes:\n",[36,524,525,527,530,533],{"class":38,"line":53},[36,526,363],{"class":42},[36,528,529],{"class":46}," update-initramfs",[36,531,532],{"class":184}," -u",[36,534,535],{"class":285},"        # Debian\u002FUbuntu (current kernel)\n",[36,537,538,540,543,546],{"class":38,"line":59},[36,539,363],{"class":42},[36,541,542],{"class":46}," dracut",[36,544,545],{"class":184}," -f",[36,547,548],{"class":285},"                  # RHEL\u002FFedora\n",[36,550,551],{"class":38,"line":81},[36,552,391],{"emptyLinePlaceholder":390},[36,554,555],{"class":38,"line":86},[36,556,557],{"class":285},"# Inspect:\n",[36,559,560,563,566,569,572,575,578,581,584,587],{"class":38,"line":98},[36,561,562],{"class":42},"lsinitramfs",[36,564,565],{"class":46}," \u002Fboot\u002Finitrd.img-",[36,567,568],{"class":68},"$(",[36,570,571],{"class":42},"uname",[36,573,574],{"class":184}," -r",[36,576,577],{"class":68},") ",[36,579,580],{"class":294},"|",[36,582,583],{"class":42}," grep",[36,585,586],{"class":46}," ext4",[36,588,589],{"class":285},"   # has ext4 module?\n",[18,591,593],{"id":592},"systemd-boot","systemd Boot",[23,595,596],{"language":25},[27,597,599],{"className":29,"code":598,"language":25,"meta":31,"style":31},"# Complex Implementation: analyze boot performance\nsystemd-analyze                   # total boot time\nsystemd-analyze blame              # services by startup time\nsystemd-analyze critical-chain    # the slow path\nsystemd-analyze plot > boot.svg    # visual timeline (open in browser)\n",[33,600,601,606,614,624,634],{"__ignoreMap":31},[36,602,603],{"class":38,"line":39},[36,604,605],{"class":285},"# Complex Implementation: analyze boot performance\n",[36,607,608,611],{"class":38,"line":53},[36,609,610],{"class":42},"systemd-analyze",[36,612,613],{"class":285},"                   # total boot time\n",[36,615,616,618,621],{"class":38,"line":59},[36,617,610],{"class":42},[36,619,620],{"class":46}," blame",[36,622,623],{"class":285},"              # services by startup time\n",[36,625,626,628,631],{"class":38,"line":81},[36,627,610],{"class":42},[36,629,630],{"class":46}," critical-chain",[36,632,633],{"class":285},"    # the slow path\n",[36,635,636,638,641,644,647],{"class":38,"line":86},[36,637,610],{"class":42},[36,639,640],{"class":46}," plot",[36,642,643],{"class":294}," >",[36,645,646],{"class":46}," boot.svg",[36,648,649],{"class":285},"    # visual timeline (open in browser)\n",[14,651,652],{},"Example:",[23,654,655],{"language":25},[27,656,658],{"className":29,"code":657,"language":25,"meta":31,"style":31},"$ systemd-analyze\nStartup finished in 5.123s (kernel) + 8.456s (userspace) = 13.579s\n\n$ systemd-analyze blame | head -5\n8.200s dev-sda1.device\n5.100s NetworkManager-wait-online.service    ← common culprit\n2.300s snapd.service\n",[33,659,660,668,691,695,713,721,738],{"__ignoreMap":31},[36,661,662,665],{"class":38,"line":39},[36,663,664],{"class":42},"$",[36,666,667],{"class":46}," systemd-analyze\n",[36,669,670,673,676,679,682,685,688],{"class":38,"line":53},[36,671,672],{"class":42},"Startup",[36,674,675],{"class":46}," finished",[36,677,678],{"class":46}," in",[36,680,681],{"class":46}," 5.123s",[36,683,684],{"class":68}," (kernel) + 8.456s (",[36,686,687],{"class":42},"userspace",[36,689,690],{"class":68},") = 13.579s\n",[36,692,693],{"class":38,"line":59},[36,694,391],{"emptyLinePlaceholder":390},[36,696,697,699,702,704,707,710],{"class":38,"line":81},[36,698,664],{"class":42},[36,700,701],{"class":46}," systemd-analyze",[36,703,620],{"class":46},[36,705,706],{"class":294}," |",[36,708,709],{"class":42}," head",[36,711,712],{"class":184}," -5\n",[36,714,715,718],{"class":38,"line":86},[36,716,717],{"class":42},"8.200s",[36,719,720],{"class":46}," dev-sda1.device\n",[36,722,723,726,729,732,735],{"class":38,"line":98},[36,724,725],{"class":42},"5.100s",[36,727,728],{"class":46}," NetworkManager-wait-online.service",[36,730,731],{"class":46},"    ←",[36,733,734],{"class":46}," common",[36,736,737],{"class":46}," culprit\n",[36,739,740,743],{"class":38,"line":103},[36,741,742],{"class":42},"2.300s",[36,744,745],{"class":46}," snapd.service\n",[18,747,749],{"id":748},"targets-the-modern-runlevels","Targets — The Modern Runlevels",[208,751,752,765],{},[211,753,754],{},[214,755,756,759,762],{},[217,757,758],{},"Target",[217,760,761],{},"Old Runlevel",[217,763,764],{},"Purpose",[227,766,767,780,792,805,818,831],{},[214,768,769,774,777],{},[232,770,771],{},[33,772,773],{},"poweroff.target",[232,775,776],{},"0",[232,778,779],{},"Shut down",[214,781,782,787,789],{},[232,783,784],{},[33,785,786],{},"rescue.target",[232,788,185],{},[232,790,791],{},"Single-user rescue (root only, minimal services)",[214,793,794,799,802],{},[232,795,796],{},[33,797,798],{},"multi-user.target",[232,800,801],{},"2, 3",[232,803,804],{},"Text mode (server default)",[214,806,807,812,815],{},[232,808,809],{},[33,810,811],{},"graphical.target",[232,813,814],{},"5",[232,816,817],{},"GUI (desktop default)",[214,819,820,825,828],{},[232,821,822],{},[33,823,824],{},"reboot.target",[232,826,827],{},"6",[232,829,830],{},"Reboot",[214,832,833,838,841],{},[232,834,835],{},[33,836,837],{},"emergency.target",[232,839,840],{},"—",[232,842,843],{},"Emergency mode (even more minimal than rescue)",[23,845,846],{"language":25},[27,847,849],{"className":29,"code":848,"language":25,"meta":31,"style":31},"systemctl get-default                 # show default (e.g., graphical.target)\nsudo systemctl set-default multi-user.target   # set text mode as default\nsudo systemctl isolate multi-user.target       # switch now (without reboot)\n",[33,850,851,862,878],{"__ignoreMap":31},[36,852,853,856,859],{"class":38,"line":39},[36,854,855],{"class":42},"systemctl",[36,857,858],{"class":46}," get-default",[36,860,861],{"class":285},"                 # show default (e.g., graphical.target)\n",[36,863,864,866,869,872,875],{"class":38,"line":53},[36,865,363],{"class":42},[36,867,868],{"class":46}," systemctl",[36,870,871],{"class":46}," set-default",[36,873,874],{"class":46}," multi-user.target",[36,876,877],{"class":285},"   # set text mode as default\n",[36,879,880,882,884,887,889],{"class":38,"line":59},[36,881,363],{"class":42},[36,883,868],{"class":46},[36,885,886],{"class":46}," isolate",[36,888,874],{"class":46},[36,890,891],{"class":285},"       # switch now (without reboot)\n",[18,893,895],{"id":894},"rescue-mode-vs-emergency-mode","Rescue Mode vs Emergency Mode",[208,897,898,910],{},[211,899,900],{},[214,901,902,905,907],{},[217,903,904],{},"Mode",[217,906,758],{},[217,908,909],{},"What's Running",[227,911,912,926],{},[214,913,914,919,923],{},[232,915,916],{},[488,917,918],{},"Rescue",[232,920,921],{},[33,922,786],{},[232,924,925],{},"Single-user, root shell, minimal services, filesystems mounted",[214,927,928,933,937],{},[232,929,930],{},[488,931,932],{},"Emergency",[232,934,935],{},[33,936,837],{},[232,938,939],{},"Single-user, root shell, almost nothing — root mounted read-only",[408,941,943],{"id":942},"booting-to-rescue-mode","Booting to Rescue Mode",[14,945,946],{},"At the GRUB menu:",[492,948,949,956,963,976],{},[495,950,951,952,955],{},"Press ",[33,953,954],{},"e"," to edit the default entry.",[495,957,958,959,962],{},"Find the line starting with ",[33,960,961],{},"linux",".",[495,964,965,966,968,969,971,972,975],{},"Append ",[33,967,452],{}," (or just ",[33,970,185],{}," or ",[33,973,974],{},"single",").",[495,977,951,978,981],{},[33,979,980],{},"Ctrl+X"," to boot.",[408,983,985,987],{"id":984},"initbinbash-last-resort",[33,986,462],{}," (Last Resort)",[14,989,965,990,992],{},[33,991,462],{}," to the kernel line. Bypasses systemd entirely — raw bash shell as PID 1, no services, no mounts (except root, read-only):",[23,994,995],{"language":25},[27,996,998],{"className":29,"code":997,"language":25,"meta":31,"style":31},"mount -o remount,rw \u002F       # make root writable\n# fix the problem...\nmount -o remount,ro \u002F       # clean unmount\nexec \u002Fsbin\u002Finit             # start systemd normally\n",[33,999,1000,1016,1021,1035],{"__ignoreMap":31},[36,1001,1002,1005,1007,1010,1013],{"class":38,"line":39},[36,1003,1004],{"class":42},"mount",[36,1006,379],{"class":184},[36,1008,1009],{"class":46}," remount,rw",[36,1011,1012],{"class":46}," \u002F",[36,1014,1015],{"class":285},"       # make root writable\n",[36,1017,1018],{"class":38,"line":53},[36,1019,1020],{"class":285},"# fix the problem...\n",[36,1022,1023,1025,1027,1030,1032],{"class":38,"line":59},[36,1024,1004],{"class":42},[36,1026,379],{"class":184},[36,1028,1029],{"class":46}," remount,ro",[36,1031,1012],{"class":46},[36,1033,1034],{"class":285},"       # clean unmount\n",[36,1036,1037,1039,1042],{"class":38,"line":81},[36,1038,509],{"class":184},[36,1040,1041],{"class":46}," \u002Fsbin\u002Finit",[36,1043,1044],{"class":285},"             # start systemd normally\n",[18,1046,1048],{"id":1047},"resetting-a-lost-root-password","Resetting a Lost Root Password",[23,1050,1051],{"language":25},[27,1052,1054],{"className":29,"code":1053,"language":25,"meta":31,"style":31},"# Complex Implementation: reset root password via GRUB\n# 1. Reboot, at GRUB menu press 'e'\n# 2. Find the 'linux' line, append: rw init=\u002Fbin\u002Fbash\n# 3. Ctrl+X to boot\n# 4. You're root, no password needed:\npasswd                         # set a new root password\n# On SELinux systems:\ntouch \u002F.autorelabel            # SELinux will relabel on next boot\nexec \u002Fsbin\u002Finit                # continue boot\n",[33,1055,1056,1061,1066,1071,1076,1081,1089,1094,1105],{"__ignoreMap":31},[36,1057,1058],{"class":38,"line":39},[36,1059,1060],{"class":285},"# Complex Implementation: reset root password via GRUB\n",[36,1062,1063],{"class":38,"line":53},[36,1064,1065],{"class":285},"# 1. Reboot, at GRUB menu press 'e'\n",[36,1067,1068],{"class":38,"line":59},[36,1069,1070],{"class":285},"# 2. Find the 'linux' line, append: rw init=\u002Fbin\u002Fbash\n",[36,1072,1073],{"class":38,"line":81},[36,1074,1075],{"class":285},"# 3. Ctrl+X to boot\n",[36,1077,1078],{"class":38,"line":86},[36,1079,1080],{"class":285},"# 4. You're root, no password needed:\n",[36,1082,1083,1086],{"class":38,"line":98},[36,1084,1085],{"class":42},"passwd",[36,1087,1088],{"class":285},"                         # set a new root password\n",[36,1090,1091],{"class":38,"line":103},[36,1092,1093],{"class":285},"# On SELinux systems:\n",[36,1095,1096,1099,1102],{"class":38,"line":133},[36,1097,1098],{"class":42},"touch",[36,1100,1101],{"class":46}," \u002F.autorelabel",[36,1103,1104],{"class":285},"            # SELinux will relabel on next boot\n",[36,1106,1107,1109,1111],{"class":38,"line":138},[36,1108,509],{"class":184},[36,1110,1041],{"class":46},[36,1112,1113],{"class":285},"                # continue boot\n",[14,1115,1116,1117,1120],{},"This is why ",[488,1118,1119],{},"physical\u002Fconsole access = root access"," — secure your physical servers and use disk encryption (LUKS).",[18,1122,1124,1127],{"id":1123},"fstab-issues-at-boot",[33,1125,1126],{},"fstab"," Issues at Boot",[14,1129,1130,1131,1134],{},"A bad ",[33,1132,1133],{},"\u002Fetc\u002Ffstab"," entry can drop you to emergency mode:",[23,1136,1137],{"language":25},[27,1138,1140],{"className":29,"code":1139,"language":25,"meta":31,"style":31},"# In emergency mode:\njournalctl -b | grep -i \"mount\\|fstab\"\nmount -o remount,rw \u002F\nnano \u002Fetc\u002Ffstab                # fix or comment the bad line\nmount -a                       # test\nsystemctl default              # continue boot\n",[33,1141,1142,1147,1165,1176,1187,1197],{"__ignoreMap":31},[36,1143,1144],{"class":38,"line":39},[36,1145,1146],{"class":285},"# In emergency mode:\n",[36,1148,1149,1152,1155,1157,1159,1162],{"class":38,"line":53},[36,1150,1151],{"class":42},"journalctl",[36,1153,1154],{"class":184}," -b",[36,1156,706],{"class":294},[36,1158,583],{"class":42},[36,1160,1161],{"class":184}," -i",[36,1163,1164],{"class":46}," \"mount\\|fstab\"\n",[36,1166,1167,1169,1171,1173],{"class":38,"line":59},[36,1168,1004],{"class":42},[36,1170,379],{"class":184},[36,1172,1009],{"class":46},[36,1174,1175],{"class":46}," \u002F\n",[36,1177,1178,1181,1184],{"class":38,"line":81},[36,1179,1180],{"class":42},"nano",[36,1182,1183],{"class":46}," \u002Fetc\u002Ffstab",[36,1185,1186],{"class":285},"                # fix or comment the bad line\n",[36,1188,1189,1191,1194],{"class":38,"line":86},[36,1190,1004],{"class":42},[36,1192,1193],{"class":184}," -a",[36,1195,1196],{"class":285},"                       # test\n",[36,1198,1199,1201,1204],{"class":38,"line":98},[36,1200,855],{"class":42},[36,1202,1203],{"class":46}," default",[36,1205,1206],{"class":285},"              # continue boot\n",[408,1208,1210,1211,1214],{"id":1209},"edge-case-nofail-prevents-boot-failure","Edge Case: ",[33,1212,1213],{},"nofail"," Prevents Boot Failure",[23,1216,1217],{"language":25},[27,1218,1220],{"className":29,"code":1219,"language":25,"meta":31,"style":31},"# NAIVE: mount without nofail → boot fails if device is absent\nUUID=abcd-1234  \u002Fmnt\u002Fusb  ext4  defaults  0  2\n# If \u002Fmnt\u002Fusb is absent → emergency mode\n\n# PRODUCTION: nofail lets boot continue\nUUID=abcd-1234  \u002Fmnt\u002Fusb  ext4  defaults,nofail  0  2\n",[33,1221,1222,1227,1253,1258,1262,1267],{"__ignoreMap":31},[36,1223,1224],{"class":38,"line":39},[36,1225,1226],{"class":285},"# NAIVE: mount without nofail → boot fails if device is absent\n",[36,1228,1229,1232,1235,1238,1241,1244,1247,1250],{"class":38,"line":53},[36,1230,1231],{"class":68},"UUID",[36,1233,1234],{"class":294},"=",[36,1236,1237],{"class":46},"abcd-1234",[36,1239,1240],{"class":42},"  \u002Fmnt\u002Fusb",[36,1242,1243],{"class":46},"  ext4",[36,1245,1246],{"class":46},"  defaults",[36,1248,1249],{"class":184},"  0",[36,1251,1252],{"class":184},"  2\n",[36,1254,1255],{"class":38,"line":59},[36,1256,1257],{"class":285},"# If \u002Fmnt\u002Fusb is absent → emergency mode\n",[36,1259,1260],{"class":38,"line":81},[36,1261,391],{"emptyLinePlaceholder":390},[36,1263,1264],{"class":38,"line":86},[36,1265,1266],{"class":285},"# PRODUCTION: nofail lets boot continue\n",[36,1268,1269,1271,1273,1275,1277,1279,1282,1284],{"class":38,"line":98},[36,1270,1231],{"class":68},[36,1272,1234],{"class":294},[36,1274,1237],{"class":46},[36,1276,1240],{"class":42},[36,1278,1243],{"class":46},[36,1280,1281],{"class":46},"  defaults,nofail",[36,1283,1249],{"class":184},[36,1285,1252],{"class":184},[18,1287,1289],{"id":1288},"shutdown-and-reboot","Shutdown and Reboot",[23,1291,1292],{"language":25},[27,1293,1295],{"className":29,"code":1294,"language":25,"meta":31,"style":31},"sudo shutdown -r now           # reboot immediately\nsudo shutdown +5 \"Rebooting\"   # reboot in 5 min with warning to users\nsudo shutdown -c               # cancel scheduled shutdown\nsudo systemctl poweroff        # systemd-native\nsudo systemctl reboot\nsudo systemctl suspend         # suspend to RAM\nsudo systemctl hibernate       # suspend to disk\n",[33,1296,1297,1312,1327,1339,1351,1360,1372],{"__ignoreMap":31},[36,1298,1299,1301,1304,1306,1309],{"class":38,"line":39},[36,1300,363],{"class":42},[36,1302,1303],{"class":46}," shutdown",[36,1305,574],{"class":184},[36,1307,1308],{"class":46}," now",[36,1310,1311],{"class":285},"           # reboot immediately\n",[36,1313,1314,1316,1318,1321,1324],{"class":38,"line":53},[36,1315,363],{"class":42},[36,1317,1303],{"class":46},[36,1319,1320],{"class":46}," +5",[36,1322,1323],{"class":46}," \"Rebooting\"",[36,1325,1326],{"class":285},"   # reboot in 5 min with warning to users\n",[36,1328,1329,1331,1333,1336],{"class":38,"line":59},[36,1330,363],{"class":42},[36,1332,1303],{"class":46},[36,1334,1335],{"class":184}," -c",[36,1337,1338],{"class":285},"               # cancel scheduled shutdown\n",[36,1340,1341,1343,1345,1348],{"class":38,"line":81},[36,1342,363],{"class":42},[36,1344,868],{"class":46},[36,1346,1347],{"class":46}," poweroff",[36,1349,1350],{"class":285},"        # systemd-native\n",[36,1352,1353,1355,1357],{"class":38,"line":86},[36,1354,363],{"class":42},[36,1356,868],{"class":46},[36,1358,1359],{"class":46}," reboot\n",[36,1361,1362,1364,1366,1369],{"class":38,"line":98},[36,1363,363],{"class":42},[36,1365,868],{"class":46},[36,1367,1368],{"class":46}," suspend",[36,1370,1371],{"class":285},"         # suspend to RAM\n",[36,1373,1374,1376,1378,1381],{"class":38,"line":103},[36,1375,363],{"class":42},[36,1377,868],{"class":46},[36,1379,1380],{"class":46}," hibernate",[36,1382,1383],{"class":285},"       # suspend to disk\n",[18,1385,1387],{"id":1386},"tips-tricks","💡 Tips & Tricks",[1389,1390,1391,1405,1415,1432,1456,1474],"ul",{},[495,1392,1393,1396,1397,1400,1401,1404],{},[488,1394,1395],{},"Idiom",": use ",[33,1398,1399],{},"systemd-analyze blame"," to find slow boot services — disable or mask unneeded ones (",[33,1402,1403],{},"systemctl mask NetworkManager-wait-online.service"," — a common culprit).",[495,1406,1407,1396,1409,1411,1412,1414],{},[488,1408,1395],{},[33,1410,1213],{}," in ",[33,1413,1126],{}," for non-critical mounts — if a secondary disk or USB is absent at boot, boot continues instead of dropping to emergency mode.",[495,1416,1417,1419,1420,1423,1424,1427,1428,1431],{},[488,1418,1395],{},": edit ",[33,1421,1422],{},"\u002Fetc\u002Fdefault\u002Fgrub"," then ",[33,1425,1426],{},"sudo update-grub"," — never edit ",[33,1429,1430],{},"grub.cfg"," directly (it's generated and overwritten).",[495,1433,1434,1396,1436,1439,1440,1443,1444,1447,1448,1451,1452,1455],{},[488,1435,1395],{},[33,1437,1438],{},"journalctl -b -k -p err"," for boot kernel errors — ",[33,1441,1442],{},"-b"," (current boot), ",[33,1445,1446],{},"-k"," (kernel), ",[33,1449,1450],{},"-p err"," (errors). Use ",[33,1453,1454],{},"-b -1"," for the previous boot.",[495,1457,1458,1461,1462,1464,1465,1467,1468,1470,1471,1473],{},[488,1459,1460],{},"Debug",": boot to ",[33,1463,786],{}," for recovery — at GRUB, press ",[33,1466,954],{},", append ",[33,1469,452],{}," to the ",[33,1472,961],{}," line.",[495,1475,1476,1396,1478,1481,1482,1485],{},[488,1477,1460],{},[33,1479,1480],{},"rw init=\u002Fbin\u002Fbash"," to reset a lost root password — bypasses all auth. On SELinux: ",[33,1483,1484],{},"touch \u002F.autorelabel"," before rebooting.",[18,1487,1489],{"id":1488},"️-edge-cases-gotchas","⚠️ Edge Cases & Gotchas",[1389,1491,1492,1515,1527,1543,1558,1570,1585,1601],{},[495,1493,1494,1500,1501,1504,1505,1508,1509,1511,1512,1514],{},[488,1495,1496,1497,1499],{},"Editing ",[33,1498,1430],{}," directly is futile",": ",[33,1502,1503],{},"update-grub"," \u002F ",[33,1506,1507],{},"grub-mkconfig"," overwrites it. Edit ",[33,1510,1422],{},", then regenerate. Changes to ",[33,1513,1430],{}," vanish on the next kernel update.",[495,1516,1517,1522,1523,1526],{},[488,1518,1519,1521],{},[33,1520,462],{}," gives no services, no mounts",": you get a raw shell with root on ",[33,1524,1525],{},"\u002F"," (read-only), no networking, no other filesystems. Don't expect a normal environment.",[495,1528,1529,1532,1533,1535,1536,1539,1540,1542],{},[488,1530,1531],{},"Rescue mode needs the root password",": on some systems, ",[33,1534,786],{}," prompts for the root password. If root has no password (",[33,1537,1538],{},"passwd -l root","), use ",[33,1541,462],{}," instead.",[495,1544,1545,1548,1549,1551,1552,1554,1555,1557],{},[488,1546,1547],{},"SELinux blocks password reset in rescue mode",": after ",[33,1550,462],{}," + ",[33,1553,1085],{},", SELinux may not recognize the new context. ",[33,1556,1484],{}," and reboot — SELinux relabels all files on next boot (can take a long time).",[495,1559,1560,1566,1567,962],{},[488,1561,1562,1565],{},[33,1563,1564],{},"NetworkManager-wait-online.service"," delays boot",": it waits for network \"online\" (30-90s). On servers with static IPs, disable it: ",[33,1568,1569],{},"sudo systemctl mask NetworkManager-wait-online.service",[495,1571,1572,1577,1578,1581,1582,1584],{},[488,1573,1574,1576],{},[33,1575,1126],{}," errors drop to emergency mode",": a mount that fails (bad UUID, missing disk) drops you to emergency mode. Always test with ",[33,1579,1580],{},"sudo mount -a"," after editing. Use ",[33,1583,1213],{}," for non-critical mounts.",[495,1586,1587,1500,1590,1593,1594,1597,1598,962],{},[488,1588,1589],{},"UEFI vs BIOS GRUB commands differ",[33,1591,1592],{},"grub-install \u002Fdev\u002Fsda"," (BIOS) vs ",[33,1595,1596],{},"grub-install --target=x86_64-efi --efi-directory=\u002Fboot\u002Fefi"," (UEFI). Check with ",[33,1599,1600],{},"[ -d \u002Fsys\u002Ffirmware\u002Fefi ]",[495,1602,1603,1606],{},[488,1604,1605],{},"Secure Boot can block custom kernels\u002Fmodules",": signed bootloaders\u002Fkernels only. If you install a custom kernel or third-party module (e.g., NVIDIA), it may not load with Secure Boot on.",[18,1608,1610],{"id":1609},"quick-quiz","🧠 Quick Quiz",[14,1612,1613,1614,1617],{},"A server fails to boot after a kernel upgrade. The error is: ",[33,1615,1616],{},"kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)",". You have physical access. What are the steps to recover?",[1619,1620,1621,1625,1631,1636,1649,1693,1700,1735],"details",{},[1622,1623,1624],"summary",{},"Answer",[14,1626,1627,1630],{},[488,1628,1629],{},"The initramfs is missing or doesn't have the storage driver for the new kernel."," The kernel booted but can't mount the root filesystem because the needed modules (disk controller, filesystem, LVM) aren't in the initramfs.",[14,1632,1633],{},[488,1634,1635],{},"Recovery steps:",[492,1637,1638,1644],{},[495,1639,1640,1643],{},[488,1641,1642],{},"Reboot and select the old kernel"," — GRUB menu → \"Advanced options\" → select the previous (working) kernel.",[495,1645,1646],{},[488,1647,1648],{},"Regenerate the initramfs for the new kernel:",[23,1650,1651],{"language":25},[27,1652,1654],{"className":29,"code":1653,"language":25,"meta":31,"style":31},"sudo update-initramfs -u -k 6.8.0-35-generic\n# Or for all kernels:\nsudo update-initramfs -u -k all\n# RHEL: sudo dracut -f \u002Fboot\u002Finitramfs-6.8.0-35.img 6.8.0-35\n",[33,1655,1656,1670,1675,1688],{"__ignoreMap":31},[36,1657,1658,1660,1662,1664,1667],{"class":38,"line":39},[36,1659,363],{"class":42},[36,1661,529],{"class":46},[36,1663,532],{"class":184},[36,1665,1666],{"class":184}," -k",[36,1668,1669],{"class":46}," 6.8.0-35-generic\n",[36,1671,1672],{"class":38,"line":53},[36,1673,1674],{"class":285},"# Or for all kernels:\n",[36,1676,1677,1679,1681,1683,1685],{"class":38,"line":59},[36,1678,363],{"class":42},[36,1680,529],{"class":46},[36,1682,532],{"class":184},[36,1684,1666],{"class":184},[36,1686,1687],{"class":46}," all\n",[36,1689,1690],{"class":38,"line":81},[36,1691,1692],{"class":285},"# RHEL: sudo dracut -f \u002Fboot\u002Finitramfs-6.8.0-35.img 6.8.0-35\n",[492,1694,1695],{"start":59},[495,1696,1697],{},[488,1698,1699],{},"Verify the initramfs exists and has the needed modules:",[23,1701,1702],{"language":25},[27,1703,1705],{"className":29,"code":1704,"language":25,"meta":31,"style":31},"ls -lh \u002Fboot\u002Finitrd.img-6.8.0-35-generic   # should be > 10 MB\nlsinitramfs \u002Fboot\u002Finitrd.img-6.8.0-35-generic | grep ext4   # has ext4 module?\n",[33,1706,1707,1721],{"__ignoreMap":31},[36,1708,1709,1712,1715,1718],{"class":38,"line":39},[36,1710,1711],{"class":42},"ls",[36,1713,1714],{"class":184}," -lh",[36,1716,1717],{"class":46}," \u002Fboot\u002Finitrd.img-6.8.0-35-generic",[36,1719,1720],{"class":285},"   # should be > 10 MB\n",[36,1722,1723,1725,1727,1729,1731,1733],{"class":38,"line":53},[36,1724,562],{"class":42},[36,1726,1717],{"class":46},[36,1728,706],{"class":294},[36,1730,583],{"class":42},[36,1732,586],{"class":46},[36,1734,589],{"class":285},[492,1736,1737],{"start":81},[495,1738,1739,1741],{},[488,1740,830],{}," — select the new kernel. It should boot now.",[1743,1744,1745],"style",{},"html pre.shiki code .sIsaT, html code.shiki .sIsaT{--shiki-default:#6F42C1;--shiki-github-dark:#B392F0}html pre.shiki code .sJ6F3, html code.shiki .sJ6F3{--shiki-default:#032F62;--shiki-github-dark:#9ECBFF}html pre.shiki code .ssxIu, html code.shiki .ssxIu{--shiki-default:#24292E;--shiki-github-dark:#E1E4E8}html pre.shiki code .snvgF, html code.shiki .snvgF{--shiki-default:#005CC5;--shiki-github-dark:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .github-dark .shiki span {color: var(--shiki-github-dark);background: var(--shiki-github-dark-bg);font-style: var(--shiki-github-dark-font-style);font-weight: var(--shiki-github-dark-font-weight);text-decoration: var(--shiki-github-dark-text-decoration);}html.github-dark .shiki span {color: var(--shiki-github-dark);background: var(--shiki-github-dark-bg);font-style: var(--shiki-github-dark-font-style);font-weight: var(--shiki-github-dark-font-weight);text-decoration: var(--shiki-github-dark-text-decoration);}html pre.shiki code .sdCPZ, html code.shiki .sdCPZ{--shiki-default:#6A737D;--shiki-github-dark:#6A737D}html pre.shiki code .svdQ7, html code.shiki .svdQ7{--shiki-default:#D73A49;--shiki-github-dark:#F97583}",{"title":31,"searchDepth":53,"depth":53,"links":1747},[1748,1749,1750,1753,1754,1755,1756,1761,1762,1767,1768,1769,1770],{"id":20,"depth":53,"text":21},{"id":205,"depth":53,"text":206},{"id":324,"depth":53,"text":325,"children":1751},[1752],{"id":410,"depth":59,"text":411},{"id":482,"depth":53,"text":483},{"id":592,"depth":53,"text":593},{"id":748,"depth":53,"text":749},{"id":894,"depth":53,"text":895,"children":1757},[1758,1759],{"id":942,"depth":59,"text":943},{"id":984,"depth":59,"text":1760},"init=\u002Fbin\u002Fbash (Last Resort)",{"id":1047,"depth":53,"text":1048},{"id":1123,"depth":53,"text":1763,"children":1764},"fstab Issues at Boot",[1765],{"id":1209,"depth":59,"text":1766},"Edge Case: nofail Prevents Boot Failure",{"id":1288,"depth":53,"text":1289},{"id":1386,"depth":53,"text":1387},{"id":1488,"depth":53,"text":1489},{"id":1609,"depth":53,"text":1610},"md",{},"\u002Flinux\u002F16-boot-process-and-runlevels",{"title":5,"description":16},"linux\u002F16-boot-process-and-runlevels","UnYSdC9b9vSaWe58bzmmL2d4PPUKptgRXv8T8NBkKa8",1789924650131]