apt-get update failed

Upgrade All Packages

Resynchronizing package list with command apt-get update ..

Hit http://ftp.ua.debian.org wheezy Release.gpg
Hit http://ftp.ua.debian.org wheezy Release
Hit http://ftp.ua.debian.org wheezy/main Sources
Hit http://security.debian.org wheezy/updates Release.gpg
Hit http://ftp.ua.debian.org wheezy/main i386 Packages
Hit http://ftp.ua.debian.org wheezy/main Translation-en
Hit http://ftp.ua.debian.org wheezy/main Translation-uk
Hit http://security.debian.org wheezy/updates Release
Hit http://security.debian.org wheezy/updates/main Sources
Hit http://security.debian.org wheezy/updates/contrib Sources
Hit http://software.virtualmin.com virtualmin-wheezy Release.gpg
Hit http://security.debian.org wheezy/updates/main i386 Packages
Hit http://security.debian.org wheezy/updates/main Translation-en
Hit http://software.virtualmin.com virtualmin-universal Release.gpg
Hit http://software.virtualmin.com virtualmin-wheezy Release
Hit http://software.virtualmin.com virtualmin-universal Release
Hit http://software.virtualmin.com virtualmin-wheezy/main i386 Packages
Hit http://software.virtualmin.com virtualmin-universal/main i386 Packages
Ign http://software.virtualmin.com virtualmin-wheezy/main Translation-en
Ign http://software.virtualmin.com virtualmin-wheezy/main Translation-uk
Ign http://software.virtualmin.com virtualmin-universal/main Translation-en
Ign http://software.virtualmin.com virtualmin-universal/main Translation-uk
Read error - read (21: Is a directory)
The package lists or status file could not be parsed or opened.
Can't call method "policy" on an undefined value at /usr/bin/apt-show-versions line 56.
E: Problem executing scripts APT::Update::Post-Invoke-Success 'test -x /usr/bin/apt-show-versions || exit 0 ; apt-show-versions -i'
E: Sub-process returned an error code

.. resynchronization failed!

Status: 
Active

Comments

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:
libgcc1
The following NEW packages will be installed:
libgcc1
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0 B/53.3 kB of archives.
After this operation, 148 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
dpkg: regarding .../libgcc1_1%3a4.7.2-5_i386.deb containing libgcc1:i386, pre-dependency problem:
libgcc1 pre-depends on multiarch-support
multiarch-support is unpacked, but has never been configured.

dpkg: error processing /var/cache/apt/archives/libgcc1_1%3a4.7.2-5_i386.deb (--unpack):
pre-dependency problem - not installing libgcc1:i386
Errors were encountered while processing:
/var/cache/apt/archives/libgcc1_1%3a4.7.2-5_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Howdy -- hmm, was the "/var/lib/dpkg" directory perhaps deleted?

What is the output of this command:

ls -la /var/lib/dpkg

please point to problem
#1


root@web:/var/lib/dpkg# ls -la /var/lib/dpkg
total 44
drwxr-xr-x 7 root root 4096 Feb 24 12:34 .
drwxr-xr-x 65 root root 4096 Feb 24 11:20 ..
drwxr-xr-x 2 root root 4096 Feb 24 11:20 alternatives
-rw-r--r-- 1 root root 3547 Feb 24 12:34 available
-rw-r--r-- 1 root root 0 Feb 24 12:19 available.corrupt
-rw-r--r-- 1 root root 3547 Feb 24 12:29 available-old
drwxr-xr-x 2 root root 4096 Feb 24 12:24 info
-rw-r----- 1 root root 0 Feb 24 12:34 lock
drwxr-xr-x 2 root root 4096 Feb 24 11:20 parts
-rw-r--r-- 1 root root 3373 Feb 24 12:34 status
-rw-r--r-- 1 root root 0 Feb 24 12:21 status.corrupted
-rw-r--r-- 1 root root 3373 Feb 24 12:29 status-old
drwxr-xr-x 2 root root 4096 Feb 24 12:22 triggers
drwxr-xr-x 2 root root 4096 Feb 24 12:34 updates

apt-get update
Hit http://software.virtualmin.com virtualmin-wheezy Release.gpg
Hit http://ftp.ua.debian.org wheezy Release.gpg
Hit http://ftp.ua.debian.org wheezy Release
Hit http://ftp.ua.debian.org wheezy/main Sources
Hit http://ftp.ua.debian.org wheezy/main i386 Packages
Hit http://security.debian.org wheezy/updates Release.gpg
Hit http://security.debian.org wheezy/updates Release
Hit http://security.debian.org wheezy/updates/main Sources
Hit http://security.debian.org wheezy/updates/contrib Sources
Hit http://security.debian.org wheezy/updates/main i386 Packages
Hit http://software.virtualmin.com virtualmin-universal Release.gpg
Hit http://software.virtualmin.com virtualmin-wheezy Release
Hit http://software.virtualmin.com virtualmin-universal Release
Hit http://software.virtualmin.com virtualmin-wheezy/main i386 Packages
Hit http://software.virtualmin.com virtualmin-universal/main i386 Packages
Reading package lists... Done
root@web:/var/lib/dpkg# apt-get install mc
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:
libc6 : Depends: libgcc1 but it is not going to be installed
Recommends: libc6-i686 but it is not going to be installed
mc : Depends: e2fslibs (>= 1.42.2) but it is not going to be installed
Depends: libcomerr2 (>= 1.01) but it is not going to be installed
Depends: libglib2.0-0 (>= 2.24.0) but it is not going to be installed
Depends: libgpm2 (>= 1.20.4) but it is not going to be installed
Depends: libslang2 (>= 2.2.4) but it is not going to be installed
Depends: mc-data (= 3:4.8.3-10) but it is not going to be installed
Recommends: mime-support but it is not going to be installed
Recommends: unzip but it is not going to be installed
Recommends: perl but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
root@web:/var/lib/dpkg# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
libgcc1
The following NEW packages will be installed:
libgcc1
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0 B/53.3 kB of archives.
After this operation, 148 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
dpkg: regarding .../libgcc1_1%3a4.7.2-5_i386.deb containing libgcc1:i386, pre-dependency problem:
libgcc1 pre-depends on multiarch-support
multiarch-support is unpacked, but has never been configured.

dpkg: error processing /var/cache/apt/archives/libgcc1_1%3a4.7.2-5_i386.deb (--unpack):
pre-dependency problem - not installing libgcc1:i386
Errors were encountered while processing:
/var/cache/apt/archives/libgcc1_1%3a4.7.2-5_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@web:/var/lib/dpkg#

empty

root@web:dpkg -l | grep debconf
root@web:/var/lib/dpkg# dpkg -l
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==================================-======================-======================-==========================================================================
ii gcc-4.7-base:i386 4.7.2-5 i386 GCC, the GNU Compiler Collection (base package)
ii libc-bin 2.13-38+deb7u1 i386 Embedded GNU C Library: Binaries
iU libc6:i386 2.13-38+deb7u1 i386 Embedded GNU C Library: Shared libraries
iU multiarch-support 2.13-38+deb7u1 i386 Transitional package to ensure multiarch compatibility
root@web:/var/lib/dpkg#

wget http://ftp.de.debian.org/debian/pool/main/d/debconf/{debconf_1.5.49_all.deb,debconf-utils_1.5.49_all.deb,debconf-i18n_1.5.49_all.deb}
--2014-02-24 22:08:10-- http://ftp.de.debian.org/debian/pool/main/d/debconf/debconf_1.5.49_all.deb
Resolving ftp.de.debian.org (ftp.de.debian.org)... 141.76.2.4
Connecting to ftp.de.debian.org (ftp.de.debian.org)|141.76.2.4|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 171018 (167K) [application/x-debian-package]
Saving to: `debconf_1.5.49_all.deb.1'

100%[=========================================================================================================================>] 171,018 853K/s in 0.2s

2014-02-24 22:08:10 (853 KB/s) - `debconf_1.5.49_all.deb.1' saved [171018/171018]

--2014-02-24 22:08:10-- http://ftp.de.debian.org/debian/pool/main/d/debconf/debconf-utils_1.5.49...
Reusing existing connection to ftp.de.debian.org:80.
HTTP request sent, awaiting response... 200 OK
Length: 55802 (54K) [application/x-debian-package]
Saving to: `debconf-utils_1.5.49_all.deb'

100%[=========================================================================================================================>] 55,802 --.-K/s in 0.004s

2014-02-24 22:08:10 (13.1 MB/s) - `debconf-utils_1.5.49_all.deb' saved [55802/55802]

--2014-02-24 22:08:10-- http://ftp.de.debian.org/debian/pool/main/d/debconf/debconf-i18n_1.5.49_...
Reusing existing connection to ftp.de.debian.org:80.
HTTP request sent, awaiting response... 200 OK
Length: 237226 (232K) [application/x-debian-package]
Saving to: `debconf-i18n_1.5.49_all.deb.1'

100%[=========================================================================================================================>] 237,226 --.-K/s in 0.1s

2014-02-24 22:08:10 (2.21 MB/s) - `debconf-i18n_1.5.49_all.deb.1' saved [237226/237226]

FINISHED --2014-02-24 22:08:10--
Total wall clock time: 0.5s
Downloaded: 3 files, 453K in 0.3s (1.47 MB/s)
root@web:/var/cache/apt/archives# dpkg -i debconf*
Selecting previously unselected package debconf.
dpkg: regarding debconf_1.5.49_all.deb containing debconf, pre-dependency problem:
debconf pre-depends on perl-base (>= 5.6.1-4)

dpkg: error processing debconf_1.5.49_all.deb (--install):
pre-dependency problem - not installing debconf
dpkg: regarding debconf_1.5.49_all.deb.1 containing debconf, pre-dependency problem:
debconf pre-depends on perl-base (>= 5.6.1-4)

dpkg: error processing debconf_1.5.49_all.deb.1 (--install):
pre-dependency problem - not installing debconf
Selecting previously unselected package debconf-i18n.
(Reading database ... 395 files and directories currently installed.)
Unpacking debconf-i18n (from debconf-i18n_1.5.49_all.deb) ...
Preparing to replace debconf-i18n 1.5.49 (using debconf-i18n_1.5.49_all.deb.1) ...
Unpacking replacement debconf-i18n ...
Selecting previously unselected package debconf-utils.
Unpacking debconf-utils (from debconf-utils_1.5.49_all.deb) ...
More than one copy of package debconf-i18n has been unpacked
in this run ! Only configuring it once.
dpkg: dependency problems prevent configuration of debconf-i18n:
debconf-i18n depends on debconf; however:
Package debconf is not installed.
debconf-i18n depends on liblocale-gettext-perl; however:
Package liblocale-gettext-perl is not installed.
debconf-i18n depends on libtext-iconv-perl; however:
Package libtext-iconv-perl is not installed.
debconf-i18n depends on libtext-wrapi18n-perl; however:
Package libtext-wrapi18n-perl is not installed.
debconf-i18n depends on libtext-charwidth-perl; however:
Package libtext-charwidth-perl is not installed.

dpkg: error processing debconf-i18n (--install):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of debconf-utils:
debconf-utils depends on debconf (>= 1.3.20); however:
Package debconf is not installed.

dpkg: error processing debconf-utils (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
debconf_1.5.49_all.deb
debconf_1.5.49_all.deb.1
debconf-i18n
debconf-utils
root@web:/var/cache/apt/archives#

What output do you receive if you run this command:

which debconf

dpkg -i debconf*
dpkg: error: parsing file '/var/lib/dpkg/status' near line 33 package 'debconf-utils':
`Replaces' field, syntax error after reference to package `debconf'

maybe you have correct /var/lib/dpkg/status ?

The "status" file is specific to your system, it would cause problems to use one from a different installation.

It looks like your status file is corrupted, based on the errors you shared above.

Doing some research on that, it appears as if Debian automatically stores backups of the status file whenever new packages are installed.

You can see the backups in /var/backups.

What you may want to do is make a backup of the current status file, then copy one of the backup status files from /var/backup to replace the corrupted one in /var/lib/dpkg.

status file restored, but now

root@web:/var/cache/apt/archives# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
libgcc1
The following NEW packages will be installed:
libgcc1
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0 B/53.3 kB of archives.
After this operation, 148 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
dpkg: regarding .../libgcc1_1%3a4.7.2-5_i386.deb containing libgcc1:i386, pre-dependency problem:
libgcc1 pre-depends on multiarch-support
multiarch-support is unpacked, but has never been configured.

dpkg: error processing /var/cache/apt/archives/libgcc1_1%3a4.7.2-5_i386.deb (--unpack):
pre-dependency problem - not installing libgcc1:i386
Errors were encountered while processing:
/var/cache/apt/archives/libgcc1_1%3a4.7.2-5_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@web:/var/cache/apt/archives#

That appears to be the same problem you were having before restoring that file.

That may mean that particular status file from the backups had the same problem.

You may need to go to an older version of that file from the /var/backups directory.