Thursday, 2 May 2013

Reverting to squeeze from wheezy

On my xen vm I tried to upgrade to wheezy, this is not possible if the host dom0 is still on etch. The kernel you are actually running is supplied by dom0 (why?) so you will now have a broken system. In particular ldconfig will segfault with kernel too old. apt-get install -f fails with:

The following packages have unmet dependencies:
 cpp : Depends: cpp-4.7 (>= 4.7.2-1~) but it is not installable
 g++-4.4 : Depends: gcc-4.4 (= 4.4.5-8) but 4.4.7-2 is to be installed
 gcc : Depends: gcc-4.7 (>= 4.7.2-1~) but it is not installable
 gcc-4.4 : Depends: gcc-4.4-base (= 4.4.7-2) but 4.4.5-8 is to be installed
           Depends: cpp-4.4 (= 4.4.7-2) but 4.4.5-8 is to be installed
           Depends: libgomp1 (>= 4.4.7-2) but it is not going to be installed
           Recommends: libc6-dev (>= 2.13-5) but 2.11.3-4 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Part way home it failed with:

libgcc1 : Breaks: gcc-4.4 (< 4.4.6-4) but 4.4.5-8 is to be installed 
libstdc++6 : Breaks: gcc-4.4 (< 4.4.6-4) but 4.4.5-8 is to be installed

and similar.

To return to a clean squeeze install is not easy. First edit /etc/apt/sources back to squeeze.

Now edit all of the following to comment out ldconfig:
/var/lib/dpkg/info/libstdc++6.postinst 
/var/lib/dpkg/info/libstdc++6.postrm   
/var/lib/dpkg/info/libgcc1.postrm
/var/lib/dpkg/info/libgcc1.postinst
# Automatically added by dh_makeshlibs                                          
#if [ "$1" = "configure" ]; then
#        ldconfig
#fi

Edit /etc/apt/apt-conf

APT::Default-Release "squeeze";

Now pin the packages which have been incompatibly upgraded (note Package: * does not work:

Package: libc-bin libc6-dev locales gcc gcc-4.4 cpp libgomp1 libgcc1 libstdc++6\
 build-essential
Pin: release n=wheezy
Pin-Priority: -10

Package: libc-bin libc6-dev locales gcc gcc-4.4 cpp libgomp1 libgcc1 libstdc++6\
 build-essential
Pin: release n=squeeze
Pin-Priority: 900

Clear apt's cache

apt-get clean

Finally you can

apt-get install -f

And uncomment the ldconfig lines and use * in /etc/apt/preferences

Package: *
Pin: release n=wheezy
Pin-Priority: -10

Package: *
Pin: release n=squeeze
Pin-Priority: 900

Now we are back to a system where apt-get works, but sadly still running an etch kernel!

No comments:

Post a Comment