Upgrading old Gentoo installations 1


Sometimes for whatever reason You need to upgrade an old or really old Gentoo installation. Reinstall just is not an option. Upgrading old Gentoo installations is not really a plain sailing. All sorts of circular dependencies come up. For example portage is 2.1.6.13, bash is 3.2_p39 and python is 2.5.4. First thing in Gentoo upgrading is usually to get portage as fresh as possible.  Latest stable portage at this moment is 2.1.10.11. Installing is not so simple. It depends on python 2.7 or 2.6 and bash at minimum of 3.2_p17, but as newer bash 4.1 is available, emerge -avu wants to upgrade to it. Bash 4.1_p9 requires portage 2.1.7.6 at minimum. So here we have the first circular dependency. Newer portage wants to upgrade bash, which needs newer portage.

emerge -avu portage

Calculating dependencies... done!
[ebuild  N    ] dev-libs/libffi-3.0.9-r2  USE="-debug -static-libs -test" 715 kB
[ebuild  N    ] app-misc/mime-types-8  12 kB
[ebuild  N    ] virtual/libffi-0  0 kB
[ebuild     U ] app-shells/bash-4.1_p9 [3.2_p39] USE="net%* nls -afs -bashlogger -examples -mem-scramble% -plugins -vanilla" 6,458 kB
[ebuild  NS   ] dev-lang/python-2.7.1-r1 [2.3.6-r4, 2.4.4-r9, 2.5.4-r2] USE="gdbm ipv6 ncurses readline ssl threads (wide-unicode) xml -berkdb -build -doc -examples -sqlite -tk -wininst" 11,461 kB
[ebuild     U ] sys-apps/portage-2.1.10.11 [2.1.6.13] USE="(ipc%*) less%* -build -doc -epydoc -python2% -python3% (-selinux)" LINGUAS="-pl" 0 kB
*** Portage will stop merging at this point and reload itself,
then resume the merge.
[blocks B     ] dev-lang/python:2.7 ("dev-lang/python:2.7" is blocking sys-apps/portage-2.1.6.13)
[blocks B     ] <sys-apps/portage-2.1.7.16 ("<sys-apps/portage-2.1.7.16" is blocking app-shells/bash-4.1_p9)
[blocks B     ] <sys-apps/portage-2.1.9 ("<sys-apps/portage-2.1.9" is blocking dev-lang/python-2.7.1-r1)
Total: 6 packages (2 upgrades, 3 new, 1 in new slot), Size of downloads: 18,646 kB
Conflict: 3 blocks (3 unsatisfied)

Cannot upgrade, some blocks are present. Finding out the minimum version of bash required is simple:

cat /usr/portage/sys-apps/portage/portage-2.1.10.11.ebuild | grep bash
>=app-shells/bash-3.2_p17

To break that circle, lets mask newer bash first.
echo  ">=app-shells/bash-3.2_p39" > /etc/portage/package.mask

New test on emerge
emerge -avu portage

These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild  N    ] dev-libs/libffi-3.0.9-r2  USE="-debug -static-libs -test" 715 kB
[ebuild  N    ] app-misc/mime-types-8  12 kB
[ebuild  N    ] virtual/libffi-0  0 kB
[ebuild  NS   ] dev-lang/python-2.7.1-r1 [2.3.6-r4, 2.4.4-r9, 2.5.4-r2] USE="gdbm ipv6 ncurses readline ssl threads (wide-unicode) xml -berkdb -build -doc -examples -sqlite -tk -wininst" 11,461 kB
[ebuild     U ] sys-apps/portage-2.1.10.11 [2.1.6.13] USE="(ipc%*) less%* -build -doc -epydoc -python2% -python3% (-selinux)" LINGUAS="-pl" 0 kB
*** Portage will stop merging at this point and reload itself,
then resume the merge.
[blocks B     ] dev-lang/python:2.7 ("dev-lang/python:2.7" is blocking sys-apps/portage-2.1.6.13)
[blocks B     ] <sys-apps/portage-2.1.9 ("<sys-apps/portage-2.1.9" is blocking dev-lang/python-2.7.1-r1)
Total: 5 packages (1 upgrade, 3 new, 1 in new slot), Size of downloads: 12,188 kB
Conflict: 2 blocks (2 unsatisfied)

Bash block is gone.

Finding out what is the minimum required python version is a bit harder. Looking at  /usr/portage/sys-apps/portage/portage-2.1.10.11.ebuild we can find a row declaring:
build? ( || ( dev-lang/python:2.7 dev-lang/python:2.6[threads] )

so lets mask python 2.7
echo  ">=dev-lang/python-2.7" >>/etc/portage/package.mask

Please notice the >> this time we append to package.mask. Single > will just overwrite it.

Still no luck:

These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild  N    ] dev-libs/libffi-3.0.9-r2  USE="-debug -static-libs -test" 715 kB
[ebuild  N    ] app-misc/mime-types-8  12 kB
[ebuild  N    ] virtual/libffi-0  0 kB
[ebuild  NS   ] dev-lang/python-2.6.6-r2 [2.3.6-r4, 2.4.4-r9, 2.5.4-r2] USE="gdbm ipv6 ncurses readline ssl threads (wide-unicode) xml -berkdb -build -doc -examples -sqlite -tk -wininst" 10,838 kB
[ebuild     U ] sys-apps/portage-2.1.10.11 [2.1.6.13] USE="(ipc%*) less%* -build -doc -epydoc -python2% -python3% (-selinux)" LINGUAS="-pl" 0 kB
*** Portage will stop merging at this point and reload itself,
then resume the merge.
[blocks B     ] >=dev-lang/python-2.6.6:2.6 (">=dev-lang/python-2.6.6:2.6" is blocking sys-apps/portage-2.1.6.13)
[blocks B     ] <sys-apps/portage-2.1.9 ("<sys-apps/portage-2.1.9" is blocking dev-lang/python-2.6.6-r2)
Total: 5 packages (1 upgrade, 3 new, 1 in new slot), Size of downloads: 11,564 kB
Conflict: 2 blocks (2 unsatisfied)

Portage 2.1.9 is still needed by portage 2.6.6. Is there something older?
ls /usr/portage/dev-lang/python/ | grep ebuild

python-2.4.6.ebuild
python-2.5.4-r4.ebuild
python-2.6.6-r2.ebuild
python-2.6.7-r2.ebuild
python-2.7.1-r1.ebuild
python-2.7.2-r2.ebuild
python-2.7.2-r3.ebuild
python-3.1.3-r1.ebuild
python-3.1.4-r2.ebuild
python-3.1.4-r3.ebuild
python-3.2.2.ebuild
python-3.2-r2.ebuild

Nope. the oldest ebuild for python 2.6 is 2.6.6-r2, which requires portage that we do not have. do we have an ebuild for portage that is satisfied with python we do have?
ls /usr/portage/sys-apps/portage/ | grep ebuild

portage-2.1.10.11.ebuild
portage-2.1.10.18.ebuild
portage-2.1.10.19.ebuild
portage-2.1.10.3.ebuild
portage-2.1.6.13.ebuild
portage-2.1.6.7.ebuild
portage-2.1.9.42.ebuild
portage-2.2.0_alpha51.ebuild
portage-2.2.0_alpha58.ebuild
portage-2.2.0_alpha59.ebuild
portage-9999.ebuild

we are running portage 2.1.6.13, there is only one ebuild between 2.1.10.11 and 2.1.6.13. Lets try 2.1.9.42.
emerge -avu =sys-apps/portage-2.1.9.42

These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild  N    ] dev-libs/libffi-3.0.9-r2  USE="-debug -static-libs -test" 715 kB
[ebuild  N    ] app-misc/mime-types-8  12 kB
[ebuild  N    ] virtual/libffi-0  0 kB
[ebuild  NS   ] dev-lang/python-2.6.6-r2 [2.3.6-r4, 2.4.4-r9, 2.5.4-r2] USE="gdbm ipv6 ncurses readline ssl threads (wide-unicode) xml -berkdb -build -doc -examples -sqlite -tk -wininst" 10,838 kB
[ebuild     U ] sys-apps/portage-2.1.9.42 [2.1.6.13] USE="(ipc%*) less%* -build -doc -epydoc -python2% -python3% (-selinux)" LINGUAS="-pl" 747 kB
*** Portage will stop merging at this point and reload itself,
then resume the merge.
[blocks B     ] >=dev-lang/python-2.6.6:2.6 (">=dev-lang/python-2.6.6:2.6" is blocking sys-apps/portage-2.1.6.13)
[blocks B     ] <sys-apps/portage-2.1.9 ("<sys-apps/portage-2.1.9" is blocking dev-lang/python-2.6.6-r2)
Total: 5 packages (1 upgrade, 3 new, 1 in new slot), Size of downloads: 12,310 kB
Conflict: 2 blocks (2 unsatisfied)

Still no luck. The next thing we can try is to ignore dependencies. They are marked in ebuilds for a reason but with some luck we can ignore them and maybe get something semi-working out of it.
emerge -avu --nodeps =sys-apps/portage-2.1.9.42

Another check halts progress again.
This version of portage requires at least python-2.6 to be selected as the default python interpreter

Lets try to force python then.
emerge -avu =dev-lang/python-2.6.6-r2

without forcing python fails like so:
These are the packages that would be merged, in order:
Calculating dependencies... done!
!!! All ebuilds that could satisfy ">=dev-libs/popt-1.15" have been masked.
!!! One of the following masked packages is required to complete your request:
- dev-libs/popt-1.16-r1 (masked by: EAPI 3)
The current version of portage supports EAPI '2'. You must upgrade to a
newer version of portage before EAPI masked packages can be installed.
For more information, see the MASKED PACKAGES section in the emerge
man page or refer to the Gentoo Handbook.
(dependency required by "dev-util/pkgconfig-0.25-r2" [ebuild])
(dependency required by "dev-lang/python-2.6.6-r2" [ebuild])
(dependency required by "=dev-lang/python-2.6.6-r2" [argument])

EAPI version depends on portage. Basically, newer portage is needed. Back to the beginning then.

This popt library is needed by pkgconfig. What is the minimum of pkgconfig needed by pyhton?
cat /usr/portage/dev-lang/python/python-2.6.6-r2.ebuild | grep pkgconfig
dev-util/pkgconfig

We might be in luck just a pkgconfig is needed. Any version.

We do have pkgconfig 0.22 /var/db/pkg/ gives a hint here. Mask newer ones.
echo  ">dev-util/pkgconfig-0.22" >> /etc/portage/package.mask

Trying python again:
emerge -avu =dev-lang/python-2.6.6-r2

These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild  N    ] dev-libs/libffi-3.0.9-r2  USE="-debug -static-libs -test" 715 kB
[ebuild     U ] dev-libs/expat-2.0.1-r3 [2.0.1] 0 kB
[ebuild     U ] sys-libs/gdbm-1.8.3-r4 [1.8.3-r3] USE="berkdb" 0 kB
[ebuild  N    ] app-misc/mime-types-8  12 kB
[ebuild  N    ] virtual/yacc-0  0 kB
[ebuild     U ] sys-devel/autoconf-wrapper-10-r1 [8] 0 kB
[ebuild     U ] sys-devel/binutils-2.20.1-r1 [2.18-r1] USE="nls -multislot -multitarget -static-libs% -test -vanilla" 17,194 kB
[ebuild     U ] sys-devel/autoconf-2.68 [2.65-r1] USE="-emacs" 1,350 kB
[ebuild  N    ] virtual/libffi-0  0 kB
[ebuild     U ] sys-libs/zlib-1.2.5-r2 [1.2.3-r1] 475 kB
[uninstall    ] dev-libs/libxml2-2.6.30-r1  USE="ipv6 python readline -bootstrap -build -debug -doc -test"
[blocks b     ] <dev-libs/libxml2-2.7.7 ("<dev-libs/libxml2-2.7.7" is blocking sys-libs/zlib-1.2.5-r2)
[ebuild     U ] dev-libs/openssl-1.0.0e [0.9.8g] USE="zlib -bindist -gmp -kerberos -rfc3779% -sse2 -test (-emacs%)" 3,950 kB
[ebuild  NS   ] sys-devel/libtool-2.4-r1 [2.2.6b] USE="-vanilla" 833 kB
[uninstall    ] sys-devel/libtool-2.2.6b  USE="-test -vanilla"
[blocks b     ] =sys-devel/libtool-2*:1.5 ("=sys-devel/libtool-2*:1.5" is blocking sys-devel/libtool-2.4-r1)
[ebuild     U ] sys-libs/readline-6.1_p2 [5.2_p12-r1] 2,212 kB
[ebuild     U ] app-admin/python-updater-0.9 [0.2] 8 kB
[ebuild  NS   ] dev-lang/python-2.6.6-r2 [2.3.6-r4, 2.4.4-r9, 2.5.4-r2] USE="gdbm ipv6 ncurses readline ssl threads (wide-unicode) xml -berkdb -build -doc -examples -sqlite -tk -wininst" 10,838 kB
[blocks B     ] >=dev-lang/python-2.6.6:2.6 (">=dev-lang/python-2.6.6:2.6" is blocking sys-apps/portage-2.1.6.13)
[blocks B     ] <sys-apps/portage-2.1.9 ("<sys-apps/portage-2.1.9" is blocking dev-lang/python-2.6.6-r2)
Total: 15 packages (9 upgrades, 4 new, 2 in new slots, 2 uninstalls), Size of downloads: 37,583 kB
Conflict: 4 blocks (2 unsatisfied)

Blocking again, but now we do have a list of packages that python 2.6.6-r2 wants to install. Lets satisfy those dependencies we can and care about then. Specially those that do more than -r (revision) version upgrades and that do some uninstalls. python-updater is a no go, as it needs newer python of course.

I do use oneshot here as those packages are dependencies of something else anyway and I do not want to add them in my world file.
emerge -avu --oneshot libtool

Libtool was the only one that did work actually and it brought some dependencies along. Good.

Now lets try python with nodeps
emerge -avu --nodeps =dev-lang/python-2.6.6-r2

Unfortunately build fails.
error: /ffi.h: No such file or directory

There actually is no file named so in the whole machine. Quick look around in another, up to date machine reveals that ffi.h is supplied by dev-libs/libffi and actually virtual/libffi was one of the dependencies on python. This tends to happen if nodeps is used on installing packages.

Installing libffi worked and we got a newer python, installed with –nodeps though.  Portage upgrade worked after that also.

the next logical step is to remove package masks we added.
rm /etc/portage/package.mask

Now we can install python with dependencies. This is an important step, because portage can not possibly know, that we installed something with –nodeps and now it might not work as intended.

This takes care of upgrading portage. Next other development tools, python (it got updated already) , perl, gcc should be upgraded. then system, then world 🙂

There is no direct route to take if upgrading old Gentoo systems. Just a lot of patience. First upgrade, then mask if upgrade does not work, then –nodeps if mask is not enough. The last thing, if –nodeps also fails is to copy some newer binaries from installation CD. I have had to use that only once fortunately.

The thing to remember – keep Your systems up to date – it is a lot easier this way.

 


Leave a comment

Your email address will not be published. Required fields are marked *

One thought on “Upgrading old Gentoo installations