Pages

Wednesday 9 February 2011

Downgrade from squeeze to lenny..

If you were distracted in the last 3 days and forgot that Debian 'stable' became 'squeeze' last Sunday, or just inadvertently issude 'apt-get upgrade' on your lenny machine, wondering why you had more than 200 packages to update, but still pressing Yes Yes Yes... well you have done the thing I did at least  on one of my servers...

But no problem, downgrading is easy in apt.

Just put:

Package: *
Pin: release a=oldstable
Pin-Priority: 1001
in /etc/apt/preferences and do again
apt-get update && apt-get upgrade
I was so lucky to have to force jsut one package
dpkg -i --force-overwrite /var/cache/apt/archives/sysvinit_2.86.ds1-61_i386.deb
 And reinstall one of them because apticron was failing the downgrade

apt-get install mktemp --reinstall && apt-get install apticron
Cheers

10 comments:

  1. thanks, man, saved my ass today!!!
    ONE thing: I already had a new libc on the system - tis breaks the downgrade! What helped was to manually download from package repo and then force install:
    wget http://ftp.de.debian.org/debian/pool/main/g/glibc/libc6_2.7-18lenny7_i386.deb
    dpkg -i --force-all libc6_2.7-18lenny7_i386.deb
    Also another package had to be forced:
    dpkg -i --force-all /var/cache/apt/archives/sysvinit_2.86.ds1-61_i386.deb

    ReplyDelete
  2. Then go into /etc/apt/sources.list and start using the appropriate code name (lenny) so that this does not happen in future. Change the code name to the new stable release when you are prepared and ready to dist-upgrade.

    ReplyDelete
  3. This was really useful.
    I accidentally upgraded our VPS to Squeeze, half-way anyhow.. Since it uses Paralells Virtuozzo solution.
    Anyways, seems like its going fine now.. I'm downgrading some packages, gets some errors, downgrade more.. etc.

    Might just start to work again! Thanks!

    ReplyDelete
  4. I'm leaning before you in a dust my master :)
    I cannot confirm that my progress was as painless as yours (XEN domU, lots of blocked packages and not working pyGRUB), but you gave me the initial hint. Thank you.

    ReplyDelete
  5. Thanks man! I got the same problem two years after, from wheezy to squeeze, and it still works! Just create a file in /etc/apt/preference.d/ with the content you gave, and follow the procedure.

    ReplyDelete
  6. Ran into a problem where /bin/sh was missing causing an error

    Sub-process /usr/sbin/dpkg-preconfigure --apt || true returned an error code (100)

    A simple "ln -s /bin/bash /bin/sh" fixed it

    ...

    Ran into an issue with ldconfig missing (after libc-bin was removed) to fix it

    mkdir ~/libc6
    dpkg -x /var/cache/apt/archives/libc6_2.7-18lenny7_amd64.deb ~/libc6/
    cp ~/libc6/sbin/ldconfg /sbin/

    Then mktemp went missing and was giving errors so
    mkdir ~/mktemp
    dpkg -x /var/cache/apt/archives/mktemp_1.5-9_amd64.deb ~/mktemp
    cp ~/mktemp/bin/mktemp /bin/

    After this I was able to follow any cleaup prompts and removed any squeeze packages and added replacement lenny packages.

    This was done in the Rackspace next gen cloud to provide me with a necessary Lenny box to bring up a sandbox

    ReplyDelete
    Replies
    1. Running through this a second time, I was able to fix the mktemp problem by running a simple apt-get install mktemp when the mktemp error came up.

      Also didn't run into the ldconfig issue this time.

      The difference is that I ran apt-get upgrade and got it to complete error free before running apt-get dist-upgrade

      I stil had to do the ldconfig fix above for the dist-upgrade to finish.

      If anyone wants, I'll put together a full script on how to do the downgrade to Lenny in the Rackspace Squeeze image

      Delete
    2. Hi Jason,

      it is dangerous to run a dist-upgrade on a downgrade since you are going backwards and dist-upgrade's logic works forward.

      It will make decisions for you about removing packages based on their deps that you really want to make yourself. dist-upgrade will definitely give you unpredictable results (for instance removing mktemp while you really need it).

      So on downgrade always use "upgrade" only :)

      Delete
  7. I would just like to add, that on a basic install with no packages added, you are still able to do this to roll back from Wheezy to Squeeze!! I'm delighted as I now no longer have to go to the DC to rollback to test package compatibility when upgrading from squeeze to wheezy :)

    No-one else seems to know that this is possible.

    ReplyDelete
  8. Extraordinary post, you have called attention to some phenomenal focuses , I similarly think this s an exceptionally brilliant site.
    Registering Ideal Domain

    ReplyDelete