Debian upgrade problems

The last time I updated a system from Debian Lenny to a more recent Debian version I discovered a problem. This was from Debian Lenny to Debian Squeeze and at the end I upgraded to Debian Wheezy. This was caused by tar being an old version and not the most recent version, this is something that shouldn’t happen. The solution I used was installing a more recent tar version.

The problem:

server:~# apt-get dist-upgrade
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:
dpkg-dev: Depends: base-files (>= 5.0.0) but 5lenny6 is installed
Recommends: libalgorithm-merge-perl but it is not installed
libc6: Breaks: locales-all (< 2.13) but 2.11.3-2 is installed
libc6-amd64: Depends: libc6 (= 2.11.3-2) but 2.13-27 is installed
libc6-i686: PreDepends: libc6 (= 2.11.3-2) but 2.13-27 is installed
locales-all: Depends: glibc-2.11-1
E: Unmet dependencies. Try using -f.
server:~# 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:
(…)

Use ‘apt-get autoremove’ to remove them.
The following extra packages will be installed:
base-files
The following packages will be REMOVED:
lib64gcc1 lib64gomp1 libc6-amd64 libc6-i686 locales-all
The following packages will be upgraded:
base-files
1 upgraded, 0 newly installed, 5 to remove and 340 not upgraded.
1 not fully installed or removed.
Need to get 67.5kB of archives.
After this operation, 16.7MB disk space will be freed.
Do you want to continue [Y/n]? y
Get:1 http://debian.apt-get.eu squeeze/main base-files 6.0squeeze4 [67.5kB]
Fetched 67.5kB in 0s (2072kB/s)
tar: unrecognized option `–warning=no-timestamp’
Try `tar –help’ or `tar –usage’ for more information.
dpkg-deb: error: subprocess tar returned error exit status 64
dpkg: error processing /var/cache/apt/archives/base-files_6.0squeeze4_i386.deb (–unpack):
subprocess dpkg-deb –control returned error exit status 2
Errors were encountered while processing:
/var/cache/apt/archives/base-files_6.0squeeze4_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
server:~# aptitude full-upgrade
Reading package lists… Done
Building dependency tree
Reading state information… Done
Reading extended state information
Initializing package states… Done
Writing extended state information… Done
Reading task descriptions… Done
The following packages are BROKEN:
(…)
The following NEW packages will be installed:
(…)
The following partially installed packages will be configured:
dpkg-dev
The following packages are RECOMMENDED but will NOT be installed:
(…)

334 packages upgraded, 72 newly installed, 24 to remove and 0 not upgraded.
Need to get 234MB/234MB of archives. After unpacking 244MB will be used.
The following packages have unmet dependencies:
libfont-freetype-perl: Depends: perlapi-5.10.0 which is a virtual package.
locales-all: Depends: glibc-2.11-1 which is a virtual package.
libc6-i686: PreDepends: libc6 (= 2.11.3-2) but 2.13-27 is installed.
libept0: Depends: libapt-pkg-libc6.7-6-4.6 which is a virtual package.
libuuid-perl: Depends: perlapi-5.10.1 which is a virtual package.
libcap-dev: Depends: libcap2 (= 1:2.19-3) but 1:2.22-1 is installed.
libc6-amd64: Depends: libc6 (= 2.11.3-2) but 2.13-27 is installed.
libmudflap0-dev: Depends: gcc-4.1-base (= 4.1.2-25) but 4.1.2-29 is to be installed.
libc6: Breaks: locales-all (< 2.13) but 2.11.3-2 is installed.
The following actions will resolve these dependencies:

Remove the following packages:
lib64gcc1
lib64gomp1
libc6-amd64
libc6-i686
libept0
libmudflap0-dev
linux-image-2.6-486
linux-image-2.6-686-bigmem
locales-all

Keep the following packages at their current version:
libcap-dev [1:1.10-14 (now)]
libfont-freetype-perl [Not Installed]
libuuid-perl [Not Installed]
linux-base [Not Installed]
linux-image-2.6.32-5-486 [Not Installed]
linux-image-2.6.32-5-686-bigmem [Not Installed]

Leave the following dependencies unresolved:
defoma recommends libfont-freetype-perl
linux-image-2.6.26-2-686-bigmem recommends libc6-i686
libc6 recommends libc6-i686
Score is 190

Accept this solution? [Y/n/q/?]y
The following NEW packages will be installed:
(…)
The following packages will be upgraded:
(…)
The following partially installed packages will be configured:
dpkg-dev
The following packages are RECOMMENDED but will NOT be installed:
(…)
328 packages upgraded, 66 newly installed, 34 to remove and 1 not upgraded.
Need to get 178MB/178MB of archives. After unpacking 61.9MB will be used.
Do you want to continue? [Y/n/?] y

(…)

Fetched 178MB in 12s (14.0MB/s)
Extracting templates from packages: 100%
Preconfiguring packages …
tar: unrecognized option `–warning=no-timestamp’
Try `tar –help’ or `tar –usage’ for more information.
dpkg-deb: error: subprocess tar returned error exit status 64
dpkg: error processing /var/cache/apt/archives/patch_2.6-2_i386.deb (–unpack):
subprocess dpkg-deb –control returned error exit status 2
tar: unrecognized option `–warning=no-timestamp’
Try `tar –help’ or `tar –usage’ for more information.
dpkg-deb: error: subprocess tar returned error exit status 64
dpkg: error processing /var/cache/apt/archives/base-files_6.0squeeze4_i386.deb (–unpack):
subprocess dpkg-deb –control returned error exit status 2
Errors were encountered while processing:
/var/cache/apt/archives/patch_2.6-2_i386.deb
/var/cache/apt/archives/base-files_6.0squeeze4_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
dpkg: dependency problems prevent configuration of dpkg-dev:
dpkg-dev depends on base-files (>= 5.0.0); however:
Version of base-files on system is 5lenny6.
dpkg: error processing dpkg-dev (–configure):
dependency problems – leaving unconfigured
Errors were encountered while processing:
dpkg-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
Reading extended state information
Initializing package states… Done
Writing extended state information… Done
Reading task descriptions… Done

Like you can see there was an error while upgrading the Debian system. The first thing I did try didn’t work:

cd /usr/bin

mv dpkg dpkg-old

mv dpkg-deb dpkg-deb-old
mv dpkg-divert dpkg-divert-old
mv dpkg-maintscript-helper dpkg-maintscript-helper-old
mv dpkg-split dpkg-split-old
mv dpkg-query dpkg-query-old
mv dpkg-statoverride dpkg-statoverride-old
mv dpkg-trigger dpkg-trigger-old

scp other_server_with_debian_lenny_and_same_kernel:/usr/bin/dpk* ./

chmod a+x dpk*

This didn’t solve the problems. After that I did download and install a newer tar version. This is something you can copy (please change version number/kernel type when needed):

mkdir /tmp/tar

cd /tmp/tar

wget http://ftp.br.debian.org/debian/pool/main/t/tar/tar_1.26-4_i386.deb

ar x tar_1.26-4_i386.deb

tar xzf data.tar.gz

cp -p /bin/tar /bin/tar-old

cp -p bin/tar /bin/tar

This way tar was installed and upgrading was possible again without really big problems. Below was what I did next.

nano /etc/apt/sources.list # Change it to Debian Wheezy

apt-get clean

apt-get update

apt-get install tar

apt-get dist-upgrade # Did give a problem

apt-get -f install # Didn’t really work

aptitude full-upgrade # Multiple times, till there where no packages to update/upgrade

That was how it was solved.