2

I have Debian stable disribution installed on my computer. Once I installed some packages from testing but now it causes some troubles so I would like to downgrade them. I've tried next commands:

apt-get --reinstall install  `apt-show-versions | grep newer | cut -d ' ' -f 1 | tr '\n' ' '`

this doesn't work because apt tries to retrieve the same versions of packages and complains that it can't download them because I now have no sources for testing packages in sources.list

apt-get -t squeeze  install  `apt-show-versions | grep newer | cut -d ' ' -f 1 | tr '\n' ' '`

doesn't work either. Writes that the newest versions of packages have already installed. I thought -t sqeeze forces apt to install packages from stable.

Anyway how can I solve this task?

1
  • wouldn't it work if you add the testing sources to sources.list again, purge the testing applications, remove the sources and install again?
    – wullxz
    Commented Aug 9, 2012 at 11:13

2 Answers 2

3

I use this:

for p in $(apt-show-versions|grep "newer than version in archive"|cut -d\  -f1); do apt-get install $p=$(apt-cache show $p|grep ^Version|tail -1|cut -d\  -f2); done

(There is a double space after both -d\.)

1
  • Ohh man, thanks i love you, i've replaced apt for aptitude and i works very very nice. Kisses !!
    – Milor123
    Commented Sep 8, 2023 at 1:56
0

As @wullxz said. You can do that by purging the new packages, removing or commenting out the unstable repo from the sources list, installing the old packages then, uncomment or add the unstable repo again to sources.list if you want to use some other packages from it.

  • Purge new package:

sudo apt-get purge my-package

  • Edit sources.list and comment out the testing repo:

sudo nano /etc/apt/sources.list

  • Install old stable package again:

sudo apt-get update

sudo apt-get install my-package

  • (Optional) Use the testing repo again (as aforementioned) if u need to and, lock the version for that particular package temporarily:

# uncomment the testing repo from sources.list

sudo nano /etc/apt/sources.list

# Lock the current version of the package.

echo "my-package hold" | dpkg --set-selections

  • If you would like to remove the lock and install the testing package again:

echo "my-package install" | dpkg --set-selections

You must log in to answer this question.

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