開(kāi)機(jī)后系統(tǒng)提示我都boot還剩4M(我擦嘞痹换?!
打開(kāi)boot發(fā)現(xiàn)我有三個(gè)版本的內(nèi)核吹埠,每個(gè)40+M箫措。
自動(dòng)刪除命令
If your system is operating without error, you should be able to remove old kernels with a simple autoremove command in shell:
sudo apt-get autoremove --purge
in 16.04 and newer
sudo apt autoremove --purge
1.遇到一個(gè)問(wèn)題
執(zhí)行以上命令以后掂恕,提示錯(cuò)誤信息:
Errors were encountered while processing:
linux-image-extra-4.8.0-36-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
2.解決方案
For anyone who comes across this issue, use this resource http://www.khattam.info/solved-subprocess-pre-removal-script-returned-error-exit-status-2-error-2009-08-04.html#more-303
It fixed the problem for me. The packages: linux-image-2.3.0-54-virtual and linux-image were in the /var/lib/dpkg/status several times, there were doubles. Just use vim or nano, whichever your favorite editor is and remove the packages. Save it and then do sudo apt-get update. Then do sudo apt-get -f install.
Everything should work now.
手動(dòng)刪除內(nèi)核
1.查看當(dāng)前存在的內(nèi)核版本:
wycheng@wycheng-ThinkCentre-XXXX:~$ dpkg -l 'linux-image-*'|grep '^ii'
ii linux-image-4.10.0-30-generic 4.10.0-30.34~16.04.1 amd64 Linux kernel image for version 4.10.0 on 64 bit x86 SMP
ii linux-image-4.10.0-32-generic 4.10.0-32.36~16.04.1 amd64 Linux kernel image for version 4.10.0 on 64 bit x86 SMP
ii linux-image-extra-4.10.0-30-generic 4.10.0-30.34~16.04.1 amd64 Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
ii linux-image-extra-4.10.0-32-generic 4.10.0-32.36~16.04.1 amd64 Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
ii linux-image-generic-hwe-16.04 4.10.0.32.34 amd64 Generic Linux kernel image
2.卸載老的內(nèi)核之前,首先用uname -a查看當(dāng)前啟動(dòng)的是哪個(gè)內(nèi)核(防止把當(dāng)前正在使用的內(nèi)核卸載了):
wycheng@wycheng-ThinkCentre-XXXX:~$ uname -a
Linux wycheng-ThinkCentre-XXXX 4.10.0-32-generic #36~16.04.1-Ubuntu SMP Wed Aug 9 09:19:02 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
3.刪除指定內(nèi)核
wycheng@wycheng-ThinkCentre-XXXX:~$ sudo apt-get purge Linux-image-4.10.0-30-generic
參考
RemoveOldKernels
Errors were encountered while processing linux-image-3.2.0-54-virtual