Downgrade from Debian SID to Stable from Jessie to Wheezy

Downgrade from Debian SID to Stable from Jessie to Wheezy

Downgrade from Debian SID to Stable from Jessie to Wheezy

Logo of the Debian GNU/kFreeBSD project Credit: Debian/Open Use Logo Licence.

Downgrade from Debian SID to Stable from Jessie to Wheezy. This Tutorial describes the downgrade process you need to run to ge back stable rel after sid upgrade. Recently, a problem occurred on my server after i had upgraded my system with the SID repository in my sources.list. The Debian release jessie came out and after upgrading to this release some services no longer ran properly anymore. So I had to run a task to get back to Wheezy to recover the failing services.

 

So here are the few easy steps you will need to downgrade a Debian SID release to Wheezy:

 

 

Important Article Update Note: First of all, i give no guarantee that this article will still work with current state, since i wrote it in time were Jessie was Sid and worked flawless at that state. Carefully watch out for “Will break your System” Warnings and better stop the remove of packages if this Warning occurs, because that will break your System finally and probably did something wrong. Since new SID/Jessie release gets delivered with systemd as default, it is important to switch back from systemd to sysv first before the downgrade process by doing:

apt-get install sysvinit sysvinit-core sysvinit-utils
cp /usr/share/sysvinit/inittab /etc/inittab

Then reboot your server and remove all the systemd stuff!

apt-get remove --purge --auto-remove systemd

Set Apt-Pinning to prevent systemd upgrade mechanism:

echo -e 'Package: systemdnPin: release o=DebiannPin: release *nPin-Priority: -1' > /etc/apt/preferences.d/no-systemd

And continue with the previous downgrade tutorial steps:

First of all you have to remove or replace all SID tags from your /etc/apt/sources.list to your preffered target release

Mine sources.list file looks like this after changes have made:

deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main

deb http://cdn.debian.net/debian/ wheezy main contrib non-free
deb-src http://cdn.debian.net/debian/ wheezy main contrib non-free

Now we have to use the Apt-Pinning feature to get the correct default release tag for our apt downgrade

Modify or create the file /etc/apt/preferences and put following text in it:

Package: *
Pin: release a=stable
Pin-Priority: 1001

Important Update note: Replace a=stable with n=wheezy if you are running not the SID but Jessie final release!

At the next step we have to run the apt update and upgrade process for downgrading all packages

So you will need to enter these two commands to finish the downgrade process:

apt-get update
apt-get upgrade
apt-get dist-upgrade

Apt will ask you for downgrading all packages now.
Just say yes, let it go and pray that all packages getting installed and downgraded properly!

If some packages failing on downgrade you have to purge them by doing:

apt-get purge yourfailingpackage

And reinstall them with apt-get install yourfailingpackage after purging it.

Rating: 5.0/5. From 9 votes.
Please wait...
Jules

Jules

Jules is the owner and author of ISPIRE.ME. He's a Linux System Engineer, Tech fanatic and an Open Source fan.

You may also like...

28 Responses

  1. Jacob Jacob says:

    Thanks a lot.

    Rating: 4.0/5. From 1 vote.
    Please wait...
    • Jules Jules says:

      No problem 😉

      No votes yet.
      Please wait...
    • Remco Remco says:

      If this stuff works, it is worth 5 euro ! (THANKS & Cheers)

      Rating: 5.0/5. From 2 votes.
      Please wait...
  2. Ola Ola says:

    If i installed jessie initially (not upgrade), can I still downgrade to wheezy?

    No votes yet.
    Please wait...
    • Jules Jules says:

      Hi Ola,

      sure you can. It doesn’t really depend on the version you’ve installed initially.

      No votes yet.
      Please wait...
  3. kurtos kurtos says:

    Well explained.
    Thanks.

    No votes yet.
    Please wait...
  4. Stefan Stefan says:

    Thanks! I actually had to do an additional ‘apt-get dist-upgrade’ to downgrade packages with assumingly a different version number in the two editions.

    No votes yet.
    Please wait...
  5. ahes ahes says:

    For me ‘apt-get dist-upgrade’ worked.

    No votes yet.
    Please wait...
  6. BootLoop BootLoop says:

    Thanks. You just saved my bacon. +1 times a billion.

    No votes yet.
    Please wait...
  7. Justin Pretorius Justin Pretorius says:

    Thanks so much, an excellent article for something that should be easily found in the Debian manuals

    No votes yet.
    Please wait...
    • Jules Jules says:

      Well it’s not the best but working solution. Debian would never recommend it since it also can break your whole system.
      But if you have just this only chance it will do and mostly well 😉

      No votes yet.
      Please wait...
  8. haek haek says:

    There is no /etc/apt/preferences only /etc/apt/preferences.d exists

    Rating: 5.0/5. From 1 vote.
    Please wait...
    • Jules Jules says:

      Hi,

      if it doesn’t exist, create it.
      Thats why i wrote in my article: Modify or create the file /etc/apt/preferences

      😉

      No votes yet.
      Please wait...
  9. axkibe axkibe says:

    In my case it didn’t work.

    Issue with systemd vs. sysvinit.

    I learned that I was supposed to switch from systemd back to sysvinit-core and do a reboot to use that one before downgrading package versions. This way the installer keept stoping because it couldn’t remove systemd. I tried to go back up jessie, install sysvinit-core and do a reboot, unfortunally the system was left in so an unusuable state, it didn’t boot.

    I ended up putting a wheezy installer USB on it, removing everything but the home folder from install root and do a clean reinstall to wheezy.

    Rating: 1.0/5. From 1 vote.
    Please wait...
    • Jules Jules says:

      Where it stopped to boot finally? What error messages you get?
      For me it sounds more like an shell issue. Probably default shell were set to dash and thus will break up init scripts at all.
      dpkg-reconfigure dash – whats selected there (yes/no)?

      No votes yet.
      Please wait...
      • Axel Kittenberger Axel Kittenberger says:

        It won’t let one deinstall systemd while the system is running systemd, I searched about that and the common opinion was one should revert the system to use sysvinit-core then reboot, than remove or purge systemd. However I couldn’t reboot since the system was currently broken, but I also couldn’t fix to the previous state, since package management keept refusing to let go of the systemd package, with all kind of dependencies. I can’t answer questions anymore, since I reinstalled wheezy the proper way already, using an usb stick and moving the testing system with an installer shell out of place.

        So my idea is, before you downgrade install sysvinit-core and revert to it before downgrading. Maybe your jessie was not yet converted to systemd before the downgrade? Or likely I just did something wrong missing a proper force, just -f didnt cut it.

        In this case it wasn’t a big issue since I had physical access to the machine anyway, I was at first just lazy to do it the debian adviced way.

        No votes yet.
        Please wait...
        • Scott Scott says:

          Same thing happened to me just barely. I SSH’d into my machine to do this from work, and it totally hosed my machine because systemd couldn’t be switched out. Probably want to make sure you add info about switching to sysvinit-core before downgrading current jessie.

          No votes yet.
          Please wait...
  10. Khurram Khurram says:

    I get this problem after removing the systemd package. System isnt booting, so I am doing this all in chroot. Kindly advise.

    # apt-get install -f
    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:
    app-install-data docutils-common docutils-doc gdebi-core gnustep-base-common
    gnustep-base-runtime gnustep-common gnustep-gui-common hplip-data
    i965-va-driver ieee-data ipxe-qemu libaio1 libaqbanking-data libaqbanking34
    libaqofxconnect7 libarchive12 libart-2.0-2 libasan1 libasn1-8-heimdal
    libatomic1 libavresample2 libavutil54 libbfio1 libboost-thread1.55.0
    libbrlapi0.5 libcap2-bin libchromaprint0 libcogl-common libdrm-nouveau2
    libdvbpsi9 libebml4 libelf1 libepoxy0 libewf2 libfdt1 libfreerdp1
    libgles2-mesa libglib2.0-bin libgnustep-base1.22 libgssapi3-heimdal
    libgutenprint2 libgwenhywfar-data libgwenhywfar60 libhcrypto4-heimdal
    libheimbase1-heimdal libheimntlm0-heimdal libhx509-5-heimdal libiscsi1
    libiscsi2 libjson-c2 libkrb5-26-heimdal libktoblzcheck1c2a libldb1
    liblua5.2-0 libmatroska6 libntdb1 libobjc4 libopenvg1-mesa
    libpackagekit-glib2-14 libpam-cap libproxy-tools libproxy1 libqpdf13
    libroken18-heimdal libseccomp2 libsnmp-base libspice-server1 libswscale3
    libsystemd-daemon0 libsystemd-id128-0 libsystemd-journal0 libtevent0
    libtsk10 libtxc-dxtn-s2tc0 libubsan0 libusageenvironment1 libusbredirparser0
    libusbredirparser1 libvdeplug2 libwebrtc-audio-processing-0 libwind0-heimdal
    libxen-4.1 libxmlsec1 libxmlsec1-gcrypt libxmlsec1-gnutls
    linux-headers-3.14-1-common linux-headers-3.14-2-common linux-kbuild-3.14
    openbios-ppc openbios-sparc openhackware packagekit packagekit-backend-aptcc
    packagekit-tools pulseaudio-utils python-crypto python-debian
    python-docutils python-ldb python-ntdb python-packagekit python-pexpect
    python-ply python-pycparser python-pygments python-renderpm python-reportlab
    python-reportlab-accel python-roman python-six python-talloc python-tdb
    python-wstools python3-apt python3-chardet python3-dbus python3-six
    qemu-keymaps qemu-slof qpdf rtkit seabios sharutils tk va-driver-all
    vdpau-va-driver vgabios
    Use ‘apt-get autoremove’ to remove them.
    The following extra packages will be installed:
    gcc hplip-data libaqbanking34 libpython2.7 libsmbclient libxmlsec1-gcrypt
    libxmlsec1-gnutls python python2.7 python2.7-minimal
    Suggested packages:
    gcc-multilib autoconf automake1.9 libtool flex bison gdb gcc-doc hplip
    aqbanking-tools python-doc python-tk python2.7-doc
    Recommended packages:
    libaqbanking-plugins-libgwenhywfar60
    The following packages will be REMOVED:
    gcc-4.9 libaqbanking34-plugins libaqebics0 libaqhbci22 libpython-stdlib
    libpython2.7-stdlib python-cffi python-cryptography python-debianbts
    python-defusedxml python-reportbug python-soappy
    The following packages will be DOWNGRADED:
    gcc hplip-data libaqbanking34 libpython2.7 libsmbclient libxmlsec1-gcrypt
    libxmlsec1-gnutls python python2.7 python2.7-minimal
    0 upgraded, 0 newly installed, 10 downgraded, 12 to remove and 150 not upgraded.
    10 not fully installed or removed.
    Need to get 0 B/14.5 MB of archives.
    After this operation, 16.9 MB disk space will be freed.
    Do you want to continue [Y/n]?
    Could not find platform independent libraries
    Consider setting $PYTHONHOME to [:]
    ImportError: No module named site
    Can not write log, openpty() failed (/dev/pts not mounted?)
    (Reading database … 131465 files and directories currently installed.)
    Removing python-cryptography …
    Could not find platform independent libraries
    Consider setting $PYTHONHOME to [:]
    ImportError: No module named site
    dpkg: error processing python-cryptography (–remove):
    subprocess installed pre-removal script returned error exit status 1
    Could not find platform independent libraries
    Consider setting $PYTHONHOME to [:]
    ImportError: No module named site
    dpkg: error while cleaning up:
    subprocess installed post-installation script returned error exit status 1
    Removing python-cffi …
    Could not find platform independent libraries
    Consider setting $PYTHONHOME to [:]
    ImportError: No module named site
    dpkg: error processing python-cffi (–remove):
    subprocess installed pre-removal script returned error exit status 1
    Removing python-reportbug …
    Could not find platform independent libraries
    Consider setting $PYTHONHOME to [:]
    ImportError: No module named site
    dpkg: error processing python-reportbug (–remove):
    subprocess installed pre-removal script returned error exit status 1
    Removing python-debianbts …
    Could not find platform independent libraries
    Consider setting $PYTHONHOME to [:]
    ImportError: No module named site
    dpkg: error processing python-debianbts (–remove):
    subprocess installed pre-removal script returned error exit status 1
    Removing python-soappy …
    Could not find platform independent libraries
    Consider setting $PYTHONHOME to [:]
    ImportError: No module named site
    dpkg: error processing python-soappy (–remove):
    subprocess installed pre-removal script returned error exit status 1
    Removing python-defusedxml …
    Could not find platform independent libraries
    Consider setting $PYTHONHOME to [:]
    ImportError: No module named site
    dpkg: error processing python-defusedxml (–remove):
    subprocess installed pre-removal script returned error exit status 1
    Errors were encountered while processing:
    python-cryptography
    python-cffi
    python-reportbug
    python-debianbts
    python-soappy
    python-defusedxml
    E: Sub-process /usr/bin/dpkg returned an error code (1)

    I am unable to delete these packages too.

    No votes yet.
    Please wait...
    • Todd Todd says:

      Got this aswell, fixed it by doing:
      apt-get autoclean
      apt-get clean
      apt-get purge python2.7-minimal
      (errors will ensue)
      apt-get update
      apt-get download python2.7 python2.7-minimal libpython
      dpkg -i python*.deb
      apt-get update
      apt-get upgrade

      and everything will work out fine.

      No votes yet.
      Please wait...
  11. Gertjan Gertjan says:

    the command apt-get dist-upgrade was not working.
    I tried apt-get upgrade ,and that was good

    No votes yet.
    Please wait...
  12. Stan Stan says:

    Nice tutorial… and very well explained.
    Thanks a lot! You’ve saved my day.

    No votes yet.
    Please wait...
  13. C2884 C2884 says:

    humm.. for me apt-pinning should’t be working. It barely downgraded. just a few packages and all others stayed in the jessie versions, including kernel, xorg-server, sshd, etc..

    No votes yet.
    Please wait...
    • Jules Jules says:

      Hi,

      I wrote this article for SID release originally and it might be because Jessie is a stable release also now, so apt-pinning with target=stable will match against it also now.

      Try changing apt-pinning line from Pin: release a=stable to Pin: release n=wheezy and report back if that helps.

      No votes yet.
      Please wait...
      • Artjom Artjom says:

        That worked for me (not the original poster of the question, but I had the same problem.)

        Thank you for writing this up!

        No votes yet.
        Please wait...
  14. Hoser Hoser says:

    Yeaaaah, I ran the steps as you so say “easily”
    Midway through the removal of a ton of packs, it cuts off my network connection, all other units in home online, and now viola, like the fire crew came and just HOSED it … thanks

    Thats one thing about following these seemingly adviseable tutorials…. BLEH!

    No votes yet.
    Please wait...
  15. Ivo Ivo says:

    Thank you, man. I was missing preferences file and it fixed my wheezy 🙂

    Rating: 5.0/5. From 1 vote.
    Please wait...
  16. Felipe Lopes Felipe Lopes says:

    It seems simple but at the end of “apt-get remove –purge –auto-remove systemd” I had no connection at all,
    this step removed networkmanager. I had to create an usb stick with debian wheezy and reinstall the system.

    No votes yet.
    Please wait...
  17. LD LD says:

    Dear Jules,
    I was very excited when I found this article since that’s what I needed – downgrade from SID. I entered the first line you provided:

    apt-get install sysvinit-core sysvinit sysvinit-utils

    and then restarted. Unfortunately now I don’t have the option to log in back in my machine! I enter the password to unlock the hard drives and then just get a blank screen with the top banner only. How can I reverse the install sysvinit etc command? Thanks in advance!
    (I am very new to Debian (and Gnu/Linux in general)).

    No votes yet.
    Please wait...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.