Going back to debian stable from unstable

Solution 1:

Yes, re-install the OS. This need not be very disruptive to your system if you made sure that /home is on a separate partition and that any custom software was installed in /home, /opt or some other partition. Then it's just a matter of re-installing debian stable making sure that it will not touch partitions such as /home.

If you just dumped everything in one big partition then you're a bit out of luck in that regard.

See Partitioning the system in the Debian documentation on how to sensibly partition your system.

Solution 2:

This isn't fool proof and is likely to break if you for example have newer versions of software that have different config syntax than the older versions. Or you have packages that exist in unstable but not stable. I'd highly recommend you reinstall. You will very likely spend a lot of time cleaning up dependency issues and It'll take you much more time than to simply reinstall.

This is likely to leave your machine in a total mess, so be prepared to reinstall and restore backups.

However, this is technically possible through use of APT pinning.

If you add the following in /etc/apt/preferences.d/stable:

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

This makes all packages in the squeeze (aka current stable) repository high priority.

Next, you need to correct your /etc/apt/sources.list file to the new stable repository - this likely involves replacing all instances of "unstable" or "sid" (the unstable codename) with "stable".

Next update your cache: apt-get update. Then execute apt-get dist-upgrade, this will force apt to downgrade all packages due your pinning.

To iterate again, this will very likely break your machine and cost you a lot of time cleaning up the mess it leaves behind.