0

Apt keeps crashing when I try to run

apt-get upgrade

xxx@xxx:/root/# sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
  linux-generic linux-headers-generic linux-image-generic
The following packages will be upgraded:
  cvs dovecot-common dovecot-pop3d language-pack-en language-pack-en-base
  language-pack-gnome-en language-pack-gnome-en-base libgssapi-krb5-2
  libk5crypto3 libkrb5-3 libkrb5support0 libssl0.9.8 login openssl passwd
15 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
1 not fully installed or removed.
Need to get 0B/14.9MB of archives.
After this operation, 3,731kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Preconfiguring packages ...
(Reading database ...
dpkg: warning: files list file for package `cvs' missing, assuming package has no files currently installed.
(Reading database ... 141611 files and directories currently installed.)
Preparing to replace cvs 1:1.12.13-12ubuntu1 (using .../cvs_1%3a1.12.13-12ubuntu1_amd64.deb) ...
Unpacking replacement cvs ...

And it just hangs there :(, CTRL+C does nothing I've drive killing dpkg and apt afterwards with

sudo killall -9 dpkg
sudo killall -9 apt-get

but dpkg remains running :(

I managed to kill all processes at one point and tried to remove cvs (thinking that was the problem but I had no luck).

glisignoli
  • 123
  • 1
  • 2
  • 15

3 Answers3

2

Try this,

when you gt stuck in that situation background current process with CTRL+Z

that should give you shell again.

then do pgrep dpkg | xargs kill -9 # kill all processes matching string dpkg

pgrep apt-get | xargs kill -9 # kill all processes matching string apt-get

dpkg --purge cvs # remove currently installed cvs package

apt-get update # update package lists from your apt repositories

apt-get install cvs # install cvs package from the updated repositories

Hrvoje Špoljar
  • 5,245
  • 26
  • 42
  • xxx@xxx:~# dpkg --purge cvs dpkg: error processing cvs (--purge): Package is in a very bad inconsistent state - you should reinstall it before attempting a removal. Errors were encountered while processing: cvs – glisignoli Feb 18 '11 at 11:13
  • try "aptitude reinstall cvs" – Hrvoje Špoljar Feb 18 '11 at 11:15
  • hmm I don't think cvs is the problem now. I managed to remove cvs with: "sudo apt-get --purge remove --force cvs" but after trying a apt-get upgrade. It stalled on "Unpacking replacement login ..." – glisignoli Feb 18 '11 at 11:19
  • Ah and those commands arn't killing my dpkg processes. Weird... – glisignoli Feb 18 '11 at 11:26
  • and finally: "xxx@xxx:~# ps -aef |grep dpkg" tells me: root 11983 1 0 Feb16 ? 00:00:00 /usr/bin/dpkg --status-fd 25 --unpack --auto-deconfigure /var/cache/apt/archives/cvs_1%3a1.12.13-12ubuntu1_amd64.deb /var/cache/apt/archives/libparams-validate-perl_0.93-1_amd64.deb . Tried to kill it but I cant – glisignoli Feb 18 '11 at 11:31
  • if kill -9 11983 cant kill it I dont think anything but reboot will :/ – Hrvoje Špoljar Feb 18 '11 at 12:04
  • Yep a reboot solved it. Found this: http://arstechnica.com/phpbb/viewtopic.php?f=16&t=316926 – glisignoli Feb 18 '11 at 12:23
1

I'd first try to find out what the process is trying to do and why it might have gotten stuck there. This is most likely a problem that is somewhat independent from the missing list of files (which you've already solved by installing the exact same version of the package on top; dpkg will just generate a new file list from the new package then).

I think there may be something wrong with your file system, such as a loop of directory hardlinks or other inconsistency that confuses the kernel here; thus the first step for me in this situation would be to confirm this (e.g. by checking which kernel function the process is blocked in), and, if that is truly the case, to reboot and force a file system check.

Simon Richter
  • 3,317
  • 19
  • 19
  • Agreed. It doesn't look like a dpkg/apt error to me. Have a look at the output of `dmesg` and see if there's any underlying problem. Also, try `strace -fp ` to see what it's trying to do. – SmallClanger Feb 18 '11 at 12:24
1

Just ran into this bug myself - it's apparently known and actively worked on here:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/624877

Yang
  • 1,665
  • 6
  • 21
  • 35