version 0.8 of libc5 to libc6 auto-upgrade script
I just ran this script on an old system (somewhere between rex and bo)
with lots of -dev packages installed. found and fixed two bugs.
- libc6 conflicts with libpthread0
- i made a typo... PKGS_GPP instead of PKGS_LIBGPP.
- some old version of perl's postrm didn't delete a .packlist file
from /usr/lib/perl5/i486-linux/5.003/auto/Mail/.packlist. check for
it and delete if found before installing perl.
apart from those problems, it ran through cleanly. i think it's nearly
finished (but i said that around version 0.2 didn't I :-)
# uncomment for debugging
# upgrade a libc5 (bo) machine to libc6 (hamm).
# based on Scott Ellis' excellent "Debian libc5 to libc6 Mini-HOWTO"
# document at http://www.gate.net/~storm/FAQ/libc5-libc6-Mini-HOWTO.html
# Author: Craig Sanders <firstname.lastname@example.org>
# Copyright Status: This script is hereby placed in the public domain
# Revision History:
# v0.0: 1998-01-08 (morning)
# - a rough transcript of scott's doc and my own experiences
# v0.1: 1998-01-08 (night)
# - a few bugfixes
# - i got unlazy and put in the right subdirectories for each package.
# should run a lot faster.
# - now checks for failure at critical points and exits with a different
# exit code for each failure.
# - now uses 'binary-$(dpkg --print-installation-architecture)' instead
# of 'binary-i386'.
# v0.2: 1998-01-09
# - fixed the perl-base/perl install (thanks Lindsay!)
# - improved the DEVPACKAGES=$(dpkg --get-selections...) and added -dbg
# v0.3: 1998-01-09 (p.m.)
# - fixed some directories
# - changed "-iB" to "-iBE" so that if the script fails and is run again
# it will not disturb things already in place.
# - added a final "dpkg --configure --pending".
# - sanity check that we are in the right place added
# v0.4: 1998-01-10 (Igor Grobman)
# - made it possible to place all packages in current dir.
# - added -pic packages to removal list.
# - make sure dpkg-dev does not get selected for removal.
# - moved dpkg-ftp and dpkg-mounted to the end.
#v0.5: 1998-01-10 (Igor Grobman)
# - added a note about upgrading libraries
#v0.6: 1998-01-11 (Craig Sanders)
# - restructured code to avoid code duplication.
# - cleaned up a few things
# - prints advisory notes telling user what's happening.
# - added some more instructions on what to do about development packages.
# - added code to guess some obvious locations for the mirror, otherwise
# ask user.
#v0.7: 1998-01-11 (Craig Sanders)
# - uh oh. i hard-coded in binary-i386. quick...better release another
# version before James notices.
#v0.8: 1998-01-11 (Craig Sanders)
# - added libpthread0 to the remove list.
# - fixed PKGS_LIBGPP (i mistyped it as PKGS_GPP)
# - some old version of perl's postrm didn't delete a .packlist file
# from /usr/lib/perl5/i486-linux/5.003/auto/Mail/.packlist. check for
# it and delete if found before installing perl.
# TODO: (probably by somebody else. this script is mostly good enough imo)
# - this script _still_ needs more error checking :-)
PKGS_LIBC6="base/ldso_*.deb base/libc5_*.deb base/libc6_*.deb \
This script will install the packages necessary to ensure a safe upgrade
You need to either have a local or remote mirror mounted, or have the
latest versions of the following packages from hamm available in the
ldso, libc5, libc6, timezones, locales, ncurses3.0, ncurses3.4,
libreadline2, libreadlineg2, bash, libg++272, dpkg, dpkg-dev,
dpkg-ftp, dpkg-mountable, libgdbm1, libgdbmg1, perl-base, and perl.
If you are using a mirror, press 'm'.
echo -n "if you have the files in the current dir, press 'c': (m/c) "
case "$answer" in
# local mirror available
# ask where the mirror is (this could do with some error checking)
echo "enter the full path to your local mirror of debian: "
echo "e.g. /debian/dists/unstable/main/$ARCH/"
TRY="/debian/dists/unstable/main/$ARCH ~ftp/debian/dists/unstable/main/$ARCH "
for i in $TRY ; do
if [ -d $i ] ; then
[ -n "$DEFAULT" ] && echo or just hit enter to use "$i".
[ -z "$DM" ] && DM=$DEFAULT
# current directory
echo "building list of package filenames to install..."
# convert PKGS_ variables to correct directory location
PKGS_LIBC6=$( echo $PKGS_LIBC6 | sed -e "$SEDSCRIPT" )
PKGS_NCURSES=$( echo $PKGS_NCURSES | sed -e "$SEDSCRIPT" )
PKGS_LIBRL=$( echo $PKGS_LIBRL | sed -e "$SEDSCRIPT" )
PKGS_LIBRLG=$( echo $PKGS_LIBRLG | sed -e "$SEDSCRIPT" )
PKGS_BASH=$( echo $PKGS_BASH | sed -e "$SEDSCRIPT" )
PKGS_LIBGPP=$( echo $PKGS_LIBGPP | sed -e "$SEDSCRIPT" )
PKGS_DPKG=$( echo $PKGS_DPKG | sed -e "$SEDSCRIPT" )
PKGS_LIBGDBM=$( echo $PKGS_LIBGDBM | sed -e "$SEDSCRIPT" )
PKGS_PERLBASE=$( echo $PKGS_PERLBASE | sed -e "$SEDSCRIPT" )
PKGS_PERL=$( echo $PKGS_PERL | sed -e "$SEDSCRIPT" )
PKGS_MOREDPKG=$( echo $PKGS_MOREDPKG | sed -e "$SEDSCRIPT" )
echo "checking that all needed files are available..."
# sanity check that we can find the packages
ALLPKGS="$PKGS_LIBC6 $PKGS_NCURSES $PKGS_LIBRL $PKGS_LIBRLG $PKGS_BASH \
$PKGS_LIBGPP $PKGS_DPKG $PKGS_LIBGDBM $PKGS_PERLBASE $PKGS_PERL \
for i in $ALLPKGS ; do
echo -n "$(basename $i) "
if [ ! -f $i ] ; then
echo "Can't find $i!"
echo aborting upgrade.
echo "all files found. starting install."
# Now we start the install
# first, build up a list of installed -dev packages so that we can
# remove them. remove wg-15-locale too.
# this is necessary even on machines which aren't doing libc6
# development because libc5 can't be upgraded to latest version without
# removal of libc5-dev which also necessitates removal of other -dev
# packages like libdb1-dev and libdl1-dev if they are installed.
DEVPACKAGES=$( dpkg --get-selections |
grep -v "dpkg-dev\|deinstall" |
cut -f1 |
grep -- "-dev$\|-pic$\|-dbg$" )
echo "removing development packages."
$DPKG --remove -B $DEVPACKAGES wg15-locale libpthread0 || exit 1
# now install the new versions of things. Just the bare minimum to let
# the user safely run dselect for the rest of the upgrade.
echo "installing packages."
$DPKG -iBE $PKGS_LIBC6 || exit 2
# libreadline, ncurses, and bash
$DPKG -iBE $PKGS_NCURSES || exit 3
$DPKG -iBE $PKGS_LIBRL || exit 4
$DPKG -iBE $PKGS_LIBRLG || exit 5
# paranoia says run ldconfig NOW. don't laugh, i've needed to do this on
# some libc5-libc6 upgrades. i know that the postinst scripts for the
# libs are supposed to do it but ....
$DPKG -iBE $PKGS_BASH || exit 6
# new dpkg
$DPKG -iBE $PKGS_LIBGPP || exit 7
$DPKG -iBE $PKGS_DPKG
$DPKG -iBE $PKGS_LIBGDBM || exit 8
# paranoia says "run ldconfig now".
$DPKG -iBE $PKGS_PERLBASE || exit 9
[ -e /usr/lib/perl5/i486-linux/5.003/auto/Mail/.packlist ] && rm -f /usr/lib/perl5/i486-linux/5.003/auto/Mail/.packlist
$DPKG -iBE $PKGS_PERL
# strictly speaking, dpkg-ftp and dpkg-mountable are not essential to
# upgrade right now but they're both very useful.
$DPKG -iBE $PKGS_MOREDPKG
# paranoia says to run this at the end
$DPKG --configure --pending
# paranoia says: "run sync", so lets do it :-)
sync ; sync ; sync
# the user can now run dselect and select any -dev packages they want
# (and other packages too, of course :-)
libc6 is now installed. Now run dselect to upgrade the rest of your
system. When that's done, reboot with "shutdown -r now" for the
utmp/wtmp wrapper functions in the upgraded libc5 to take effect.
BTW, if you aren't using it already, check out dselect's "mountable"
access method. It's much faster than the standard "mounted" method, and
it logs everything that happens in /var/log/dpkg-mountable. You'll want
to set "Allow overwriting repeated files?" to yes, and for extra speed
set "Enable MD5 checksumming?" to no.
If you are installing manually using dpkg, remember that all libc6
(g) libraries conflict with all the versions of their libc5 (non-g)
counterparts prior to a certain version which placed libc5 libs in
/usr/lib/libc5-compat. This means that they conflict with your bo
versions of libc5-linked libraries, but not the hamm versions. For
example, if you are installing xlib6g, you should install xlib6 from
hamm first before installing xlib6g unless you have nothing that depend
on xlib6 in which case you can safelyremove it.
All development packages (-dev, -dbg, and -pic) have been removed
during this upgrade procedure due to conflicts between libc5 and libc6
versions. You will need to re-install any development packages you
Finally, remember to fix up wtmp and utmp, otherwise last and
who and sac etc wont work. here's what Miquel van Smoorenburg
<email@example.com> had to say about this recently in debian-user
> 1. You need to update ALL your packages to hamm
> 2. Reboot if you haven't done that already
> 3. You need to move the wtmp file and truncate the utmp file:
> cd /var/log
> mv wtmp wtmp.libc5
> touch wtmp
> cd /var/run
> cp /dev/null utmp
> 4. You might want to reboot again to make sure
> This is because the "struct utmp" and thus the utmp and wtmp
> "databases" are different between libc5 and libc6
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
Trouble? e-mail to firstname.lastname@example.org .