Não é possível remover imagens antigas da inicialização

1

Minha partição de inicialização está cheia e tentei seguir a solução encontrada aqui: link

Running:
    dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)//")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*//;/[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

No entanto, quando executo o comando sudo apt-get -y purge linux-image-3.2.0-31-generic para remover uma imagem mais antiga, recebo este problema:

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).

Eu corro sudo apt-get -f install e isso apenas me diz que minha partição de inicialização está cheia:

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)

A execução de apt-get autoremove me fornece:

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.

Parece que estou em um loop. Como posso corrigir esse problema para finalmente atualizar meu servidor? Eu estou no 12.04

Editar 1: Ao tentar remover uma imagem na inicialização:     sudo rm /boot/initrd.img-3.2.0-31-generic     sudo apt-get -y purgar linux-image-3.2.0-31-genérico Eu recebo:

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).

Eu então tento executar o apt-get -f install e recebo este erro:

    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)
    
por joshmmo 24.07.2013 / 20:21

2 respostas

1

Em toda a saída de erros que você forneceu, há uma parte importante: No space left on device . Isso indica que seu disco está cheio. Um disco inteiro pode levar a pacotes deixados em um estado não configurado, resultando nos erros de dependência que você está vendo.

A única coisa sensata aqui é liberar algum espaço. Por exemplo, remova manualmente a imagem initrd:

sudo rm /boot/initrd.img-3.2.0-31-generic

tente novamente sudo apt-get -f install , depois purgar o pacote

sudo apt-get -y purge linux-image-3.2.0-31-generic

Se você obtiver outro No space left on device , remova mais um initrd.img e tente novamente.

    
por Eric Carvalho 24.07.2013 / 20:47
-1

Tente o seguinte comando:

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
    
por vineet 03.01.2014 / 10:06