Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

Ubuntu/Linux 常見問題解決大全:啟動失敗、圖形介面、密碼遺失、磁碟空間等

編輯:Linux 教學

一、系統啟動與核心問題

1. 系統無法啟動(MBR 損壞 / GRUB 錯誤)

方案 A:進入救援模式修復 GRUB 配置

  • 從 Live CD/USB 啟動,選擇 Rescue Mode。
  • 掛載根分區後編輯 /boot/grub/menu.lst(GRUB Legacy)或 /boot/grub/grub.cfg(GRUB2)。

方案 B:備份與還原 MBR

# 備份 MBR(含分區表,512 bytes)
dd if=/dev/sda of=/path/to/MBR-backup bs=512 count=1

# 還原 MBR(謹慎操作,會覆蓋分區表!)
dd if=/path/to/MBR-backup of=/dev/sda bs=512 count=1

⚠️ 僅還原開機程式碼(前 446 bytes)較安全:bs=446 count=1。

2. 卡在 Ubuntu Logo(啟動畫面凍結)

編輯 /boot/grub/menu.lst,找到 kernel 行,移除 splash 參數:

kernel /boot/vmlinuz-2.6.xx root=/dev/sda1 ro quiet

3. 無法進入圖形介面(X Server 配置錯誤)

sudo dpkg-reconfigure xserver-xorg
# 或手動編輯 /etc/X11/xorg.conf

4. 新增字體(僅當前使用者)

按 Alt+F2 → 輸入 fonts:/// → 將字體檔拖入開啟的資料夾。

5. 驗證 ISO 映像檔完整性

md5sum ubuntu-20.04.iso
# 對照官方提供的 MD5/SHA256 校驗碼

6. 顯示隱藏檔案

  • 檔案管理器:Ctrl+H 或選單 檢視 → 顯示隱藏檔案
  • 終端機:ls -a

7. 圖形介面無回應

  • 重啟 X: Alt+Ctrl+Backspace(需在配置啟用)
  • 切換 TTY 重啟 GDM: Alt+F2 登入 → sudo systemctl restart gdm(舊版 sudo /etc/init.d/gdm restart)

8. 釋放磁碟空間

# 清空垃圾桶
# 清理 APT 快取
sudo apt-get clean
sudo apt-get autoclean
# 移除孤立套件
sudo apt-get autoremove

9. 安裝 Windows 後 Ubuntu 無法啟動

Windows 覆寫了 MBR。使用 Ubuntu Live CD 進入救援模式:

grub-install /dev/sda
# 或 GRUB2:
grub-install --root-directory=/mnt /dev/sda
update-grub

10. 忘記使用者密碼

  1. 重啟,在 GRUB 選單按 e 編輯啟動參數。
  2. 在 linux 行尾加入 init=/bin/bash 或 single。
  3. 啟動後掛載根分區為可寫:mount -o remount,rw /
  4. 修改密碼:passwd username
  5. 重啟:exec /sbin/init 或 reboot -f

二、應用軟體問題

1. 無法關閉視窗程式

Alt+F2 → 輸入 xkill → 滑鼠變骷髏頭 → 點擊欲關閉視窗。

2. DVD 播放畫面抖動/跳幀

啟用光碟機 DMA 模式:

sudo hdparm -d1 /dev/sr0
# 永久生效:編輯 /etc/hdparm.conf
/dev/sr0 {
    dma = on
}

3. iptables 腳本範例(NAT 分享上網)

#!/bin/bash
IPTABLES=/usr/sbin/iptables
EXTIF=ppp0
INTIF=bnep0

echo 1 > /proc/sys/net/ipv4/ip_forward
$IPTABLES -F; $IPTABLES -X
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -m state --state NEW,ESTABLISHED -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 22 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 80 -j ACCEPT
Copyright © Windows教程網 All Rights Reserved