Is there any, preferably easy and safe, way to go back to a stable version of debian when currently on unstable?
3 Answers
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.
Since you don't mention a time frame, you may not need to pin it if you are willing to wait for the packages to catch up. You could just change /etc/apt/sources.list lines from sid to CODENAME or unstable to stable. If a package gets removed from unstable, it would have been lost anyway. I don't know if unstable warns you if a package is removed from the repo, but you would most likely lose any notices of apps being removed if that even happens now. That would be my main concern if time is not an issue.
![](../../users/profiles/558980.webp)
- 21
- 1
-
Hi @eyez, welcome to Server Fault! :-) This issue is no longer relevant for me, but an upvote nonetheless, and hopefully your answer is relevant to many others. Thanks. – Willem Mulder Feb 07 '20 at 09:36
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.
![](../../users/profiles/914.webp)
- 7,147
- 2
- 28
- 42
-
I understand using this method may sometimes have its uses, normally one shouldn't try it. If the chance of messing up is that high wouldn't it be a better idea to do a re-install? At least you know what to expect. Make a backup just in case, copy back /home if it wasn't on a separate partition. – aseq Mar 05 '13 at 00:20
-
I'll go for safe and do a re-install, but you got me understanding better how packages and pinning works, so +1 for teaching and not going the standard route! – Willem Mulder Mar 05 '13 at 08:19
-
No. This does absolutely nothing. Just insists that the testing version is newer. – Jeff Burdges Sep 25 '15 at 19:53