Dkpg very very broken, how to repair / start from clean slate?

1

I am using Ubuntu 10.04. I inherited this set up from a previous employee who was supposed to be administering this machine, so I can not tell you what happened in the lead up to this problem.

Basically, dpkg is somehow broken beyond any function, it can not do anything. Consequently, all the various wrappers to dpkg fail too. Let's take a very simple example like apt-get install vim.

apt-get install vim
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:
  adduser: Depends: perl-base (>= 5.6.0) but it is not going to be installed
           Depends: debconf but it is not going to be installed or
                    debconf-2.0
  bash-completion: Depends: bash (>= 3.1dfsg-9) but it is not going to be installed
  bsdmainutils: Depends: debianutils (>= 1.8) but it is not going to be installed
  ca-certificates: Depends: debconf (>= 0.5) but it is not going to be installed or
                            debconf-2.0
  cron: Depends: debianutils (>= 1.7) but it is not going to be installed
  debconf-i18n: Depends: debconf but it is not going to be installed
            Depends: liblocale-gettext-perl but it is not going to be installed
  gnupg: Depends: dpkg (>= 1.15.4) but it is not going to be installed or
                  install-info but it is not going to be installed
  ifupdown: Depends: debconf (>= 1.2.0) but it is not going to be installed or
                 debconf-2.0
  initramfs-tools: Depends: findutils (>= 4.2.24) but it is not going to be installed
                   Depends: util-linux (> 2.15~rc1) but it is not going to be installed
  initscripts: Depends: mount (>= 2.11x-1) but it is not going to be installed
               Depends: debianutils (>= 2.13.1) but it is not going to be installed
               Recommends: e2fsprogs but it is not going to be installed
  libc6: Depends: debconf (>= 0.5) but it is not going to be installed or
                  debconf-2.0
         Depends: findutils (>= 4.4.0-2ubuntu2) but it is not going to be installed
  libc6-dev: Depends: libc-dev-bin (= 2.11.1-0ubuntu7.12) but it is not going to be     installed
             Depends: linux-libc-dev but it is not going to be installed
             Recommends: gcc but it is not going to be installed or
                         c-compiler
  libgdbm3: Depends: dpkg (>= 1.15.4) but it is not going to be installed or
                     install-info but it is not going to be installed
  libhtml-parser-perl: Depends: perlapi-5.10.0
  libpam-runtime: Depends: debconf (>= 1.5.19) but it is not going to be installed
                  Depends: libpam-modules (>= 1.0.1-6) but it is not going to be installed
  libpam0g: Depends: debconf (>= 0.5) but it is not going to be installed or
                     debconf-2.0
  libssl0.9.8: Depends: debconf (>= 0.5) but it is not going to be installed or
                        debconf-2.0
  libtext-charwidth-perl: Depends: perl-base (>= 5.10.0-24ubuntu4) but it is not going     to be installed
                          Depends: perlapi-5.10.0
  libtext-iconv-perl: Depends: perl-base (>= 5.10.0-24ubuntu4) but it is not going to be installed
                      Depends: perlapi-5.10.0
  lsb-base: Depends: sed but it is not going to be installed
            Depends: ncurses-bin but it is not going to be installed
  mountall: Depends: coreutils (>= 7.1) but it is not going to be installed
  passwd: Depends: libpam-modules but it is not going to be installed
          Depends: debianutils (>= 2.15.2) but it is not going to be installed
  perl: Depends: perl-base (= 5.10.1-8ubuntu2.3) but it is not going to be installed
  python-minimal: Depends: dpkg (>= 1.13.20) but it is not going to be installed
  readline-common: Depends: dpkg (>= 1.15.4) but it is not going to be installed or
                            install-info but it is not going to be installed
  snort-rules-default: Depends: debconf (>= 0.2.80) but it is not going to be     installed or
                                debconf-2.0
  sysv-rc: Depends: debconf but it is not going to be installed or
                    debconf-2.0
  tzdata: Depends: debconf (>= 0.5) but it is not going to be installed or
                   debconf-2.0
  ucf: Depends: debconf (>= 1.5.19) but it is not going to be installed
       Depends: coreutils (>= 5.91) but it is not going to be installed
  udev: Depends: util-linux (> 2.15~rc2) but it is not going to be installed
  vim: Depends: vim-common (= 2:7.2.330-1ubuntu3.1) but it is not going to be installed
       Depends: vim-runtime (= 2:7.2.330-1ubuntu3.1) but it is not going to be     installed
       Depends: libpython2.6 (>= 2.6) but it is not going to be installed
  wget: Depends: dpkg (>= 1.15.4) but it is not going to be installed or
                 install-info but it is not going to be installed
  xml-core: Depends: sed (>= 4.1.2-8) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Yes, I did try apt-get if install and predictably it did nothing useful

    apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  base-files bash coreutils dash debconf debianutils dpkg findutils gawk libc-dev-bin liblocale-gettext-perl libpam-modules linux-libc-dev manpages manpages-dev mount ncurses-bin perl-base sed util-linux
Suggested packages:
  bash-doc debconf-doc debconf-utils whiptail dialog gnome-utils libterm-readline-gnu-perl libgnome2-perl libnet-ldap-perl mlocate locate slocate man-browser nfs-common util-linux-locales kbd console-tools
  dosfstools
The following NEW packages will be installed:
  base-files bash coreutils dash debconf debianutils dpkg findutils gawk libc-dev-bin liblocale-gettext-perl libpam-modules linux-libc-dev manpages manpages-dev mount ncurses-bin perl-base sed util-linux
0 upgraded, 20 newly installed, 0 to remove and 7 not upgraded.
150 not fully installed or removed.
Need to get 13.4MB of archives.
After this operation, 49.6MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://mirrors.voxel.net/ubuntu/ lucid-updates/main coreutils 7.4-2ubuntu3 [2,907kB]
Get:2 http://mirrors.voxel.net/ubuntu/ lucid-updates/main dpkg 1.15.5.6ubuntu4.6 [2,252kB]
Get:3 http://mirrors.voxel.net/ubuntu/ lucid-updates/main perl-base 5.10.1-8ubuntu2.3 [1,084kB]
Get:4 http://mirrors.voxel.net/ubuntu/ lucid/main liblocale-gettext-perl 1.05-6 [22.0kB]
Get:5 http://mirrors.voxel.net/ubuntu/ lucid/main debconf 1.5.28ubuntu4 [148kB]
Get:6 http://mirrors.voxel.net/ubuntu/ lucid/main findutils 4.4.2-1ubuntu1 [480kB]
Get:7 http://mirrors.voxel.net/ubuntu/ lucid/main gawk 1:3.1.6.dfsg-4build1 [550kB]
Get:8 http://mirrors.voxel.net/ubuntu/ lucid-updates/main base-files 5.0.0ubuntu20.10.04.5 [70.3kB]
Get:9 http://mirrors.voxel.net/ubuntu/ lucid-updates/main libpam-modules 1.1.1-2ubuntu5.6 [392kB]
Get:10 http://mirrors.voxel.net/ubuntu/ lucid/main debianutils 3.2.2 [50.0kB]
Get:11 http://mirrors.voxel.net/ubuntu/ lucid-updates/main mount 2.17.2-0ubuntu1.10.04.2 [183kB]
Get:12 http://mirrors.voxel.net/ubuntu/ lucid/main sed 4.2.1-6 [180kB]
Get:13 http://mirrors.voxel.net/ubuntu/ lucid/main ncurses-bin 5.7+20090803-2ubuntu3 [312kB]
Get:14 http://mirrors.voxel.net/ubuntu/ lucid-updates/main util-linux 2.17.2-0ubuntu1.10.04.2 [572kB]
Get:15 http://mirrors.voxel.net/ubuntu/ lucid/main dash 0.5.5.1-3ubuntu2 [105kB]
Get:16 http://mirrors.voxel.net/ubuntu/ lucid/main bash 4.1-2ubuntu3 [702kB]
Get:17 http://mirrors.voxel.net/ubuntu/ lucid-updates/main libc-dev-bin 2.11.1-0ubuntu7.12 [225kB]
Get:18 http://mirrors.voxel.net/ubuntu/ lucid-updates/main linux-libc-dev 2.6.32-50.112 [870kB]
Get:19 http://mirrors.voxel.net/ubuntu/ lucid/main manpages 3.23-1 [716kB]
Get:20 http://mirrors.voxel.net/ubuntu/ lucid/main manpages-dev 3.23-1 [1,547kB]
Fetched 13.4MB in 1s (8,720kB/s)   
E: Could not perform immediate configuration on already unpacked 'libattr1'.Please see man 5 apt.conf under APT::Immediate-Configure for details.

And yes, I did try apt-get install -o APT::Immediate-Configure=false -f which results in the error:

E: Couldn't configure pre-depend perl-base for liblocale-gettext-perl, probably a dependency cycle.

And yes I have tried all manner of apt-get clean apt-get autoclean apt-get update and apt-get upgrade all with no useful outcome.

I have also inspected the sources.list file and it appears healthy for my version of ubuntu.

My observations: Something is very wrong, because it is failing to recognize that many packages are already installed. Bash for instance, is definitely installed. So is perl. So is adduser... and when I tried to use aptitude to fix the problem, the aptitude interface reported that one of the newly installed packages it was going to install was aptitutde. Anyway, predictably, aptitude failed.

So what is my next course of action here?

Radmilla Mustafa

Posted 2013-08-12T19:09:57.247

Reputation: 205

Are you sure that apt-get -f install and apt-get install -f are the same thing? – Etan Reisner – 2013-08-12T19:33:36.423

I would give clean, update, check (in that order) a try. Also note that for -f the man page explicitly states that If packages are specified, these have to completely correct the problem.. Also see man 8 apt-get, particularly -f and -m. – a CVn – 2013-08-12T19:33:38.660

@EtanReisner Good catch, it doesn't look like it is, at least according to the man page. -f should always come before the command (update, install, remove, ...). – a CVn – 2013-08-12T19:34:37.930

1What is the output of sudo dpkg -C ? – Darth Android – 2013-08-12T19:35:25.643

the output from dpkg -C is quite long, it is included below – Radmilla Mustafa – 2013-08-12T19:42:41.793

output was too long for superuser post, it is at this pastebin: – Radmilla Mustafa – 2013-08-12T19:43:34.000

http://pastebin.com/mbx1bzYm

sorry for the triple post....i hit enter for a new line and superuser made a post out of it....

and i tried the apt-get install command with the -f on one side of the install and then the other. both variants seemed to have the same output, but good catch on the subtle differences, despite them not helping me

– Radmilla Mustafa – 2013-08-12T19:44:33.223

1Good Lord. Take the poor thing out back and put it out of its misery. – Aaron Miller – 2013-08-12T20:08:23.467

yeah, that's more or less what I was thinking....dpkg is reporting so many broken packages, I wouldn't even know where to begin...and some of those packages just simply shouldn't ever have been messed with at all. cron? adduser? perl? I don't know what the admin did before me...but that's part of why I was hired, no one knew what the admin was doing. – Radmilla Mustafa – 2013-08-12T20:23:42.137

No answers