我怎样才能释放 (足够大的) /boot 空间?

我怎样才能释放 (足够大的) /boot 空间?

我正在尝试按照以下步骤将 Plex Media Server 安装到我的 Ubuntu 服务器(14.04.2 LTS)指导但是当我安装 Docker 时,运行命令时出现以下问题sudo apt-get install linux-image-extra-$(uname -r)

$ sudo apt-get install linux-image-extra-$(uname -r)
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-image-extra-3.13.0-53-generic is already the newest version.
linux-image-extra-3.13.0-53-generic set to manually installed.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 linux-image-extra-3.13.0-68-generic : Depends: linux-image-3.13.0-68-generic but it is not going to be installed
 linux-image-generic : Depends: linux-image-3.13.0-68-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

然后,当我尝试运行该命令时apt-get -f install出现以下错误:

$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  linux-headers-3.13.0-48 linux-headers-3.13.0-48-generic
  linux-headers-3.13.0-54 linux-headers-3.13.0-54-generic
  linux-image-3.13.0-48-generic linux-image-3.13.0-54-generic
  linux-image-extra-3.13.0-48-generic linux-image-extra-3.13.0-54-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  linux-image-3.13.0-68-generic
Suggested packages:
  fdutils linux-doc-3.13.0 linux-source-3.13.0 linux-tools
The following NEW packages will be installed:
  linux-image-3.13.0-68-generic
0 upgraded, 1 newly installed, 0 to remove and 205 not upgraded.
9 not fully installed or removed.
Need to get 0 B/15.2 MB of archives.
After this operation, 42.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 316302 files and directories currently installed.)
Preparing to unpack .../linux-image-3.13.0-68-generic_3.13.0-68.111_amd64.deb ...
Done.
Unpacking linux-image-3.13.0-68-generic (3.13.0-68.111) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-3.13.0-68-generic_3.13.0-68.111_amd64.deb (--unpack):
 cannot copy extracted data for './boot/System.map-3.13.0-68-generic' to '/boot/System.map-3.13.0-68-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-68-generic /boot/vmlinuz-3.13.0-68-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-68-generic /boot/vmlinuz-3.13.0-68-generic
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-3.13.0-68-generic_3.13.0-68.111_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

现在,通过阅读错误消息,我知道/boot/驱动器已满,而且看起来$ df -h确实已满。但是清空驱动器的最佳方法是什么,或者我是否可以将其移动/boot/到更大的分区而不影响主驱动器上的所有文件?

**更新**

我的输出如下df -h

$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-root  1.8T  1.5T  256G  86% /
none                         4.0K     0  4.0K   0% /sys/fs/cgroup
udev                         968M  8.0K  968M   1% /dev
tmpfs                        196M  1.2M  195M   1% /run
none                         5.0M     0  5.0M   0% /run/lock
none                         980M  4.0K  980M   1% /run/shm
none                         100M     0  100M   0% /run/user
/dev/sda1                    236M  230M     0 100% /boot

这是我的输出dpkg -l 'linux-image*' | grep ^ii

$ dpkg -l 'linux-image*' | grep ^ii
ii  linux-image-3.13.0-43-generic            3.13.0-43.72                         amd64        Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-3.13.0-46-generic            3.13.0-46.79                         amd64        Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-3.13.0-48-generic            3.13.0-48.80                         amd64        Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-3.13.0-49-generic            3.13.0-49.83                         amd64        Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-3.13.0-51-generic            3.13.0-51.84                         amd64        Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-3.13.0-52-generic            3.13.0-52.86                         amd64        Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-3.13.0-53-generic            3.13.0-53.89                         amd64        Linux kernel image for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-extra-3.13.0-43-generic      3.13.0-43.72                         amd64        Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-extra-3.13.0-46-generic      3.13.0-46.79                         amd64        Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-extra-3.13.0-48-generic      3.13.0-48.80                         amd64        Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-extra-3.13.0-49-generic      3.13.0-49.83                         amd64        Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-extra-3.13.0-51-generic      3.13.0-51.84                         amd64        Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-extra-3.13.0-52-generic      3.13.0-52.86                         amd64        Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-extra-3.13.0-53-generic      3.13.0-53.89                         amd64        Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP

答案1

您的 /boot 目录已满!查找并删除不再使用的旧内核(apt-get purge linux-image-3.13.0-43-generic)。为什么有这么多?只需保留几个备用内核和一个新的内核即可。这也会缩短您的启动列表。

答案2

按照 askubuntu.com 上的指南解决了我的问题:

释放 /boot 文件系统上的空间 (显然在需要时将相关值替换为我自己的)

按照上述指南后,我运行了命令apt-get autoremove,清理了 /boot 分区上的一大堆空间。

现在我可以apt-get -f install再次运行该命令。

相关内容