我很早就想对gentoo进行升级。因为我的gentoo版本太老了。以至于很多软件都装不上,动不动就跳出一个:
[blocks B ] <=x11-base/xorg-x11-6.9 (is blocking x11-drivers/xf86-video-tga-1.1.0, x11-libs/libXdamage-1.1.1, x11-proto/xf86vidmodeproto-2.2.2, x11-drivers/xf86-video-fbdev-0.3.1, x11-drivers/xf86-video-nsc-2.8.2, x11-proto/xf86driproto-2.0.3, x11-libs/libXrandr-1.2.1, x11-apps/setxkbmap-1.0.2, x11-proto/glproto-1.4.8, x11-libs/libXfont-1.2.7-r1, media-fonts/encodings-1.0.2, x11-proto/bigreqsproto-1.0.2, x11-apps/xauth-1.0.2, x11-libs/libXdmcp-1.0.2, x11-apps/xkbcomp-1.0.3, x11-libs/libXinerama-1.0.2, x11-wm/twm-1.0.3, x11-libs/libXfixes-4.0.3, x11-proto/xcmiscproto-1.1.2, x11-apps/xclock-1.0.2, x11-drivers/xf86-video-ark-0.6.0, x11-drivers/xf86-video-s3virge-1.9.1, x11-libs/libXmu-1.0.3, x11-proto/xproto-7.0.10, x11-proto/xf86rushproto-1.1.2, x11-libs/libXxf86vm-1.0.1, app-doc/xorg-docs-1.4, x11-base/xorg-server-1.2.0-r3, x11-proto/damageproto-1.1.0, x11-libs/libXScrnSaver-1.1.2, x11-drivers/xf86-video-neomagic-1.1.1, x11-apps/mkfontdir-1.0.3, x11-libs/libXp-1.0.0, x11-apps/rgb-1.0.1, x11-proto/recordproto-1.13.2, x11-apps/luit-1.0.2, x11-libs/libXi-1.1.0, x11-proto/xf86dgaproto-2.0.2, x11-apps/xhost-1.0.1, x11-drivers/xf86-video-sisusb-0.8.1, x11-drivers/xf86-video-vesa-1.3.0, x11-drivers/xf86-video-ati-6.6.3, x11-drivers/xf86-video-s3-0.5.0, x11-drivers/xf86-video-i810-1.7.4, media-fonts/font-adobe-utopia-type1-1.0.1, x11-proto/printproto-1.0.3, x11-apps/xrdb-1.0.3, x11-proto/xf86miscproto-0.9.2, x11-proto/fontcacheproto-0.1.2, x11-libs/libXpm-3.5.6, x11-libs/libXau-1.0.3, x11-apps/xrandr-1.2.0, x11-drivers/xf86-video-tdfx-1.3.0, x11-libs/libxkbfile-1.0.4, x11-proto/resourceproto-1.0.2, x11-proto/kbproto-1.0.3, x11-libs/libXt-1.0.5, x11-proto/renderproto-0.9.2, x11-drivers/xf86-video-cirrus-1.1.0, x11-drivers/xf86-video-chips-1.1.1, x11-libs/libXvMC-1.0.4, x11-drivers/xf86-video-imstt-1.1.0, x11-libs/libXcursor-1.1.8, x11-apps/mkfontscale-1.0.3, media-fonts/font-cursor-misc-1.0.0, x11-proto/videoproto-2.2.2, x11-drivers/xf86-video-v4l-0.1.1, x11-drivers/xf86-video-vmware-10.15.0, x11-apps/xinit-1.0.3-r3, x11-apps/xsm-1.0.1, x11-proto/compositeproto-0.3.1, x11-drivers/xf86-input-keyboard-1.1.1, x11-libs/libXxf86misc-1.0.1, x11-libs/libXft-2.1.12, x11-libs/xtrans-1.0.3, x11-drivers/xf86-input-mouse-1.2.1, x11-libs/libXtst-1.0.1, x11-drivers/xf86-video-i128-1.2.1, x11-drivers/xf86-video-sis-0.9.1-r1, x11-proto/randrproto-1.2.1, x11-drivers/xf86-video-dummy-0.2.0, x11-drivers/xf86-video-siliconmotion-1.5.1, media-libs/mesa-6.5.2-r1, x11-libs/libXcomposite-0.3.1, x11-drivers/xf86-input-evdev-1.1.5-r1, media-fonts/font-adobe-75dpi-1.0.0, x11-proto/dmxproto-2.2.2, x11-drivers/xf86-video-trident-1.2.3, x11-drivers/xf86-video-nv-1.2.2.1, media-fonts/font-misc-misc-1.0.0, x11-libs/libdrm-2.3.0, x11-libs/libXaw-1.0.3, x11-drivers/xf86-video-vga-4.1.0, x11-misc/util-macros-1.1.5, x11-proto/xineramaproto-1.1.2, x11-drivers/xf86-video-voodoo-1.1.1, x11-drivers/xf86-video-i740-1.1.0, x11-proto/scrnsaverproto-1.1.0, x11-libs/liblbxutil-1.0.1, x11-apps/iceauth-1.0.1, x11-drivers/xf86-video-via-0.2.2, x11-proto/evieext-1.0.2, x11-libs/libXrender-0.9.2, x11-proto/fixesproto-4.0, x11-proto/fontsproto-2.0.2, x11-drivers/xf86-video-apm-1.1.1, x11-drivers/xf86-video-glint-1.1.1, x11-libs/libSM-1.0.2, media-fonts/font-adobe-100dpi-1.0.0, x11-apps/xprop-1.0.2, x11-drivers/xf86-video-rendition-4.1.3, x11-apps/xmodmap-1.0.2, x11-drivers/xf86-video-savage-2.1.2-r1, x11-proto/xextproto-7.0.2, x11-libs/libXext-1.0.3, media-fonts/font-util-1.0.1, x11-misc/makedepend-1.0.0, x11-drivers/xf86-video-cyrix-1.1.0, x11-proto/xf86bigfontproto-1.1.2, x11-proto/trapproto-3.4.3, x11-apps/sessreg-1.0.2, x11-proto/inputproto-1.4.1, media-fonts/font-alias-1.0.1, x11-libs/libdmx-1.0.2, x11-libs/libICE-1.0.3, x11-libs/libXres-1.0.3, x11-libs/libfontenc-1.0.4, x11-apps/xdpyinfo-1.0.2, x11-libs/libXxf86dga-1.0.1, x11-misc/xbitmaps-1.0.1, x11-drivers/xf86-video-tseng-1.1.1, x11-drivers/xf86-video-mga-1.4.6.1, x11-libs/libXv-1.0.3, media-fonts/font-bh-type1-1.0.0, x11-apps/bdftopcf-1.0.0, x11-libs/libxkbui-1.0.2, x11-libs/libX11-1.1.1-r1)
然而升级有较大风险,尤其是更新X,更新失败的话连X都没有了。最后还是下定决心,更新一把。
第一步自然是更新软件包数据库
emerge --sync
为了防止网络不好,更新到一半就失败。我先用以下命令预先把源代码包下载下来。
emerge -fuDv world
Total: 562 packages (269 upgrades, 1 downgrade, 268 new, 24 in new slots, 13 blocks), Size of downloads: 0 kB
发现要更新的软件包达500多个,没办法,这就是长期不升级的后果。大概花了整整一天,终于把所有源代码包下载到了/usr/portage/下。
终于可以升级了。
emerge -uDv world
还是不行。提示有很多软件包block了其它软件包(所谓block,简单地理解就是软件包之间的冲突,解决办法是把冲突的软件包卸载掉,然后系统会自动安装新的不冲突的软件包):
[blocks B ] >=sys-fs/udev-089 (is blocking sys-apps/coldplug-20040920-r1)
[blocks B ] app-admin/eselect-esd (is blocking media-sound/esound-0.2.36-r1)
[blocks B ] sys-libs/libutempter (is blocking sys-apps/utempter-0.5.5.6)
[blocks B ] virtual/xft (is blocking x11-base/xorg-x11-6.8.2-r6)
[blocks B ] <=x11-base/xorg-x11-6.9 (is blocking x11-drivers/xf86-video-tga-1.1.0, x11-libs/libXdamage-1.1.1, x11-proto/xf86vidmodeproto-2.2.2, x11-drivers/xf86-video-fbdev-0.3.1, x11-drivers/xf86-video-nsc-2.8.2, x11-proto/xf86driproto-2.0.3, x11-libs/libXrandr-1.2.1, x11-apps/setxkbmap-1.0.2, x11-proto/glproto-1.4.8, x11-libs/libXfont-1.2.7-r1, media-fonts/encodings-1.0.2, x11-proto/bigreqsproto-1.0.2, x11-apps/xauth-1.0.2, x11-libs/libXdmcp-1.0.2, x11-apps/xkbcomp-1.0.3, x11-libs/libXinerama-1.0.2, x11-wm/twm-1.0.3, x11-libs/libXfixes-4.0.3, x11-proto/xcmiscproto-1.1.2, x11-apps/xclock-1.0.2, x11-drivers/xf86-video-ark-0.6.0, x11-drivers/xf86-video-s3virge-1.9.1, x11-libs/libXmu-1.0.3, x11-proto/xproto-7.0.10, x11-proto/xf86rushproto-1.1.2, x11-libs/libXxf86vm-1.0.1, app-doc/xorg-docs-1.4, x11-base/xorg-server-1.2.0-r3, x11-proto/damageproto-1.1.0, x11-libs/libXScrnSaver-1.1.2, x11-drivers/xf86-video-neomagic-1.1.1, x11-apps/mkfontdir-1.0.3, x11-libs/libXp-1.0.0, x11-apps/rgb-1.0.1, x11-proto/recordproto-1.13.2, x11-apps/luit-1.0.2, x11-libs/libXi-1.1.0, x11-proto/xf86dgaproto-2.0.2, x11-apps/xhost-1.0.1, x11-drivers/xf86-video-sisusb-0.8.1, x11-drivers/xf86-video-vesa-1.3.0, x11-drivers/xf86-video-ati-6.6.3, x11-drivers/xf86-video-s3-0.5.0, x11-drivers/xf86-video-i810-1.7.4, media-fonts/font-adobe-utopia-type1-1.0.1, x11-proto/printproto-1.0.3, x11-apps/xrdb-1.0.3, x11-proto/xf86miscproto-0.9.2, x11-proto/fontcacheproto-0.1.2, x11-libs/libXpm-3.5.6, x11-libs/libXau-1.0.3, x11-apps/xrandr-1.2.0, x11-drivers/xf86-video-tdfx-1.3.0, x11-libs/libxkbfile-1.0.4, x11-proto/resourceproto-1.0.2, x11-proto/kbproto-1.0.3, x11-libs/libXt-1.0.5, x11-proto/renderproto-0.9.2, x11-drivers/xf86-video-cirrus-1.1.0, x11-drivers/xf86-video-chips-1.1.1, x11-libs/libXvMC-1.0.4, x11-drivers/xf86-video-imstt-1.1.0, x11-libs/libXcursor-1.1.8, x11-apps/mkfontscale-1.0.3, media-fonts/font-cursor-misc-1.0.0, x11-proto/videoproto-2.2.2, x11-drivers/xf86-video-v4l-0.1.1, x11-drivers/xf86-video-vmware-10.15.0, x11-apps/xinit-1.0.3-r3, x11-apps/xsm-1.0.1, x11-proto/compositeproto-0.3.1, x11-drivers/xf86-input-keyboard-1.1.1, x11-libs/libXxf86misc-1.0.1, x11-libs/libXft-2.1.12, x11-libs/xtrans-1.0.3, x11-drivers/xf86-input-mouse-1.2.1, x11-libs/libXtst-1.0.1, x11-drivers/xf86-video-i128-1.2.1, x11-drivers/xf86-video-sis-0.9.1-r1, x11-proto/randrproto-1.2.1, x11-drivers/xf86-video-dummy-0.2.0, x11-drivers/xf86-video-siliconmotion-1.5.1, media-libs/mesa-6.5.2-r1, x11-libs/libXcomposite-0.3.1, x11-drivers/xf86-input-evdev-1.1.5-r1, media-fonts/font-adobe-75dpi-1.0.0, x11-proto/dmxproto-2.2.2, x11-drivers/xf86-video-trident-1.2.3, x11-drivers/xf86-video-nv-1.2.2.1, media-fonts/font-misc-misc-1.0.0, x11-libs/libdrm-2.3.0, x11-libs/libXaw-1.0.3, x11-drivers/xf86-video-vga-4.1.0, x11-misc/util-macros-1.1.5, x11-proto/xineramaproto-1.1.2, x11-drivers/xf86-video-voodoo-1.1.1, x11-drivers/xf86-video-i740-1.1.0, x11-proto/scrnsaverproto-1.1.0, x11-libs/liblbxutil-1.0.1, x11-apps/iceauth-1.0.1, x11-drivers/xf86-video-via-0.2.2, x11-proto/evieext-1.0.2, x11-libs/libXrender-0.9.2, x11-proto/fixesproto-4.0, x11-proto/fontsproto-2.0.2, x11-drivers/xf86-video-apm-1.1.1, x11-drivers/xf86-video-glint-1.1.1, x11-libs/libSM-1.0.2, media-fonts/font-adobe-100dpi-1.0.0, x11-apps/xprop-1.0.2, x11-drivers/xf86-video-rendition-4.1.3, x11-apps/xmodmap-1.0.2, x11-drivers/xf86-video-savage-2.1.2-r1, x11-proto/xextproto-7.0.2, x11-libs/libXext-1.0.3, media-fonts/font-util-1.0.1, x11-misc/makedepend-1.0.0, x11-drivers/xf86-video-cyrix-1.1.0, x11-proto/xf86bigfontproto-1.1.2, x11-proto/trapproto-3.4.3, x11-apps/sessreg-1.0.2, x11-proto/inputproto-1.4.1, media-fonts/font-alias-1.0.1, x11-libs/libdmx-1.0.2, x11-libs/libICE-1.0.3, x11-libs/libXres-1.0.3, x11-libs/libfontenc-1.0.4, x11-apps/xdpyinfo-1.0.2, x11-libs/libXxf86dga-1.0.1, x11-misc/xbitmaps-1.0.1, x11-drivers/xf86-video-tseng-1.1.1, x11-drivers/xf86-video-mga-1.4.6.1, x11-libs/libXv-1.0.3, media-fonts/font-bh-type1-1.0.0, x11-apps/bdftopcf-1.0.0, x11-libs/libxkbui-1.0.2, x11-libs/libX11-1.1.1-r1)
[blocks B ] app-admin/fam (is blocking app-admin/gamin-0.1.8)
[blocks B ] sys-apps/pam-login (is blocking sys-apps/shadow-4.0.18.1)
[blocks B ] kde-base/kde-env (is blocking kde-base/kdelibs-3.5.5-r10)
[blocks B ] sys-apps/coldplug (is blocking sys-fs/udev-104-r12)
[blocks B ] [blocks B ] sys-apps/utempter (is blocking sys-libs/libutempter-1.1.5)
[blocks B ] [blocks B ] app-admin/gamin (is blocking app-admin/fam-2.7.0-r2, app-admin/fam-2.7.0-r4)
其中最为可恨的是x11-base/xorg-x11-6.9这个软件包。不过干掉它,会使很多X应用程序运行不了。所以,需要用到的软件,如firefox之类,一定要打开。因为一关闭,在升级成功之前,就再也打不开啦。
安全起见,先运行:
emerge --pretend --unmerge xorg-x11
确认没有重要的包被删除,才真正动手(以前不小心把python删除了,结果连emerge都跑不起来,最后重装了事。)
运行:
emerge --unmerge xorg-x11
删除总是比安装顺利:P
然后重新安装xorg-x11
emerge xorg-x11
出了点问题
>>> Emerging (94 of 143) x11-misc/xkeyboard-config-0.8-r1 to /
* xkeyboard-config-0.8.tar.bz2 RMD160 ;-) ... [ ok ] * xkeyboard-config-0.8.tar.bz2 SHA1 ;-) ... [ ok ] * xkeyboard-config-0.8.tar.bz2 SHA256 ;-) ... [ ok ] * xkeyboard-config-0.8.tar.bz2 size ;-) ... [ ok ] * checking ebuild checksums ;-) ... [ ok ] * checking auxfile checksums ;-) ... [ ok ] * checking miscfile checksums ;-) ... [ ok ] * checking xkeyboard-config-0.8.tar.bz2 ;-) ... [ ok ] * Directory /usr/lib/X11/xkb should be
* manually deleted/renamed/relocated before installing!
!!! ERROR: x11-misc/xkeyboard-config-0.8-r1 failed.
Call stack:
ebuild.sh, line 1631: Called dyn_setup
ebuild.sh, line 703: Called qa_call 'pkg_setup'
ebuild.sh, line 44: Called pkg_setup
xkeyboard-config-0.8-r1.ebuild, line 26: Called die
!!! Manually remove /usr/lib/X11/xkb
!!! If you need support, post the topmost build error, and the call stack if relevant.
!!! A complete build log is located at '/var/tmp/portage/x11-misc/xkeyboard-config-0.8-r1/temp/build.log'.
不过这个简单,把/usr/lib/X11/xkb/重命名一下就行了(不要删除,这样不安全)
之后一切顺利。少了一个最可恨的block包
其它的包也类似,凡是block的一律unmerge掉。
有几个包是互相冲突的,如app-admin/fam和app-admin/gamin-0.1.8,有我没你,有你没我。于是统统卸载掉。
最后,所有的block包都被干掉了,终于可以开始升级了。别急,麻烦还在后头呢。
emerge -uDv world
开始时一切顺利,看着满屏的“g++ -I ”之类,我感到莫名的兴奋。
好景不长
>>> Merging sys-apps/dbus-1.0.2-r2 to /
WARN=BAD=HILITE=BRACKET=* Adding group 'messagebus' to your system ...
WARN=BAD=HILITE=BRACKET=* - Groupid: next available
/usr/portage/eclass/eutils.eclass: line 708: groupadd: command not found
!!! ERROR: sys-apps/dbus-1.0.2-r2 failed.
Call stack:
ebuild.sh, line 1631: Called dyn_preinst
ebuild.sh, line 1079: Called pkg_preinst
dbus-1.0.2-r2.ebuild, line 99: Called enewgroup 'messagebus'
eutils.eclass, line 708: Called die
!!! enewgroup failed
!!! If you need support, post the topmost build error, and the call stack if relevant.
!!! A complete build log is located at '/var/tmp/portage/sys-apps/dbus-1.0.2-r2/temp/build.log'.
!!! FAILED preinst: 1
没有groupadd命令。
安装gentoolkit,用equery belongs groupadd,发现我把sys-apps/shadow给删除了。
原来我在开始时unmerge得太兴奋,把sys-apps/shadow也删除了。
之后有些包是和内核相关的,所以要建一个/usr/src/linux链接,指向linux内核源代码。该源代码一定要make menuconfig过。
之后出现了一个编译错误。google之,找到一个patch .修改之。
由于emerge时解压到/var/tmp/portage/所以:
ebuild /var/tmp/portage/XXX/.../XXX.ebuild compile(编译)
ebuild /var/tmp/portage/XXX/.../XXX.ebuild install(安装)
ebuild /var/tmp/portage/XXX/.../XXX.ebuild qmerge(告诉系统,这个包已经安装完毕了。)
在安装最后50多个包时,又出了一次问题:
安装gnome-extra/gnome-keyring-manager-2.16.0-r1 时,出现如下错误:
http://www.oasis-open.org/docbook/xml/4.2/ent/iso-box.ent:1: parser error : Content error in the external subset
HTTP/1.1 200 OK
^
http://www.oasis-open.org/docbook/xml/4.2/ent/iso-box.ent:1: parser error : Content error in the external subset
HTTP/1.1 200 OK
^
http://www.oasis-open.org/docbook/xml/4.2/ent/iso-box.ent:1: parser error : Content error in the external subset
HTTP/1.1 200 OK
^
unable to parse es/gnome-keyring-manager.xml
make[2]: *** [gnome-keyring-manager-es.omf] Error 6
make[2]: Leaving directory `/var/tmp/portage/gnome-extra/gnome-keyring-manager-2.16.0-r1/work/gnome-keyring-manager-2.16.0/docs'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/gnome-extra/gnome-keyring-manager-2.16.0-r1/work/gnome-keyring-manager-2.16.0'
make: *** [all] Error 2
!!! ERROR: gnome-extra/gnome-keyring-manager-2.16.0-r1 failed.
Call stack:
ebuild.sh, line 1615: Called dyn_compile
ebuild.sh, line 972: Called qa_call 'src_compile'
ebuild.sh, line 44: Called src_compile
ebuild.sh, line 1305: Called gnome2_src_compile
gnome2.eclass, line 71: Called die
!!! compile failure
!!! If you need support, post the topmost build error, and the call stack if relevant.
!!! A complete build log is located at '/var/tmp/portage/gnome-extra/gnome-keyring-manager-2.16.0-r1/temp/build.log'.
经查,是由于app-text/docbook-xml-dtd这个软件包已经装了4.4-r1 4.3 4.1.2-r6这三个版本,但还缺少4.2-r1。这个软件包没有做到向下兼容。所以解析文件时出错了。
经过千辛万苦,三天三夜的战斗,终于把系统升级到最新状态。
最赞的是在把软件包卸载以后,原来打开的对应的软件还能继续跑。当时把xorg-x11删除后,X继续运行没有问题。怎样做到的?(当然把X关掉再启动就运行不了了。)windows下根本不允许你卸载,它会提示“程序正在运行,拒绝访问”之类,不过这样虽然不方便,的确是比较安全的做法。