我的启动分区已满,我尝试按照此处找到的解决方案进行操作: https://askubuntu.com/a/142937/178039
Running:
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d'
linux-headers-3.2.0-23
linux-headers-3.2.0-23-generic
linux-headers-3.2.0-25
linux-headers-3.2.0-25-generic
linux-headers-3.2.0-26
linux-headers-3.2.0-26-generic
linux-headers-3.2.0-27
linux-headers-3.2.0-27-generic
linux-headers-3.2.0-29
linux-headers-3.2.0-29-generic
linux-headers-3.2.0-31
linux-headers-3.2.0-31-generic
linux-headers-3.2.0-32
linux-headers-3.2.0-32-generic
linux-headers-3.2.0-33
linux-headers-3.2.0-33-generic
linux-headers-3.2.0-34
linux-headers-3.2.0-34-generic
linux-headers-3.2.0-35
linux-headers-3.2.0-35-generic
linux-headers-3.2.0-36
linux-headers-3.2.0-36-generic
linux-headers-3.2.0-37
linux-headers-3.2.0-37-generic
linux-headers-3.2.0-38
linux-headers-3.2.0-38-generic
linux-headers-3.2.0-40
linux-headers-3.2.0-40-generic
linux-headers-3.2.0-41
linux-headers-3.2.0-41-generic
linux-image-3.2.0-31-generic
linux-image-3.2.0-32-generic
linux-image-3.2.0-33-generic
linux-image-3.2.0-34-generic
linux-image-3.2.0-35-generic
linux-image-3.2.0-36-generic
linux-image-3.2.0-37-generic
linux-image-3.2.0-38-generic
但是,当我运行命令sudo apt-get -y purge linux-image-3.2.0-31-generic
删除旧图像时,出现此问题:
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
linux-server : Depends: linux-image-server (= 3.2.0.49.59) but 3.2.0.40.48 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
我运行它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.2.0-23-generic linux-headers-3.2.0-31-generic linux-headers-3.2.0-26-generic linux-image-3.2.0-37-generic linux-headers-3.2.0-23 linux-headers-3.2.0-25 linux-headers-3.2.0-31 linux-headers-3.2.0-26
linux-headers-3.2.0-32 linux-headers-3.2.0-27 linux-headers-3.2.0-33 linux-headers-3.2.0-34 linux-headers-3.2.0-29 linux-headers-3.2.0-36 linux-headers-3.2.0-37 linux-headers-3.2.0-38 linux-headers-3.2.0-34-generic
linux-headers-3.2.0-29-generic libspeex1 linux-headers-3.2.0-37-generic linux-headers-3.2.0-32-generic linux-headers-3.2.0-27-generic linux-image-3.2.0-38-generic libtheora0 daemon libservlet2.5-java linux-headers-3.2.0-38-generic
linux-headers-3.2.0-25-generic linux-headers-3.2.0-33-generic linux-headers-3.2.0-36-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
linux-image-3.2.0-49-generic linux-image-server
Suggested packages:
fdutils linux-doc-3.2.0 linux-source-3.2.0 linux-tools
The following NEW packages will be installed:
linux-image-3.2.0-49-generic
The following packages will be upgraded:
linux-image-server
1 upgraded, 1 newly installed, 0 to remove and 113 not upgraded.
7 not fully installed or removed.
Need to get 0 B/38.5 MB of archives.
After this operation, 150 MB of additional disk space will be used.
Do you want to continue [Y/n]?
(Reading database ... 487607 files and directories currently installed.)
Unpacking linux-image-3.2.0-49-generic (from .../linux-image-3.2.0-49-generic_3.2.0-49.75_amd64.deb) ...
Done.
dpkg: error processing /var/cache/apt/archives/linux-image-3.2.0-49-generic_3.2.0-49.75_amd64.deb (--unpack):
failed in write on buffer copy for backend dpkg-deb during `./boot/vmlinuz-3.2.0-49-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.2.0-49-generic /boot/vmlinuz-3.2.0-49-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-49-generic /boot/vmlinuz-3.2.0-49-generic
Errors were encountered while processing:
/var/cache/apt/archives/linux-image-3.2.0-49-generic_3.2.0-49.75_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
跑步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-server : Depends: linux-image-server (= 3.2.0.49.59) but 3.2.0.40.48 is installed
E: Unmet dependencies. Try using -f.
我似乎陷入了困境。我该如何修复这个问题,才能最终升级我的服务器?我现在使用的是 12.04
编辑1:当尝试在启动时删除映像时:sudo rm /boot/initrd.img-3.2.0-31-generic sudo apt-get -y purge linux-image-3.2.0-31-generic 我得到:
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-server : Depends: linux-image-server (= 3.2.0.49.59) but 3.2.0.40.48 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
然后我尝试运行 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.2.0-23-generic linux-headers-3.2.0-31-generic linux-headers-3.2.0-26-generic linux-image-3.2.0-37-generic linux-headers-3.2.0-23 linux-headers-3.2.0-25 linux-headers-3.2.0-31 linux-headers-3.2.0-26
linux-headers-3.2.0-32 linux-headers-3.2.0-27 linux-headers-3.2.0-33 linux-headers-3.2.0-34 linux-headers-3.2.0-29 linux-headers-3.2.0-36 linux-headers-3.2.0-37 linux-headers-3.2.0-38 linux-headers-3.2.0-34-generic
linux-headers-3.2.0-29-generic libspeex1 linux-headers-3.2.0-37-generic linux-headers-3.2.0-32-generic linux-headers-3.2.0-27-generic linux-image-3.2.0-38-generic libtheora0 daemon libservlet2.5-java linux-headers-3.2.0-38-generic
linux-headers-3.2.0-25-generic linux-headers-3.2.0-33-generic linux-headers-3.2.0-36-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
linux-image-server
The following packages will be upgraded:
linux-image-server
1 upgraded, 0 newly installed, 0 to remove and 113 not upgraded.
5 not fully installed or removed.
Need to get 0 B/2,370 B of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]?
Setting up linux-image-3.2.0-40-generic (3.2.0-40.64) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
The link /initrd.img is a dangling linkto /boot/initrd.img-3.2.0-49-generic
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.2.0-40-generic /boot/vmlinuz-3.2.0-40-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.2.0-40-generic /boot/vmlinuz-3.2.0-40-generic
update-initramfs: Generating /boot/initrd.img-3.2.0-40-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.2.0-40-generic /boot/vmlinuz-3.2.0-40-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.2.0-40-generic /boot/vmlinuz-3.2.0-40-generic
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-49-generic
Found linux image: /boot/vmlinuz-3.2.0-41-generic
Found linux image: /boot/vmlinuz-3.2.0-40-generic
Found initrd image: /boot/initrd.img-3.2.0-40-generic
Found linux image: /boot/vmlinuz-3.2.0-39-generic
Found initrd image: /boot/initrd.img-3.2.0-39-generic
Found linux image: /boot/vmlinuz-3.2.0-38-generic
Found initrd image: /boot/initrd.img-3.2.0-38-generic
Found linux image: /boot/vmlinuz-3.2.0-37-generic
Found initrd image: /boot/initrd.img-3.2.0-37-generic
Found linux image: /boot/vmlinuz-3.2.0-36-generic
Found initrd image: /boot/initrd.img-3.2.0-36-generic
Found linux image: /boot/vmlinuz-3.2.0-35-generic
Found initrd image: /boot/initrd.img-3.2.0-35-generic
Found linux image: /boot/vmlinuz-3.2.0-34-generic
Found linux image: /boot/vmlinuz-3.2.0-33-generic
Found linux image: /boot/vmlinuz-3.2.0-32-generic
Found linux image: /boot/vmlinuz-3.2.0-31-generic
Found memtest86+ image: /memtest86+.bin
done
Setting up linux-image-3.2.0-41-generic (3.2.0-41.66) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.2.0-41-generic /boot/vmlinuz-3.2.0-41-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.2.0-41-generic /boot/vmlinuz-3.2.0-41-generic
update-initramfs: Generating /boot/initrd.img-3.2.0-41-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.2.0-41-generic /boot/vmlinuz-3.2.0-41-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.2.0-41-generic /boot/vmlinuz-3.2.0-41-generic
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-49-generic
Found linux image: /boot/vmlinuz-3.2.0-41-generic
Found initrd image: /boot/initrd.img-3.2.0-41-generic
Found linux image: /boot/vmlinuz-3.2.0-40-generic
Found initrd image: /boot/initrd.img-3.2.0-40-generic
Found linux image: /boot/vmlinuz-3.2.0-39-generic
Found initrd image: /boot/initrd.img-3.2.0-39-generic
Found linux image: /boot/vmlinuz-3.2.0-38-generic
Found initrd image: /boot/initrd.img-3.2.0-38-generic
Found linux image: /boot/vmlinuz-3.2.0-37-generic
Found initrd image: /boot/initrd.img-3.2.0-37-generic
Found linux image: /boot/vmlinuz-3.2.0-36-generic
Found initrd image: /boot/initrd.img-3.2.0-36-generic
Found linux image: /boot/vmlinuz-3.2.0-35-generic
Found initrd image: /boot/initrd.img-3.2.0-35-generic
Found linux image: /boot/vmlinuz-3.2.0-34-generic
Found linux image: /boot/vmlinuz-3.2.0-33-generic
Found linux image: /boot/vmlinuz-3.2.0-32-generic
Found linux image: /boot/vmlinuz-3.2.0-31-generic
Found memtest86+ image: /memtest86+.bin
done
Setting up linux-image-3.2.0-49-generic (3.2.0-49.75) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.2.0-49-generic /boot/vmlinuz-3.2.0-49-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.2.0-49-generic /boot/vmlinuz-3.2.0-49-generic
update-initramfs: Generating /boot/initrd.img-3.2.0-49-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.2.0-49-generic /boot/vmlinuz-3.2.0-49-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.2.0-49-generic /boot/vmlinuz-3.2.0-49-generic
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-49-generic
Found initrd image: /boot/initrd.img-3.2.0-49-generic
Found linux image: /boot/vmlinuz-3.2.0-41-generic
Found initrd image: /boot/initrd.img-3.2.0-41-generic
Found linux image: /boot/vmlinuz-3.2.0-40-generic
Found initrd image: /boot/initrd.img-3.2.0-40-generic
Found linux image: /boot/vmlinuz-3.2.0-39-generic
Found initrd image: /boot/initrd.img-3.2.0-39-generic
Found linux image: /boot/vmlinuz-3.2.0-38-generic
Found initrd image: /boot/initrd.img-3.2.0-38-generic
Found linux image: /boot/vmlinuz-3.2.0-37-generic
Found initrd image: /boot/initrd.img-3.2.0-37-generic
Found linux image: /boot/vmlinuz-3.2.0-36-generic
Found initrd image: /boot/initrd.img-3.2.0-36-generic
Found linux image: /boot/vmlinuz-3.2.0-35-generic
Found initrd image: /boot/initrd.img-3.2.0-35-generic
Found linux image: /boot/vmlinuz-3.2.0-34-generic
Found linux image: /boot/vmlinuz-3.2.0-33-generic
Found linux image: /boot/vmlinuz-3.2.0-32-generic
Found linux image: /boot/vmlinuz-3.2.0-31-generic
Found memtest86+ image: /memtest86+.bin
done
Setting up linux-image-server (3.2.0.40.48) ...
dpkg: dependency problems prevent configuration of linux-server:
linux-server depends on linux-image-server (= 3.2.0.49.59); however:
Version of linux-image-server on system is 3.2.0.40.48.
dpkg: error processing linux-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
linux-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
在您提供的所有错误输出中,有一个重要部分:No space left on device
。这表示您的磁盘已满。磁盘已满可能会导致软件包处于未配置状态,从而导致您看到的依赖性错误。
这里唯一明智的做法是释放一些空间。例如,手动删除 initrd 映像:
sudo rm /boot/initrd.img-3.2.0-31-generic
再试sudo apt-get -f install
一次,然后清除包
sudo apt-get -y purge linux-image-3.2.0-31-generic
如果出现另一个情况,请No space left on device
删除另一个 initrd.img,然后重试。
答案2
尝试以下命令:
dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | grep -E "(image|headers)" | xargs sudo apt-get -y purge