Fast and safe upgrade to Debian sid from stable or testing

Debian only provide stable and testing installation CD/DVD so there is no way to install with sid directly. In order to use Debian sid, you will need to upgrade from existing installation. BTW, you may try once before but found that there was a lot of error message about package dependency, or not even able to complete the upgrade due to some tricky gap.

Here I will give you a simple guideline about how to upgrade in an elegant and stable style, from Debian stable or testing to sid.

Before start

I will assume you have already complete the Debian stable or testing installation, and playing with it lovely. I will not guide you though this part but only give some hints to you.

If you are planning to use Debian sid directly after initial installation ASAP, then please remember to install as minimum packages as possible at the beginning. E.g. only install base packages when asked by tasksel, but no X11, web server, file server, etc. This can simplify the upgrade procedure, since most of the installed packages will be replaced with the newest version. This can save a lot of time for download duplicated packages. We can further more come back and install default packages with tasksel --new-install.

On the other hand, if you are planing to upgrade from existing production installation, remember to backup everything, so you will able to restore it if the upgrade is fail. Also remember that some configuration of existing installed packages maybe changed

Moreover, if you are planning to use X11, I will also suggest you to install GUI packages from tasksel BEFORE the sid upgrade process. This is a bit inverse as stated above. The main point is because usually GUI have a lot of linkage in package dependency, if we can start the upgrade from an existing functional case, the upgrade path will be more stable; or else sometime you may find that some features are missing after complete the installation, or the installation itself is even can't success.

Configure APT with pinning

First of all, update your /etc/apt/sources.list as below. This will add both stable/testing/unstable source from 3 different location, plus some useful 3rd party APT sources:

deb http://ftp.hk.debian.org/debian/ stable main contrib non-free
deb-src http://ftp.hk.debian.org/debian/ stable main contrib non-free
deb http://ftp.jp.debian.org/debian/ stable main contrib non-free
deb-src http://ftp.jp.debian.org/debian/ stable main contrib non-free
deb http://ftp.us.debian.org/debian/ stable main contrib non-free
deb-src http://ftp.us.debian.org/debian/ stable main contrib non-free

deb http://ftp.hk.debian.org/debian/ testing main contrib non-free
deb-src http://ftp.hk.debian.org/debian/ testing main contrib non-free
deb http://ftp.jp.debian.org/debian/ testing main contrib non-free
deb-src http://ftp.jp.debian.org/debian/ testing main contrib non-free
deb http://ftp.us.debian.org/debian/ testing main contrib non-free
deb-src http://ftp.us.debian.org/debian/ testing main contrib non-free

deb http://ftp.hk.debian.org/debian/ unstable main contrib non-free
deb-src http://ftp.hk.debian.org/debian/ unstable main contrib non-free
deb http://ftp.jp.debian.org/debian/ unstable main contrib non-free
deb-src http://ftp.jp.debian.org/debian/ unstable main contrib non-free
deb http://ftp.us.debian.org/debian/ unstable main contrib non-free
deb-src http://ftp.us.debian.org/debian/ unstable main contrib non-free

deb http://download.webmin.com/download/repository sarge contrib
deb http://volatile.debian.org/debian-volatile stable/volatile main contrib non-free
deb http://security.debian.org/ stable/updates main contrib non-free
deb-src http://security.debian.org/ stable/updates main contrib non-free
deb http://ftp.debian-unofficial.org/debian unstable main contrib non-free restricted
deb-src http://ftp.debian-unofficial.org/debian unstable main contrib non-free restricted

Next, let's increase the APT cache pool size. Create a new file called as /etc/apt/apt.conf.d/99cache with below line:

APT::Cache-Limit "134217728";

Finally, configure the APT with pinning. Create a new file called as /etc/apt/preferences as below. Here we will pin your Debian to unstable (sid), but fall back to testing and stable as default, if required package dependency are not exist in sid:

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

Package: *
Pin: release a=testing
Pin-Priority: 650

Package: *
Pin: release a=unstable
Pin-Priority: 700

In case you hope to pin on stable, just chance the "Pin-Priority" of stable as 700, where unstable to 600. Therefore you will install all packages from stable as default, but also able to search testing or unstable packages and install it manually from aptitude.

Start upgrade to sid

Well, just run the follow commands and everything should be fine:

apt-get update
apt-get -y upgrade
apt-get -y dist-upgrade
apt-get clean
apt-get autoclean
apt-get autoremove

Or even run them within single command:

apt-get update && apt-get upgrade -y && apt-get -y dist-upgrade && apt-get clean && apt-get autoclean && apt-get autoremove

Ok, I understand that you may have some question about what have been done for the above command, and so let me explain it to you step by step.

For sure that after you have update the APT source list, a apt-get update is a must or else you may cache some old packages list, and try to install them (where they have already removed from public servers). Remember, always run apt-get update before any other apt-* related action.

apt-get -y upgrade will try to upgrade all packages as possible with minimal among of conflict. Because sometimes when system upgrade from stable to testing or testing to unstable, some packages may no longer required or renamed or even removed. This upgrade is most likely follow the priority of each packages based on your /etc/apt/preferences, which means it have no idea about what Debian release you are now using. If packages are conflicted, apt-get -y upgrade will try to keep the existing relationship.

apt-get -y dist-upgrade is some how a bit different than apt-get -y upgrade. It will also try to upgrade some conflict packages, e.g. remove more packages. Besides this, it is much similar as apt-get -y upgrade. So why don't we apply apt-get -y dist-upgrade directly? As apt-get -y dist-upgrade will remove more packages, sometime the upgrade will even not able to complete as some dependency packages is already removed. It really sounds crazy, but I always face this case. So just upgrade step by step: first apply apt-get -y upgrade and apt-get -y dist-upgrade so everything will function happily.

Finally the apt-get clean && apt-get autoclean && apt-get autoremove is all about system clean up. Nothing special about that so just feel free to run it. Be careful that apt-get autoremove is only available in testing and sid.

After all install and upgrade process are complete, you will have a Debian installation with sid on hand. Just feel free to play with it :-)

Other reference

Here is a very good example for using Debian APT-Pinning (http://jaqque.sbih.org/kplug/apt-pinning.html).


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <h1> <h2> <h3> <h4> <h5> <h6> <em> <strong> <code> <del> <blockquote> <q> <sub> <p> <br> <ul> <ol> <li> <dl> <dt> <dd> <a> <b> <u> <i> <sup> <acronym> <pre> <img>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Images can be added to this post.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.