启动已满,无法通过 apt-get 进行升级

启动已满,无法通过 apt-get 进行升级

我已遵循在互联网上找到的大多数说明和清除启动,我对 Linux 有点陌生,我主要将其用于 Web 开发测试,但我很擅长遵循命令说明 ;)

不幸的是我的机器似乎被卡住了,/boot 已满,而我无法想出正确的步骤来清除它。

我认为我无法清理启动,因为内核 39 正在等待安装,但我可以将其从等待安装中删除,因为启动已满?

这是我尝试的步骤顺序:

pedro@lamp01:~$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run âapt-get -f installâ to correct these.
The following packages have unmet dependencies.
 linux-image-generic-lts-quantal : Depends: linux-image-3.5.0-39-generic but it is not installed
E: Unmet dependencies. Try using -f.


pedro@lamp01:~$ sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies.
 linux-headers-generic-lts-quantal : Depends: linux-headers-3.5.0-39-generic but it is not going to be installed
 linux-image-generic-lts-quantal : Depends: linux-image-3.5.0-39-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).


pedro@lamp01:~$ 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.5.0-32-generic linux-headers-3.5.0-27-generic
  linux-headers-3.5.0-30-generic linux-headers-3.5.0-28-generic
  linux-headers-3.5.0-30 linux-headers-3.5.0-31 linux-headers-3.5.0-26
  linux-headers-3.5.0-32 linux-headers-3.5.0-27 linux-headers-3.5.0-28
  linux-headers-3.5.0-31-generic linux-headers-3.5.0-26-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  linux-image-3.5.0-39-generic
Suggested packages:
  fdutils linux-lts-quantal-doc-3.5.0 linux-lts-quantal-source-3.5.0
  linux-lts-quantal-tools
The following NEW packages will be installed
  linux-image-3.5.0-39-generic
0 upgraded, 1 newly installed, 0 to remove and 27 not upgraded.
3 not fully installed or removed.
Need to get 0 B/40.7 MB of archives.
After this operation, 157 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
(Reading database ... 269199 files and directories currently installed.)
Unpacking linux-image-3.5.0-39-generic (from .../linux-image-3.5.0-39-generic_3.5.0-39.60~precise1_amd64.deb) ...
Done.
dpkg: error processing /var/cache/apt/archives/linux-image-3.5.0-39-generic_3.5.0-39.60~precise1_amd64.deb (--unpack):
 failed in write on buffer copy for backend dpkg-deb during `./boot/vmlinuz-3.5.0-39-generic': 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.5.0-39-generic /boot/vmlinuz-3.5.0-39-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.5.0-39-generic /boot/vmlinuz-3.5.0-39-generic
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-3.5.0-39-generic_3.5.0-39.60~precise1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
pedro@lamp01:~$

有点奇怪,自动删除似乎强制安装,当前内核是 37:

pedro@lamp01:~$ uname -a
Linux lamp01 3.5.0-37-generic #58~precise1-Ubuntu SMP Wed Jul 10 17:48:11 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

有人可以帮忙吗?

答案1

由于我没有类似的设置,我无法判断其中任何一个的效果如何,所以在尝试任何方法之前进行备份!话虽如此,您可以尝试以下操作:

  1. 使用dpkg删除旧内核并安装新内核。例如:

    $ sudo dpkg -r linux-headers-3.5.0-28-generic
    
  2. 如果仍然不起作用,您可以尝试将一些较旧的内核文件暂时移动到其他位置(根分区、一些笔式驱动器等),安装新内核,然后删除旧内核,同时将内核文件移动到其默认位置;

  3. 您可以尝试暂时“移动”您的/boot挂载点(假设您有足够的空间/)。这将采取以下步骤:

    • 卸载您的 /boot 挂载点:sudo umount /boot
    • 将其安装在其他任何地方:sudo mount /dev/**your boot partition** /mnt
    • 将文件从 /mnt 移动到 /boot:您可以使用gksu nautilussudo mv来执行此操作。
    • 执行您想要的更改(安装新内核,删除旧内核);
    • 将文件从 /mnt 复制回 /boot;

还请注意,如果您使用 LVM,调整分区大小会容易得多(您甚至不需要停止任何操作/重新启动/使用 live cd)。因此,如果是这种情况,只需增加分区lvextend上的空间即可。/boot

答案2

我确信如果你这样做,df -h你会发现你的/boot分区已满。

braiam@bt:~$ df -h
文件系统大小已使用可用使用率%安装于
/dev/sda7 14G 9.8G 3.3G 76% /
/dev/sda5 922M 40M 819M 5% /boot

发生这种情况的原因是您将它弄得太小,或者您将一些不需要的内核砸碎,或者您只是用 Grub 的独角兽背景填充了它……无论哪种情况,都有 2 个简单的解决方案:

  1. 卸载过时的内​​核。

    sudo apt-get -y autoremove
    sudo apt-get -f install
    
  2. 把你的/boot分区弄大一点。

    这要求您启动 Live OS,然后调整分区大小。

相关内容