debian 系统版本 划分、识别、演进 的释疑(升级系统须知)

        本文介绍debian系统的版本划分,如何得到当前系统的版本,以及版本的演化进程,中间插入一些版本比较等。


        一、版本划分

        debian 系统的版本的从稳定性角度来看,有分:“stable”、“testing”、“unstable”(其实还有一个不常被普通用户使用的experimental 版本)。从开发代号(code name)的角度来看有:“squeeze” “wheezy”(分别对应数字版本号 6 和 7),和一个永远存在的sid版本。

        “stable”、“testing”、“unstable”属于动态版本表述,当前的stable版对应 squeeze (初始发行版本号:6.0,以后会有6.1等),testing版对应wheezy(7.0),unstable版永远对应code name:sid,所以sid也是动态表述,这与wheezy等code name不同。其实,后面可以看到sid可以与wheezy等并称,它们并不排斥,这通常被误解。

        以后将版本在演化过程中,我们会了解到debian发行的核心目标是释放稳定的版本squeeze或wheezy或...等,也就是 6系列,7系列,... 等,其他的发行版描述是为这服务的。

        “stable”、“testing”、“unstable”的当前详细官方介绍见下:

        stable:

Debian 6.0.6 was released September 29th, 2012. Debian 6.0.0 was initially released on February 6th, 2011. The release included many major changes, described in our press release and the Release Notes. To obtain and install Debian, see the installation information page and the Installation Guide. To upgrade from an older Debian release, see the instructions in the Release Notes. The following computer architectures are supported in this release:

        testing:

Debian “wheezy” Release Information The code name for the next major Debian release after squeeze is wheezy. This release started as a copy of squeeze, and is currently in a state called testing. That means that things should not break as badly as in unstable or experimental distributions, because packages are allowed to enter this distribution only after a certain period of time has passed, and when they don't have any release-critical bugs filed against them. Please note that security updates for testing distribution are not yet managed by the security team. Hence, testing does not get security updates in a timely manner. You are encouraged to switch your sources.list entries from testing to squeeze for the time being if you need security support. See also the entry in the Security Team's FAQ for the testing distribution. For installation images and documentation about how to install testing, see the Debian-Installer page. To find out more about how the testing distribution works, check the developers' information about it. People often ask if there is a single release progress meter. Unfortunately there isn't one, but we can refer you to several places that describe things needed to be dealt with for the release to happen:

        unstable

The unstable distribution (sid) The code name for Debian's development distribution is sid, aliased to unstable. Most of the development work that is done in Debian, is uploaded to this distribution. This distribution will never get released; instead, packages from it will propagate into testing and then into a real release. Please note that security updates for unstable distribution are not managed by the security team. Hence, unstable does not get security updates in a timely manner. For more information please see the Security Team's FAQ. sid is subject to massive changes and in-place library updates. This can result in a very unstable system which contains packages that cannot be installed due to missing libraries, dependencies that cannot be fulfilled etc. Use it at your own risk!

        最新稳定版吧“squeeze”的当前官方介绍见下:


Debian “squeeze” Release Information Debian 6.0.6 was released September 29th, 2012. Debian 6.0.0 was initially released on February 6th, 2011. The release included many major changes, described in our press release and the Release Notes. To obtain and install Debian, see the installation information page and the Installation Guide. To upgrade from an older Debian release, see the instructions in the Release Notes.

        二、获取当前系统版本:


        1)查看软件源文件,以后简称为源:/etc/apt/spurces.list


        我的是:


deb http://mirrors.ustc.edu.cn/debian/ sid contrib non-free main
deb-src http://mirrors.ustc.edu.cn/debian/ sid contrib non-free main
deb http://mirrors.ustc.edu.cn/debian-multimedia/ sid main non-free
deb-src http://mirrors.ustc.edu.cn/debian-multimedia/ sid main non-free
# deb http://mirrors.ustc.edu.cn/debian-security/ testing/updates contrib non-free main
# deb http://mirrors.ustc.edu.cn/debian-security/ stable/updates contrib non-free main


deb http://http.us.debian.org/debian/ sid contrib non-free main

        可以看到,我使用的更新版本描述是:sid,也表示unstable版。注意使用#注销的两行表示安全补丁的地址,明显的,sid版没有安全补丁源,这是在unstable版的官方介绍中提到了的。

        2)cat /etc/debian_version

        我得到的结果是:


wheezy/sid

        表示,我的系统是处于未来稳定版本

wheezy(7.0)的开发状态,这里code name :wheezy和 sid是共存的,并不冲突。

        值得注意的是,这里wheezy/sid并不代表是unstable版本,而是表示wheezy的开发中版本,可以是testing,也可以是unstable。因为,你可以发现即使我在源中使用 testing 来更新系统,结果依然是 wheezy。这个问题的解释是【1】,debian_version文件在系统更新时的软件包:base-files 中,查看地址http://packages.debian.org/wheezy/base-files 和地址http://packages.debian.org/sid/base-files 可以看到,右栏“下载源码包 base-files:”后面的文件都是“[base-files_6.11.dsc]”而且地址也都是“http://ftp.de.debian.org/debian/pool/main/b/base-files/base-files_6.11.dsc”,显然,这两个文件是相同的,于是cat /etc/debian_version结果相同。实际上,更早时候,debian开发中版本的debian_version文件内容为testing/unstable,只是之后发生了更名变化。

可以预计,在稳定版wheezy正式发布(预计2013年2月)后,如果下一稳定版本的code name叫做xxx,testing/unstable/sid源更新后的debian_version文件应该变为xxx/sid 。而在稳定版wheezy正式发布后,使用wheezy做源,更新后的系统的debian_version的内容就是诸如7.0、7.1、... 之类的稳定版的版本数字号了。


        那么,为什么debian的testing 和 unstable /etc/debian_version文件都如此表述相同呢?我的理解是,

testing与unstable的系统组件其实相差不大,官网unstable版wiki中确实提到【2】:


Debian Testing - repository with packages from unstable, if no bugs are found within 10 days.

下面我们可以通过查看各系统版本的发行软件版本来了解各系统差异。

        首先我们查找texstudio,一个非常不错的latex编辑软件。

stable:

您在suite(s) stable中所有硬件架构下所有版面里,指定关键字 texstudio 在软件包名称中搜索的结果。

很遗憾,您没能搜索到任何结果

testing:

软件包 texstudio
wheezy (testing) (editors): Latex Editor 
2.3+debian-3: amd64 armel armhf i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel powerpc s390 s390x sparc

unstable/sid:

软件包 texstudio
sid (unstable) (editors): Latex Editor 
2.3+debian-3: alpha amd64 armel armhf hurd-i386 i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel powerpc s390 s390x sh4 sparc sparc64

texstudio原名是texmaker,我们发现texstudio在stable中没有,在testing/unstable中版本相同。

        第二,我们查找lyx:

软件包 lyx
squeeze (stable) (editors): Document Processor 
1.6.7-1: amd64 armel i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel powerpc s390 sparc
wheezy (testing) (editors): document processor 
2.0.3-3: amd64 armel armhf i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel powerpc s390 s390x sparc
sid (unstable) (editors): document processor 
2.0.3-3: alpha amd64 armel armhf hurd-i386 i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel powerpc s390 s390x sh4 sparc sparc64 
2.0.0-1 [debports]: powerpcspe 
2.0.0~rc1-1: hppa 
1.6.5-1 [debports]: avr32 
1.6.2-1 [debports]: m68k

lyx在testing/unstable中相同,与stable版相差很大。

         第三,查找重量级组建:gcc:

软件包 gcc
squeeze (stable) (devel): GNU C 编译器 
4:4.4.5-1: amd64 armel i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel powerpc s390 sparc
wheezy (testing) (devel): GNU C 编译器 
4:4.7.1-1: amd64 i386 kfreebsd-amd64 kfreebsd-i386 
4:4.6.3-7: armel armhf ia64 mips mipsel powerpc s390 s390x sparc
sid (unstable) (devel): GNU C 编译器 
4:4.7.2-1: amd64 hurd-i386 i386 kfreebsd-amd64 kfreebsd-i386 
4:4.6.3-8 [debports]: alpha armel armhf ia64 mips mipsel powerpc s390 s390x sh4 sparc 
4:4.6.3-7 [debports]: m68k 
4:4.6.3-5 [debports]: sparc64 
4:4.6.2-4 [debports]: powerpcspe 
4:4.5.2-5: hppa

重量级的关键组建gcc在最常用的amd64构架CPU的testing版和unstable版中分别是:4.7.1 和 4.7.2只差一个最小版本号,他们与stable版4.4.5在版本号的更高层次都相差很大。

        以上显示即使是最核心最关键的gcc都有相同的大版本号,其他软件更是没有区别。所以我们可以得到结论,testing确实与unstable版的新旧程度相差不多,unstable中10天的完全稳定就进入testing是可信的。这样我们即使需要新的组件也没有必要使用开发更新频繁的unstable版,使用已经足够稳定的testing版系统是最佳选择。

        顺便补充一点,testing与下一个stable版在接近stable发布的时候也是非常相近的,然而一旦stable发布,stable就冻结了多数特性,而之前因预备发布stable而导致特性冻结的testing版会被解冻,之后testing随unstable测试新特性。前提到,unstable中软件约10天的无bug后就进入testing,所以此时大量新特性的加入导致,即使testing已经有10天的无bug期,这时使用testing更新系统也是不很稳定的。也就是说,testing在stable发布后因跟随unstable而进入极不稳定的前 testing 陷阱[1]。所以我们在使用testing版时需要注意这段时期,尽量规避,比如可以在新稳定版xxx发布前,使用xxx代替testing做源的版本标记,等stable发布时我们的系统就是新稳定版系统,这样等待一段时间(比10天多一个量级,比如2-3个月),等下一个待发布的稳定版yyy的testing版比较稳定后,再将源的版本号xxx换成下一个稳定版的版本号yyy,这样也代表当前testing版。也就是说,我们推荐的更新方法是,遵循debian发行稳定版的轨迹,始终使用当前的稳定版或下一个稳定版的版本号做为更新源的标识,并只在稳定版发布时间点到后延一段时间的时期之内使用当前稳定版的版本code name 做为更新源标识,这样,绝大多数时间内,我们的系统都是testing版的,既有更新的系统组件同时也具有较好的稳定性也包含安全补丁更新 

         那么言归正传,问题依然没有彻底解决,最明确的发行版本识别方法是?见方法3-4:

        3) lsb_release -a

        我的运行结果是:

No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux unstable (sid)
Release:	unstable
Codename:	sid



        结果清晰的显示了我的系统版本是unstable的,这完全反映了我使用sid源更新得到了unstable/sid系统,在源中使用unstable代替sid得到的系统是一样的,其实自己对比更新系统的源的服务器上网络文件,可以看到他们完全相同。

        4)查询更详细的系统组建版本状态。

        事实上系统是许多软件的合集,如果混合使用不同版本的更新源,那么导致出现,有的软件是unstable版中的,有的是在testing版中的,这时会遇到更多的系统稳定性问题,我们最好不要这样做。如何鉴别我们的系统是不是纯种系统呢?比较好用的方法是【3】,使用命令 aptitude version packagename 检查各个组件包所在的发行版状态,来确定我们是否混用不同发行版的组件包。例如查询我的qtiplot软件包:

aptitude versions qtiplot
软件包 qtiplot:                     
i   0.9.8.8-5+b1                                                                                 unstable                                                                 990 

软件包 qtiplot-doc:
i A 0.9.8.8-5                                                                                    unstable                                                                 990

显示:我的软件包qtiplot是在unstable版本中的,版本号是0.9.8.8-5+b1。第三行和第六行行首的 “i” 表示已安装,如果是 “p” 表示未安装的包。aptitude version 有时显示过多信息,需要更简洁的可以使用命令:apt-cache policy,功能类似。读者可以测试其他软件包,这样能够更清楚的了解自己系统中组件的版本状态。如果想查询系统内核版本,可以使用 uname -a。


        三、总结一下debian的版本演化情况



        从稳定版squeeze发布谈起,我们的核心目标是得到下一个稳定版的wheezy,发行周期预定约两年。

        首先,开发者编译新版软件,放在 experimental 版中测试运行并暂时没有重大或太多明显bug。

        然后,将之放入unstable/sid版中继续测试,如果一小段时间(比如上文所说10天)内没有bug被提交,那么将软件放入testing版本中继续测试。

        之后,新版软件不断在unstable和testing中测试并修改bug,时间延续约1年半后,冻结新软件的功能特性,集中修改剩余bug。这段时间被称为新稳定版的,期间testing版和unstable/sid版的/etc/debian_version 版本号都使用 wheezy/sid。

        最后,当testing版本足够稳定几乎没有bug后,按照计划就是约半年后,发布新版的稳定版本wheezy,初始的debian_version版本号定为7.0。之后有专门的维护团队维护wheezy版本的安全补丁或隐藏的小bug,并依时间段发布7.1, 7.2 等版本。

        接着就是下一个循环。

        最后打个比方,开发一个新的稳定debian系统好比树人,组件在 experimental 版中诞生,在unstable版中孕育,在testing中成长,最后成长为强壮稳定有力的个体,称为“squeeze”、“wheezy”、... 。于是,在debian中,一切其他的版本号都是

浮云般的浮动标签,一切只是为了两年孕育一个有名的新版系统。