Linux system boot failure and GRUB repair: command-line recovery guide¶
A Linux system boot failure can halt workstations, production servers, and dual-boot laptops without warning, dropping you into a stark grub rescue> prompt, a minimal grub> 殼,一個 (initramfs) 或者 dracut:/# emergency console, a systemd "You are in emergency mode" 維護提示,或黑屏且遊標閃爍。
Unlike operating systems that hide startup mechanics behind opaque graphical error codes, Linux exposes every stage of the boot pipeline directly to the administrator. Almost every Linux boot failure stems from one of five fixable root causes: an overwritten or misconfigured GRUB 2 bootloader (commonly triggered after a Windows update on a dual-boot PC), a dirty ext4/xfs/btrfs root filesystem after a sudden power outage, a broken /etc/fstab disk UUID entry, a 100-percent full root (/) storage partition, or an interrupted kernel and graphics driver upgrade. Matching your exact on-screen prompt to the corresponding boot stage lets you repair the system cleanly without formatting your drive or losing your data.
現在就這樣做¶
When your Linux computer or server refuses to boot, follow these six immediate diagnostic and safety steps before running any destructive disk commands:
- Read the exact prompt on your screen to identify which boot stage failed:
grub rescue>或者grub>: The motherboard UEFI/BIOS loaded the first stage of GRUB, but GRUB cannot locate/boot/grubor its configuration file (grub.cfg)。(initramfs)或者dracut:/#: GRUB loaded the Linux kernel and initial RAM disk fine, but the kernel could not mount your main root (/) filesystem (usually becausefsckneeds to repair a dirty disk).You are in emergency mode / Give root password for maintenance: The root filesystem mounted, butsystemdfailed to mount a secondary drive listed in/etc/fstab。- Black screen with a blinking cursor after the GRUB menu: The operating system booted, but the graphical Display Manager (GDM, SDDM, LightDM) failed due to a 100% full root disk or a broken Nvidia/AMD GPU driver.
- Try booting the previous Linux kernel from the GRUB menu first: Reboot the machine and hold Shift (BIOS) or tap Esc repeatedly (UEFI) right after the manufacturer logo to reveal the GRUB menu. Select "Advanced options for Ubuntu / Debian / Fedora" and pick the second-oldest kernel on the list. If a recent kernel update broke your
initramfsor GPU module, the previous kernel will boot straight into your desktop in 10 seconds. - Switch to a virtual TTY text console if stuck on a black screen: If the boot sequence freezes on a black screen with a blinking underscore or stuck splash logo, press
Ctrl + Alt + F3(orCtrl + Alt + F2throughF6). If alogin:text prompt appears, your Linux system is actually running, log in with your username and password to clean full disk space or fix graphics drivers. - Never run
fsckon a partition that is currently mounted read-write: Runningfsckon a live, read-write mounted filesystem corrupts open inode tables and destroys files. Only runfsckfrom the(initramfs)shell (where root is unmounted), on a read-only mount, or from a Live USB stick. - Unplug all non-important external USB hard drives and SD cards: A failing external USB drive listed in
/etc/fstabor taking over boot priority in BIOS will halt the boot sequence. Unplug external drives and reboot to test. - Prepare a Live Linux USB stick if GRUB or the kernel is completely missing: Keep a bootable Live USB flash drive (Ubuntu, Linux Mint, Fedora, or SystemRescue) handy so you can mount your encrypted or standard partitions and run a
chrootbootloader repair.
關鍵:什麼不該做
Never run grub-install, dd, fdisk, or mkfs until you have verified your exact disk and partition layout using lsblk -f 或者 blkid. Device node names like /dev/sda 和 /dev/sdb 由 Linux 核心在啟動時動態分配,並且在插入 Live USB 記憶棒時可以交換順序。意外格式化或覆蓋錯誤的分割區表 /dev/sdX 驅動器會破壞您的資料。此外,切勿運行檔案系統修復實用程序,例如 fsck 在以讀寫方式安裝的分割區上,在活動核心或引導程式包升級期間切勿強制關閉系統,且切勿刪除其中的系統庫 /usr/lib 或者 /lib 嘗試清理完整根驅動器上的空間。
決策樹:診斷 Linux 啟動失敗的 5 個階段¶
使用此診斷流程圖可將您的確切螢幕輸出追蹤到匹配的命令列修復:
flowchart TD
A["Linux 系統無法啟動到桌面/登入"] --> B{"螢幕上顯示什麼?"}
B -->|"grub rescue> 或 grub> 提示符"| C["階段 1 失敗:使用 ls 找到 /boot/grub,設定根目錄和前綴,啟動作業系統,然後執行grub-install"]
B -->|"BusyBox (initramfs) 或 dracut:/# shell"| D["第 2 階段失敗:使用 blkid 識別根分區並執行 fsck -y /dev/partition"]
B -->|"緊急模式:提供 root 密碼進行維護"| E["第 3 階段失敗:執行 mount -o remount,rw / 並修復或註解掉 /etc/fstab 中損壞的 UUID"]
B -->|"GRUB 後黑屏或遊標閃爍"| F["第 4 階段故障:按 Ctrl+Alt+F3(或啟動 Emergency.target)清除 100% 已滿磁碟或 GPU 驅動程式"]
B -->|"直接啟動進入 Windows 或“無可啟動裝置”"| G["UEFI/EFI 開機順序已清除:開機 Live USB、掛載 Root + EFI、chroot 並重新安裝 GRUB"]
Linux啟動失敗提示、原因及指令對比¶
| 螢幕錯誤/提示 | 已達到啟動階段 | 主要根本原因 | 最快的修復命令序列 |
|---|---|---|---|
error: no such partition / grub rescue> |
第 1 階段(GRUB 核心) | 磁碟分割區調整大小、複製或 UUID 變更; GRUB 找不到 /boot/grub/normal.mod。 |
ls -> set root=(hdX,gptY) -> set prefix=(hdX,gptY)/boot/grub -> insmod normal -> normal |
grub>(標準 GRUB CLI) |
階段 1.5(GRUB 正常) | /boot/grub/grub.cfg 儘管 GRUB 模組載入正常,但遺失或刪除。 |
set root=(hdX,gptY) -> linux /boot/vmlinuz-... root=/dev/nvme0n1p2 -> initrd /boot/initrd.img-... -> boot |
BusyBox (initramfs) 或 dracut:/# |
第 2 階段(核心 + Initramfs) | 不乾淨斷電左 ext4/xfs 根日誌髒,需要手動 fsck 贊同。 |
blkid -> fsck -y /dev/nvme0n1p2 (或者 xfs_repair -L 對於 XFS)-> reboot -f |
You are in emergency mode(sulogin 迅速的) |
第三階段(systemd Mounts) |
Secondary drive or swap partition in /etc/fstab was unplugged, reformatted, or corrupted. |
Enter root password -> mount -o remount,rw / -> nano /etc/fstab (新增 nofail 或者 #)-> systemctl daemon-reload -> reboot |
[FAILED] Failed to start GNOME Display Manager / 閃爍遊標 |
第 4 階段(顯示管理器/GUI) | 根分區 / 100% 已滿(0 位元組可用 /tmp 或 Xorg 套接字)或損壞的 Nvidia 核心模組(dkms)。 |
按 Ctrl+Alt+F3 -> df -h -> journalctl --vacuum-size=100M & apt clean 或者 ubuntu-drivers autoinstall |
場景一:逃離 grub rescue> 或者 grub> 沒有 USB 隨身碟時提示¶
如果您的螢幕顯示 error: unknown filesystem, error: no such partition, or Minimal BASH-like line editing is supported 其次是 grub rescue> 或者 grub>,您的 Linux 安裝和個人檔案通常仍然完好無損地保存在您的 SSD 或硬碟上,GRUB 根本不知道哪個分割區保存 /boot/grub. You can boot directly into your installed OS from this prompt in 2 minutes:
情況A:你在 grub rescue> 迅速的¶
在 grub rescue>,只有四個基本指令有效(ls, set, unset, 和 insmod)。仔細按照以下步驟操作:
- 列出主機板韌體看到的所有磁碟和分割區:
GRUB will print a line like:
(hd0) (hd0,gpt1) (hd0,gpt2) (hd0,gpt3)(或者(hd0,msdos1)在較舊的 MBR 磁碟上)。 - Inspect each partition until you find your Linux root (or
/boot) directory: (請記住包含尾部斜杠/at the end of eachlscheck so GRUB lists the filenames inside that partition): - If
(hd0,gpt1)/showsefi/, that is your small FAT32 EFI System Partition. - When a partition outputs
boot/ etc/ home/ usr/ var/ vmlinuz initrd.img, you have found your main Linux root partition (for example,(hd0,gpt2)). (Note: If you use Btrfs with@subvolumes on Ubuntu/Fedora,ls (hd0,gpt2)/will show@/ @home/, meaning your boot folder is at(hd0,gpt2)/@/boot/grub.) - Point GRUB to your partition and load the
normalmodule: Assuming your Linux root is on(hd0,gpt2):(If you have a separate dedicatedgrub rescue> set root=(hd0,gpt2) grub rescue> set prefix=(hd0,gpt2)/boot/grub grub rescue> insmod normal grub rescue> normal/bootpartition on(hd0,gpt2), useset prefix=(hd0,gpt2)/grubwithout/boot.) - Make the fix permanent once your desktop boots:
As soon as
normalruns, your regular GRUB menu will appear and boot your Linux system. Important: Thosesetcommands were temporary in RAM. The moment you log into your Linux desktop, open a terminal and permanently write the correct GRUB location to your drive:
Case B: You are at the standard grub> 迅速的¶
If you see grub> (without the word rescue), the normal module is already loaded, but your grub.cfg menu file is missing or broken. You can manually boot the Linux kernel in four lines using Tab auto-completion:
grub> set root=(hd0,gpt2)
grub> linux /boot/vmlinuz-6.8.0-45-generic root=/dev/nvme0n1p2 ro
grub> initrd /boot/initrd.img-6.8.0-45-generic
grub> boot
linux /boot/vmlinuz and press the Tab key, GRUB will auto-complete the exact kernel version numbers installed on your disk.) Once booted into your OS, run sudo update-grub (Debian/Ubuntu) 或 sudo grub2-mkconfig -o /boot/grub2/grub.cfg (Fedora/RHEL) 重新產生遺失的選單檔案。
場景 2:修復 (initramfs) 或者 dracut 貝殼與 fsck¶
如果您的 PC 透過 GRUB 選單,會顯示 Linux 啟動畫面幾秒鐘,然後變成黑色文字提示:
BusyBox v1.36.1 (Ubuntu) built-in shell (ash)
Enter 'help' for a list of built-in commands.
(initramfs) _
(initramfs) 迅速的。十分之九,你會看到:
The root filesystem on /dev/nvme0n1p2 requires a manual fsck
逐步修復檔案系統 (initramfs)¶
- 確認哪個分區需要修復:如果分區名稱未列印在提示符號的正上方,請鍵入
blkid然後按 Enter 鍵列出您的ext4,xfs, orbtrfs分區。 - 運行匹配的檔案系統修復工具:
- 為了
ext4/ext3檔案系統(Ubuntu、Debian、Mint 上預設): 這-yflag 會自動對每個損壞的索引節點、孤立區塊和日誌重播提示回答“是”,而不是讓您按y500次。 - 為了
XFS檔案系統(RHEL、AlmaLinux、Rocky Linux、CentOS 上預設): 標準fsck對 XFS 不執行任何操作。在一個dracut:/#XFS 系統上的 shell,運作: *(僅透過-L如果滿足下列條件,則將 XFS 元資料日誌標記為零xfs_repair由於無法安裝的髒日誌而拒絕運行,並且您沒有其他選擇)。 * - 為了
Btrfs檔案系統(Fedora、openSUSE 上預設): 首先嘗試安全地清除 Btrfs 日誌樹btrfs rescue zero-log /dev/nvme0n1p2。永遠不要跑btrfs check --repair除非得到 Btrfs 開發人員的指示或從 Live USB 備份資料後,否則--repair在 Btrfs 上被認為是危險的。
- 為了
- 退出並重新啟動:一次
fsck印刷***** FILE SYSTEM WAS MODIFIED *****, 類型exit(或者reboot -f)並按 Enter 鍵。您的系統將掛載乾淨的分割區並正常啟動。
場景 3:修復 /etc/fstab 中的錯誤 systemd 緊急模式¶
如果您的螢幕在啟動過程中停止:
You are in emergency mode. After logging in, type "journalctl -xb" to view system logs,
"systemctl reboot" to reboot, or "exit" to continue bootup.
Give root password for maintenance (or press Control-D to continue):
/etc/fstab、格式化交換分割區(更改了其 UUID),或拔除中列出的輔助內部/外部硬碟 /etc/fstab 沒有 nofail 選項。預設情況下, systemd halts the entire operating system boot if any disk listed in /etc/fstab 90 秒內未響應。
How to fix /etc/fstab in 90 seconds¶
- Type your root password (or press Enter if on Ubuntu where the root account is locked and it drops you in directly; if Ubuntu says
Cannot open access to console, the root account is locked, see theinit=/bin/bashnote below). - Remount the root filesystem as Read-Write: In emergency mode,
/is often mounted Read-Only, so if you try to save/etc/fstab,nanowill sayError writing /etc/fstab: Read-only file system. Run this first: - Find out which line in
/etc/fstab已損壞: 跑步mount -a. Whatever drive is broken will immediately print an error (for example,mount: /mnt/backup: can't find UUID=4a8b...)。您也可以將您的真實磁碟機 UUID 與/etc/fstabby running: - 編輯
/etc/fstaband addnofailor comment out the bad line: Put a#at the start of the broken secondary drive or swap line to disable it (or add,nofailto the mount options column such asdefaults,nofailso Linux never refuses to boot when that external drive is unplugged). Save withCtrl+O, press Enter, and exit withCtrl+X。 - Reload
systemdand verify before rebooting: Ifmount -areturns zero errors, typerebootand your computer will boot cleanly.
Warning
What if Ubuntu/Debian says "Cannot open access to console, the root account is locked" at the Emergency Mode prompt? Because Ubuntu disables the root password by default in favor of sudo, sulogin sometimes locks you out of Emergency Mode if a disk in /etc/fstab fails. To bypass that lock in 30 seconds: reboot, hold Shift or tap Esc to open the GRUB menu, highlight Ubuntu, press e to edit the boot command, find the line starting with linux /boot/vmlinuz..., replace ro quiet splash at the end of that line with rw init=/bin/bash, and press Ctrl+X 或 F10. This bypasses systemd completely and drops you straight into an unlocked # root shell with read-write access so you can run nano /etc/fstab。
Scenario 4: Recovering from a 100% full root (/) disk or broken GPU driver¶
If your PC passes GRUB smoothly, shows no filesystem errors, and then hangs forever on a black screen with a blinking cursor in the top-left corner (or loops back to the login screen every time you type your password and press Enter), your root partition (/) is almost certainly 100% full. When / has 0 megabytes of free space, Xorg, Wayland, and GNOME/KDE cannot create a 4-kilobyte session lock file in /tmp 或者 /var/lib, causing the desktop to silently crash.
How to free gigabytes of space from the TTY console¶
- At the black blinking cursor screen (or looping login screen), press
Ctrl + Alt + F3(on laptops, you may needCtrl + Alt + Fn + F3) to switch from the frozen graphical screen (TTY1/TTY2) to a pure text terminal (TTY3). - Log in with your normal username and password, then check disk usage:
- If
Use%shows100%(或者Availshows0), run these four safe cleanup commands to free 2 GB to 25 GB of space immediately:(If a runaway log file like# 1. Clear downloaded package cache (.deb / .rpm archives sitting in /var/cache): sudo apt-get clean # (Ubuntu/Debian/Mint) # sudo dnf clean all # (Fedora/RHEL) # 2. Shrink bloated systemd system logs down to 100 MB: sudo journalctl --vacuum-size=100M # 3. Remove old unused Linux kernel versions and orphaned packages: sudo apt-get autoremove --purge -y # 4. Find the top 10 largest folders inside /var (e.g., Docker, Snap, or runaway /var/log/syslog): sudo du -xh /var | sort -rh | head -n 15/var/log/syslog或者/var/log/ufw.loghas ballooned to 50 GB, empty it instantly withsudo truncate -s 0 /var/log/syslog.) - Why does
df -hsometimes showAvail: 0(100% full) when only 95% of the disk is used? By default,ext4reserves 5 percent of the entire partition exclusively for theroot這樣當普通用戶填滿磁碟時,root 服務仍然可以運作。在 1 TB SSD 上,5% 是 50 GB 的巨大空間。您可以透過執行以下命令立即為普通用戶帳戶回收 40+ GB 的保留緩衝區: - 一次
df -h /顯示有數千兆位元組可用,運行sudo reboot您的圖形桌面將正常登入。
如果什麼 df -h 有足夠的可用空間,並且在 Nvidia 驅動程式或核心更新後開始黑屏?¶
如果您的磁碟未滿,並且在具有 Nvidia 顯示卡的 PC 上更新後立即開始黑屏,則 Nvidia 專有核心模組 (nvidia.ko) 編譯失敗 dkms 對於您的新內核,或者安全啟動阻止了未簽署的模組:
- 從
Ctrl + Alt + F3TTY控制台,透過執行檢查驅動模組是否載入nvidia-smi。 - If
nvidia-smi說NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver,或在主機板 UEFI/BIOS 設定中停用安全啟動(如果安全啟動阻止未簽署的 DKMS 模組),或重建核心標頭和驅動程式:
場景 5:完整的 Live USB chroot 救援(針對擦除的 EFI/GRUB、LVM、LUKS 和 Btrfs)¶
當 Windows 11 更新覆蓋您的 UEFI 啟動條目時,核心更新會在斷電時崩潰,或者 grub rescue> 無法讀取您的分割區,請從 Live Linux USB 磁碟機 啟動電腦(選擇 「嘗試 Ubuntu」 或即時桌面模式)並執行 chroot(更改根目錄)修復。一個 chroot 讓您的 Live USB 終端「進入」損壞的 SSD 安裝並運行 apt, dnf, update-initramfs, 和 grub-install 就像系統正常啟動一樣。
步驟 1:識別並解鎖您的儲存佈局(lsblk -f)¶
在 Live USB 桌面內開啟終端機並運行:
看看FSTYPE 列以查看您的 Linux 安裝使用四種常見儲存架構中的哪一種,並將其掛載到 /mnt 使用下面的匹配區塊:
- 案例 1:標準
ext4或者xfs分區(例如,根是/dev/nvme0n1p2和 EFI 是/dev/nvme0n1p1): - 案例2:加密的LUKS根分割區(
crypto_LUKS) (安裝過程中選取「加密我的磁碟」時的預設值): 掛載前必須先解密 LUKS 容器:sudo cryptsetup luksOpen /dev/nvme0n1p3 cryptroot sudo vgchange -ay # Activates LVM volumes inside LUKS if used sudo mount /dev/mapper/cryptroot /mnt # (Or /dev/mapper/ubuntu--vg-ubuntu--lv) sudo mount /dev/nvme0n1p2 /mnt/boot # Mount separate unencrypted /boot partition sudo mount /dev/nvme0n1p1 /mnt/boot/efi # Mount FAT32 EFI partition - 案例 3:Btrfs 檔案系統
@子磁碟區(Fedora、openSUSE 和 Ubuntu Btrfs 安裝上的預設值): 如果掛載 Btrfs 分割區而不指定subvol=@,/mnt只會顯示@和@home資料夾而不是/bin和/etc, 和chroot /mnt將會失敗failed to run command '/bin/bash': No such file or directory。安裝@子卷明確:
步驟2:綁定虛擬核心檔案系統(包括UEFI efivars)並輸入 chroot¶
為了 grub-install 和 apt (DNS 互聯網訪問)在內部工作 chroot,將 Live USB 的虛擬核心目錄和 UEFI NVRAM 變數綁定掛載到 /mnt:
# Bind-mount virtual device, process, sysfs, run (for DNS resolv.conf), and UEFI variables:
for dir in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do
sudo mount --bind $dir /mnt$dir
done
# Step inside your installed Linux system:
sudo chroot /mnt /bin/bash
第三步:修復包,重建 initramfs,並在裡面重新安裝GRUB chroot¶
現在您的提示顯示 root@ubuntu:/#,執行適用於您的發行版的修復指令:
# 1. Fix any half-installed kernel upgrades (Ubuntu/Debian):
dpkg --configure -a
apt-get install -f -y
# 2. Rebuild the initial ramdisk for all installed kernels:
update-initramfs -c -k all # (Debian / Ubuntu / Mint)
# dracut --regenerate-all --force # (Fedora / RHEL / Rocky)
# mkinitcpio -P # (Arch / Manjaro)
# 3. Reinstall GRUB to the EFI System Partition and regenerate grub.cfg:
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --recheck
update-grub # (Or: grub2-mkconfig -o /boot/grub2/grub.cfg on Fedora)
第 4 步:乾淨退出並重新啟動¶
依需求拔除 Live USB 隨身碟。您的系統將直接啟動到修復後的 GRUB 選單和 Linux 桌面。區域企業標準、資料中心合規性和硬體認證¶
企業 Linux 開機載入程式管理和韌體安全受到嚴格的國家標準和網路安全框架的約束:
- 美國: 政府和企業基礎設施遵守國家標準與技術研究所 (NIST) 特別出版物 800-147B(伺服器 BIOS 保護指南)和 SP 800-193(平台韌體彈性指南)。運行 Red Hat Enterprise Linux (RHEL) 或 Rocky Linux 的聯邦安裝必須符合國防資訊系統局 (DISA) 安全技術實施指南 (STIG)。這些標準要求對 GRUB 2 啟動選單進行密碼保護,停用互動式核心參數編輯,使用 Shim 第一階段載入程式啟用 UEFI 安全啟動,並使用經 FIPS 140-⅔ 驗證的 LUKS 加密模組加密根儲存。
- 英國: 國家網路安全中心 (NCSC) 發布了企業 Linux 平台的設備安全指南,強制要求基於硬體的平台完整性。跨政府或關鍵國家基礎設施部署的系統必須使用可信任平台模組 (TPM 2.0) 測量來根據平台配置暫存器 (PCR) 密封 LUKS 磁碟加密金鑰,確保僅當 UEFI 韌體、安全啟動金鑰和 GRUB 二進位檔案完全未被篡改時驅動器才會自動解鎖。
- 歐盟: 在歐盟,德國聯邦資訊安全辦公室 (BSI) 透過 IT-Grundschutz 構建塊 SYS.1.3(伺服器 Linux 和 Unix)建立基線安全性。 BSI 指南要求嚴格分離引導分割區、不可變的引導程式配置和經過審核的維護程序。根據歐盟網路和資訊安全指令 (NIS 2),營運基本數位服務的實體必須維護經過驗證的裸機災難復原程序,以滿足作業系統故障期間的復原時間目標 (RTO)。
- 加拿大: 加拿大網路安全中心 (CCCS) 根據 ITSG-33(IT 安全風險管理)提供指導,指定企業 Linux 作業環境的控制措施。根據《個人資訊保護和電子文檔法》(PIPEDA),進行引導程式復原或控制器更換的實體伺服器硬碟必須使用硬體或磁碟區級加密,以防止在維修期間資料外洩。
- Australia: The Australian Signals Directorate (ASD) publishes the Information Security Manual (ISM), which sets forth requirements for enterprise Linux systems. The ISM mandates that organizations enforce UEFI Secure Boot, protect bootloader configurations against unauthenticated changes, and log emergency maintenance shell access into centralized audit repositories to maintain compliance with the Essential Eight mitigation strategies.
常見問題¶
Why did my dual-boot Linux GRUB menu disappear after a Windows 10 or Windows 11 update?
Major Windows feature updates frequently reset the motherboard's UEFI NVRAM boot priority order, placing "Windows Boot Manager" back at #1 above "ubuntu" or "fedora" without actually deleting your Linux files. Before booting a Live USB, first enter your motherboard BIOS/UEFI settings at startup (press `F2`, `F12`, or `Del`) and check the **Boot Order / UEFI Boot Priority** list, often you can simply move `ubuntu` or `GRUB` back above `Windows Boot Manager`, save with `F10`, and your GRUB menu returns immediately. You can also run `bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi` inside an Administrator Command Prompt in Windows to restore GRUB without a USB stick.
Why does `chroot /mnt` say `failed to run command '/bin/bash': No such file or directory` when I try to rescue my system?
This error happens for one of three reasons: (1) You accidentally mounted your small `/boot` or `EFI` partition to `/mnt` instead of your main Linux root partition (verify with `ls /mnt`, you should see `bin`, `etc`, `usr`, and `var`); (2) your system uses the **Btrfs** filesystem with subvolumes, so `ls /mnt` only shows `@` and `@home`, unmount `/mnt` and remount with `sudo mount -o subvol=@ /dev/nvme0n1p2 /mnt` (or `subvol=root` on Fedora); or (3) you accidentally booted a 32-bit Live USB stick while trying to `chroot` into a 64-bit (`x86_64`) Linux installation.
What does the kernel panic message `VFS: Unable to mount root fs on unknown-block(0,0)` mean at boot?
This kernel panic means the Linux kernel started without a valid `initramfs` (initial RAM disk) image, usually because a system update was interrupted while generating `/boot/initrd.img-...` or because your `/boot` partition ran out of space during a kernel upgrade. Reboot, hold `Shift` or tap `Esc` to open the GRUB menu, select **"Advanced options"**, and boot into the previous older kernel listed right below the newest one. Once logged into your desktop on the older kernel, free up space in `/boot` with `sudo apt autoremove --purge` and rebuild the broken ramdisk with `sudo update-initramfs -c -k all && sudo update-grub`.
How can I temporarily bypass broken graphics drivers from the GRUB menu using `nomodeset`?
If your monitor turns completely black or loses signal right after the GRUB menu due to a GPU driver problem, reboot and tap `Esc` or hold `Shift` to open the GRUB menu. Highlight your Linux entry and press **`e`** on your keyboard. Use the arrow keys to find the line starting with `linux /boot/vmlinuz...`, move to the end of that line where it says `quiet splash`, and replace `quiet splash` with **`nomodeset`**. Press **`Ctrl + X`** or **`F10`** to boot. The `nomodeset` parameter tells the Linux kernel not to load hardware video drivers until after Xorg starts, using basic BIOS framebuffer graphics so you can see your screen and fix your GPU drivers.
Why did `grub-install` inside `chroot` warn that `EFI variables are not supported on this system`?
That error occurs for one of two reasons: either you accidentally booted your Live USB flash drive in **Legacy BIOS / CSM mode** instead of **UEFI mode** when selecting it in your motherboard's F12 boot menu (check by running `ls /sys/firmware/efi`, if that folder does not exist on the Live USB, reboot and select the `"UEFI: [USB Drive Name]"` entry in your BIOS boot menu), OR you forgot to bind-mount `/sys/firmware/efi/efivars` into `/mnt/sys/firmware/efi/efivars` before running `chroot /mnt`.
How do I prevent a secondary external or internal hard drive in `/etc/fstab` from ever crashing my Linux boot again?
Whenever you add any non-root storage drive (such as a second SSD, a RAID array, an external USB backup drive, or a network Samba/NFS share) to `/etc/fstab`, always include **`nofail,x-systemd.device-timeout=10`** in the fourth column (mount options), and set the sixth column (`pass` / `fsck` order) to **`0`** or **`2`**. With `nofail` enabled, if that drive is ever unplugged or fails, `systemd` waits only 10 seconds, logs a non-fatal warning, and boots normally into your desktop instead of dropping you into Emergency Mode.
急救認證和技術工作場所安全¶
硬體級啟動診斷通常需要打開桌上型機機箱、更換電源或檢查伺服器機架設備。技術人員面臨著因損壞的電容器、因鋒利的金屬板底盤造成的割傷以及因重型機架安裝硬體造成的擠壓傷而造成的嚴重電氣危險。如果發生觸電,請在接觸受害者之前立即斷開斷路器並致電緊急服務部門。在伺服器機房中,了解如何進行心肺復甦術和處理嚴重出血或休克與技術故障排除一樣重要。我們建議透過紅十字會、聖約翰救護車或國家安全機構完成認可的急救、心肺復甦術/自動體外心臟去顫器以及工作場所健康和安全課程。
來源已檢查¶
- GNU Project / Free Software Foundation (International): Official GNU GRUB Manual 2.12 , Booting from
grub>和grub rescue>命令外殼(gnu.org/software/grub/manual)。 - Linux 核心檔案和 Kernel.org(國際):核心參數 (
admin-guide/kernel-parameters.txt),initramfs早期的使用者空間和檔案系統管理(docs.kernel.org)。 - 規範/Ubuntu 伺服器和桌面文件(英國/國際):GRUB2 開機載入程式復原、LiveCD Chroot 過程和磁碟空間管理(
help.ubuntu.com,ubuntu.com/server/docs)。 - Red Hat Enterprise Linux (RHEL) 和 Fedora 專案文件(美國):使用下列命令排除引導問題
dracut,xfs_repair, 和grub2-mkconfig(docs.redhat.com,docs.fedoraproject.org)。 - Arch Linux Wiki (International): GRUB, Chroot,
fstab, 和mkinitcpioTechnical Reference (wiki.archlinux.org)。 - Freedesktop.org / systemd Documentation (International):
systemd.unitEmergency and Rescue Targets,journalctlVacuuming, andsystemd.mountOptions (freedesktop.org/software/systemd/man)。