使用 Ubantu 一段時間後發現無法更新系統了,在更新系統時提示如下:
這個更新需要花去 99.6 M 磁盤上總計 /boot 的空間。請在 31.2 M 磁盤上留出 /boot 空間。清空您的回收站和臨時文件,用“sudo apt-get clean”清理以前的安裝文件。
linux更新系統 /boot容量不足linux更新系統 /boot容量不足
當時使用命令 sudo apt-get clean
清理系統,然而並沒有什麼卵用。
原因
在裝Ubuntu Linux的時候,一般都會把/boot單獨分區,給200M左右的空間。這樣以後更新內核的時候,系統把新內核添加到/boot下,但是沒有刪除舊內核;內核越來越多,導致空間不足,從而引起無法更新系統。由於是舊內核沒有刪除造成的/boot分區容量不足,所以我們可以通過刪除舊內核的方法來解決。
解決方法
1、查看當前使用內核版本號。輸入 uname -a
查看。
lixinxing@lixinxing--Ideapad:~$ uname -a
Linux lixinxing--Ideapad 3.19.0-16-generic #16-Ubuntu SMP Thu Apr 30 16:09:58 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
2、刪除舊內核。輸入命令:sudo apt-get remove linux-image-
接着按兩下tab鍵,將顯示所有的內核版本;把目前使用的版本之前的版本全部刪除就行了。
lixinxing@lixinxing--Ideapad:~$ sudo apt-get remove
linux-image-
linux-image-3.19.0-15-generic linux-image-extra-3.19.0-16-generic
linux-image-3.19.0-16-generic linux-image-generic
linux-image-extra-3.19.0-15-generic
3、我們選擇卸載舊版本“linux-image-3.19.0-15-generic”。輸入命令: sudo
apt-get remove linux-image-3.19.0-15-generic
4、查看卸載舊內核後 /boot 分區容量。
lixinxing@lixinxing--Ideapad:~$ sudo du -m /boot
1 /boot/lost+found
3 /boot/grub/fonts
1 /boot/grub/locale
3 /boot/grub/x86_64-efi
8 /boot/grub
1 /boot/efi/EFI/Microsoft/Boot/zh-CN
1 /boot/efi/EFI/Microsoft/Boot/zh-TW
13 /boot/efi/EFI/Microsoft/Boot/Fonts
25 /boot/efi/EFI/Microsoft/Boot
25 /boot/efi/EFI/Microsoft
2 /boot/efi/EFI/Boot
4 /boot/efi/EFI/ubuntu
29 /boot/efi/EFI
29 /boot/efi
84 /boot
這裏可以看出卸載舊內核後 /boot 分區只有 84Mb 大小了。