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 清理舊核心釋放 /boot 空間:安全移除不再使用的 Linux Kernel

編輯:關於 Linux

Ubuntu 更新核心後舊版本不會自動移除,久而久之導致 /boot 分區滿載,影響後續更新。本文以 Ubuntu 為例,示範如何查詢當前核心、列出所有已安裝核心套件,並安全移除舊版本。

核心清理示意圖

查詢當前運行核心

uname -r
# 輸出範例:5.15.0-91-generic

列出所有已安裝核心套件

dpkg --list 'linux-image*' 'linux-headers*' 'linux-modules*' | grep ^ii

移除舊核心 (保留當前 + 至少一個備用)

# 範例:移除 5.15.0-88 版本
sudo apt-get purge linux-image-5.15.0-88-generic \
                   linux-headers-5.15.0-88 \
                   linux-headers-5.15.0-88-generic \
                   linux-modules-5.15.0-88-generic \
                   linux-modules-extra-5.15.0-88-generic

自動化清理 (慎用)

# 僅保留當前核心與最新一個舊核心
sudo apt-get autoremove --purge

更新 Grub 並驗證

sudo update-grub
reboot
uname -r   # 確認仍正常啟動

警告:切勿移除 linux-image-generic、linux-headers-generic 等元套件,否則未來更新將無法自動拉取新核心。

Copyright © Windows教程網 All Rights Reserved