44

currently I am having lot's of fun with apt-get - and the bad thing is, it was my own fault. I had enabled the testing packages in /etc/apt/sources.list to install a certain package. And I told my system do apt-get dist-upgrade. Everything worked fine, but now I am trying to get back to the stableupdated - and I fail...

When trying to do the apt-get dist-upgrade, i get the following information:

The following packages will be REMOVED:
  linux-image-3.10-3-amd64
The following NEW packages will be installed:
  libcgi-fast-perl libfcgi-perl libyaml-syck-perl
The following packages will be DOWNGRADED:
  initramfs-tools libdate-manip-perl munin munin-common

Well, that's okay, but when I am try to do this, I get a warning in bold friendly red letters:

You are running a kernel (version 3.10-3-amd64) and attempting to remove the same version.
...
It is highly recommended to abort the kernel removal unless you are prepared to fix the system after removal.

Well, I like to follow the recommendmend. The correct kernel version for the stable release would be linux-image-3.2.0-4-amd64 and it is already installed. Probably the downgrade would be no problem if I was working under the older kernel? Actually, I have no clue how to enable the kernel 3.2.0 instead of 3.10.

10
  • 5
    I hate to break this to you, but downgrades are not supported in Debian. You are not specific about how much of your system now consists of packages from testing (this is discoverable, for example, by apt-show-versions), but if it is a significant part, you may have problems. The solution to your immediate issue seems simple, unless I am missing something. Just reboot into 3.2 and then remove the newer kernel. However, this won't make the rest of your system magically revert to stable. Feb 26, 2014 at 22:06
  • Thanks! As far as I see, there is not so much trouble at all - just a few packages... Is there an option to tell the system to use the kernel 3.2 after reboot? I am working on a VPS (virtual server) and won't be able to click any button before SSH is up...
    – BurninLeo
    Feb 26, 2014 at 22:11
  • You are saying you can't select the kernel interactively at boot? If you are using GRUB, you should be able to go to the grub config and change your default choice of kernel to boot from. The details would depend on what version of GRUB you are running. Feb 26, 2014 at 22:13
  • 1
    @Wilf Debian won't automatically attempt a downgrade. You could configure apt to try to do that, but I don't think that would help here. Feb 26, 2014 at 22:23
  • 1
    You probably are using GRUB. Post your version of GRUB, dpkg -l | grep grub in the question. Feb 27, 2014 at 17:04

2 Answers 2

55

Look at this, it seems to indicate that downgrade is possible using apt-get:

http://ispire.me/downgrade-from-debian-sid-to-stable-from-jessie-to-wheezy/

Essentials (3-step):
(If much of your system is of a higher version, you'll want to be careful downgrading. See especially format changes (data and personal config files)

  1. Remove all references to sid or unstable in your /etc/apt/sources.list by deleting, replacing, or commenting out. Ensure sources.list has what you do want (I recommend security and stable deb sources). For example:

    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

  2. Pin the release you want in /etc/apt/preferences (this will cause the already downloaded but now unwanted package information to be ignored as desired).

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

  3. Finally we have to run the apt update and upgrade process for downgrading all packages.
    *apt will ask for confirmation

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

If you can't explain what each of these commands does independently, read your man pages! :) And do the same for at least the options you use in other utilities.

  1. (If you have issues downgrading a package) Purge it, then reinstall

    # apt-get purge [your_failing_package]
    # apt-get install [your_failing_package]

3
  • 2
    Excellent answer, thank you! The core of it is step 2. Aug 22, 2016 at 0:03
  • The /etc/issue and other files are kept not downgraded. How to resolve it?
    – mvorisek
    Aug 24, 2019 at 22:08
  • I was able to resolve some issues after the downgrade with apt-get install --reinstall $pkg rather than purging then installing.
    – JinnKo
    Jun 30, 2020 at 11:53
4
  • Reboot the machine.
  • From Debian advanced menu on Grub, choose a kernel different from the one you want to remove.
  • If you're on Debian you'd have a meta package for the kernel installed.

    gayan@deb:~$ dpkg -l | grep linux 
    ii  linux-image-amd64                     4.9.25-1~bpo8+1
    ii  linux-image-3.16.0-4-amd64            3.16.43-2
    ii  linux-image-4.9.0-0.bpo.3-amd64       4.9.25-1~bpo8+1
    
  • Simply purge the meta package (linux-image-amd64) and and reinstall it.

    Then you'd have:

    gayan@deb:~$ dpkg -l | grep linux
    ii  linux-image-amd64                     3.16.43-2
    ii  linux-image-3.16.0-4-amd64            3.16.43-2
    
  • Reboot.


Info:

linux-image-amd64 is a meta package. It could point to a either stable kernel or a back-ported one (4.9.25-1~bpo8+1) depending on how you install it:

apt-get -t jessie-backports install linux-image-amd64

or

apt-get install linux-image-amd64

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .