How can I revert back from an upgrade to the Proposed repository?

Here's a more general way to revert from locally installed packages, proposed and backports packages to the stable+updates channel. While the other answers are correct and work in a similar way, I think this is a more elegant approach.

  1. Make sure you removed the entries of -proposed or -backports in your /etc/apt/sources.list and /etc/apt/sources.list.d/* files.
  2. Add an apt-preferences file, e.g. /etc/apt/preferences.d/99-back-to-stable-updates containing (for precise here - replace with your version):

    Package: *
    Pin: release a=precise
    Pin-Priority: 1001
    
    Package: *
    Pin: release a=precise-updates
    Pin-Priority: 1001
    
    Package: *
    Pin: release a=precise-security
    Pin-Priority: 1001
    
    Package: *
    Pin: release a=precise-proposed
    Pin-Priority: -10
    
    Package: *
    Pin: release a=precise-backports
    Pin-Priority: -10
    

    This pinning of > 1000 will make apt force a downgrade on packages from that channel and a priority of < 0 on the -proposed and -backports channels will make remove any additional packages too.

  3. Now run

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

    Inspect the proposed solution apt will give you, and if you think it's okay, then accept it. If you need to check on why and what version it will be downgraded to, check this with apt-cache policy packagename to see what versions are available and what apt decides is the candidate for installation.

  4. Remove the /etc/apt/preferences.d/99-back-to-stable-updates file again, as it's not needed anymore.

Thanks to mlind on the Ubuntu forums for this inspriation on pinning in his post from more than 5 years ago - yet it helped me out pretty well today.


This page suggests that Apt pinning can be used to downgrade from an entire repository by leveraging the fact that pin priorities higher than 1000 can cause package downgrades.

One solution, then, might be to temporarily increment by 1000 the default priorities of all package files except for those from the natty-proposed repository:

apt-cache policy | awk '
    /^ [0-9]+ / {
        p = $1;
        getline;
        r = $0;
        if (r !~ /a=natty-proposed/) p += 1000;
        print "Package: *\nPin: " r "\nPin-priority: " p "\n"
    }
' | sudo tee /etc/apt/preferences.d/downgrade-from-natty-proposed

(Note: This method fails to increase the priority of package files whose release fields contain commas. See this question.)

After doing this, apt-get --simulate upgrade can be used to test for successful downgrade detection. After confirming that the correct downgrades are detected, sudo apt-get upgrade should be all that is needed to perform the downgrade.

When the downgrade is complete, use Software Sources to disable the Pre-release updates (natty-proposed) repository, then remove the temporary priority increase:

sudo rm /etc/apt/preferences.d/downgrade-from-natty-proposed

Finally, reboot so that all running programs are their downgraded versions.


I cannot find a simpler solution than the following. Yet hoping someone get in with a better answer.

The following script that can execute the downgrade

#!/bin/bash

# get a list of installed packages
dpkg --get-selections | awk '{ print $1 }' > all-packages

# run apt-cache policy on each of them, then elaborate with the awk script 
apt-cache policy $(<all-packages) |
  ./get-prev-pkg-vers >old-versions

# install previous version of packages
sudo apt-get --simulate install $(< old-versions)

The awk script, named get-prev-pkg-vers is as follow

#!/usr/bin/awk -f

/^[^ ]/ {
    package = $1
    gsub(":", "", package)
    search_next = 0
}
/^     [^ ]/ {
    installed = 0
    version = $1
    if (search_next == 1) {
        print package "=" version
        search_next = 0
    }
}
/^ \*\*\* [^ ]/ {
    installed = 1
}
/^        [^ ]/ {
    branch = $3
    if (installed == 1 && branch ~ /proposed/) {
        search_next = 1
    }
    installed = 0
}

When running the script, the proposed repo should NOT have been disable yet.

Remember to set the executable bit on both scripts.

A problem with this approach is that all downgraded packages will result as manually installed (also those that were automacally installed).

To be safe, add the --simulate option to apt-get at end of the bash script.