手动清理/boot

手动清理/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 文件夹中找到了内核。

答案1

手动清理/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。对于要删除的每个包,按_(清除)或(删除)。按 查看更改,然后再次-按。gg

相关内容