Kernel
/dev/sda1/boot 已滿
所以我的 Ubuntu VM /boot 現在已經滿了,我知道我很久以前就設法解決了這個問題,但現在我所做的一切似乎都行不通。
xxx@ubuntu:~$ df -h Filsystem Storlek Använt Ledigt Anv% Monterat på udev 2,0G 0 2,0G 0% /dev tmpfs 396M 6,1M 390M 2% /run /dev/mapper/ubuntu--vg-root 45G 6,4G 37G 15% / tmpfs 2,0G 0 2,0G 0% /dev/shm tmpfs 5,0M 0 5,0M 0% /run/lock tmpfs 2,0G 0 2,0G 0% /sys/fs/cgroup /dev/sda1 472M 469M 0 100% /boot /dev/sdb1 689G 77G 578G 12% /mnt/VIDEO_RECORDING tmpfs 396M 0 396M 0% /run/user/1000
我正在執行 GNU/Linux 4.4.0-145-generic x86_64,如果我執行:
dpkg --list | grep linux-image
我得到了很多核心映像。所以因為它已滿,我想嘗試刪除:
sudo apt autoremove
和:
sudo apt-get purge linux-image-4.4.0-101-generic
我得到:
Läser paketlistor… Färdig Bygger beroendeträd Läser tillståndsinformation… Färdig Du bör köra ”apt-get -f install” för att korrigera dessa. Följande paket har beroenden som inte kan tillfredsställas: linux-image-generic : Beroende av: linux-image-4.4.0-150-generic men det är inte installerat eller linux-image-unsigned-4.4.0-150-generic men det är inte installerat Rekommenderar: thermald men det är inte installerat linux-modules-extra-4.4.0-150-generic : Beroende av: linux-image-4.4.0-150-generic men det är inte installerat eller linux-image-unsigned-4.4.0-150-generic men det är inte installerat
是的,我知道這是瑞典語,但它說它依賴於 linux-image-4.4.0-150-generic,但它沒有安裝。所以它建議我執行:
apt-get -f install
然後它嘗試下載 linux-image-4.4.0-150-generic 但由於空間不足當然會失敗。我確信我找到了一些方法來實際使用 rm 命令手動刪除核心映像,但我不知道它們的核心映像儲存在哪裡,我也嘗試安裝 byobu,以幫助我刪除核心映像但沒有空間……你知道..
那麼,我現在的解決方案是手動刪除核心映像嗎?如果如何?
謝謝!
xxx@ubuntu:/boot$ dpkg --list | grep linux-image rc linux-image-4.4.0-101-generic 4.4.0-101.124 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc linux-image-4.4.0-103-generic 4.4.0-103.126 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc linux-image-4.4.0-104-generic 4.4.0-104.127 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc linux-image-4.4.0-108-generic 4.4.0-108.131 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc linux-image-4.4.0-109-generic 4.4.0-109.132 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc linux-image-4.4.0-112-generic 4.4.0-112.135 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc linux-image-4.4.0-116-generic 4.4.0-116.140 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc linux-image-4.4.0-119-generic 4.4.0-119.143 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc linux-image-4.4.0-121-generic 4.4.0-121.145 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc linux-image-4.4.0-124-generic 4.4.0-124.148 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc linux-image-4.4.0-127-generic 4.4.0-127.153 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc linux-image-4.4.0-128-generic 4.4.0-128.154 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc linux-image-4.4.0-130-generic 4.4.0-130.156 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP pi linux-image-4.4.0-133-generic 4.4.0-133.159 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP ii linux-image-4.4.0-134-generic 4.4.0-134.160 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP ii linux-image-4.4.0-137-generic 4.4.0-137.163 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP ii linux-image-4.4.0-138-generic 4.4.0-138.164 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP ii linux-image-4.4.0-139-generic 4.4.0-139.165 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP ii linux-image-4.4.0-141-generic 4.4.0-141.167 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP ii linux-image-4.4.0-142-generic 4.4.0-142.168 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP ii linux-image-4.4.0-143-generic 4.4.0-143.169 amd64 Signed kernel image generic ii linux-image-4.4.0-145-generic 4.4.0-145.171 amd64 Signed kernel image generic iF linux-image-4.4.0-148-generic 4.4.0-148.174 amd64 Signed kernel image generic rc linux-image-4.4.0-87-generic 4.4.0-87.110 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc linux-image-extra-4.4.0-101-generic 4.4.0-101.124 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP rc linux-image-extra-4.4.0-103-generic 4.4.0-103.126 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP rc linux-image-extra-4.4.0-104-generic 4.4.0-104.127 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP rc linux-image-extra-4.4.0-108-generic 4.4.0-108.131 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP rc linux-image-extra-4.4.0-109-generic 4.4.0-109.132 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP rc linux-image-extra-4.4.0-112-generic 4.4.0-112.135 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP rc linux-image-extra-4.4.0-116-generic 4.4.0-116.140 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP rc linux-image-extra-4.4.0-119-generic 4.4.0-119.143 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP rc linux-image-extra-4.4.0-121-generic 4.4.0-121.145 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP rc linux-image-extra-4.4.0-124-generic 4.4.0-124.148 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP rc linux-image-extra-4.4.0-127-generic 4.4.0-127.153 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP rc linux-image-extra-4.4.0-128-generic 4.4.0-128.154 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP rc linux-image-extra-4.4.0-130-generic 4.4.0-130.156 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP ii linux-image-extra-4.4.0-133-generic 4.4.0-133.159 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP ii linux-image-extra-4.4.0-134-generic 4.4.0-134.160 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP ii linux-image-extra-4.4.0-137-generic 4.4.0-137.163 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP ii linux-image-extra-4.4.0-138-generic 4.4.0-138.164 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP ii linux-image-extra-4.4.0-139-generic 4.4.0-139.165 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP ii linux-image-extra-4.4.0-141-generic 4.4.0-141.167 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP ii linux-image-extra-4.4.0-142-generic 4.4.0-142.168 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP rc linux-image-extra-4.4.0-87-generic 4.4.0-87.110 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP iU linux-image-generic 4.4.0.150.158 amd64 Generic Linux kernel image
xxx@ubuntu:/boot$ sudo du /boot 2355 /boot/grub/fonts 2118 /boot/grub/i386-pc 253 /boot/grub/locale 7121 /boot/grub 12 /boot/lost+found 477697 /boot
是的,我在 /boot 文件夾中找到了核心。
手動清理
/boot
進入
/boot
目錄:cd /boot
獲取所有文件的列表:
ls
獲取目前執行的核心版本:
uname -r
刪除舊核心和 initramdisk。保留目前執行的核心及其 initrd。
rm FILE_NAME FILE_NAME FILE_NAME # Maybe you should use `sudo`: sudo rm FILE_NAME FILE_NAME FILE_NAME
(只需複制和粘貼文件名)
正確的清理方法
Install
aptitude
,它是基於菜單的包管理器:sudo apt-get install aptitude
執行能力:
sudo aptitude
查找(鍵
/
)文本linux-image
,按Enter
。對於要刪除的每個包,按_
(purge) 或(remove)。-
按g
查看更改,然後再按g
一次。