How to upgrade glibc

Christophe Osuna christophe.osuna at gmail.com
Wed Apr 16 14:34:13 UTC 2008


I am facing a problem that some of you have probably encountered; I
hope you can provide me with some advice.

I am unsuccessfully trying to upgrade the glibc on my busybox system
with the following steps:

  1. remount / rw

Here everything is fine.

  2. copy new files

Using the "cp" command crashes the system (the system will not respond
to key presses and the library file is corrupted).

# WARNING ! THIS WILL PROBABLY CRASH YOUR COMPUTER
$ cp /lib/libc-2.5.so /tmp/libc-2.5.so.new
$ cp /tmp/libc.so.new /lib/libc-2.5.so

I have managed to install the file by installing a home-made RPM
package with the "new" file (in fact same as the old one); it also
works with a .tar archive.

  3. remount / ro

Things in step 2 didn't go so well even though they looked successful,
for mount will not remount / ro because of a "device or resource
busy".

  4. reboot

As the root filesystem could not be remounted read-only fsck complains
and finds problems.

Below is the output of the "lsof" command before and after a glibc
upgrade. It shows that the init process (busybox) is using glibc files
and references files by their inode number after the upgrade.

~# /tmp/lsof|head
COMMAND    PID USER   FD      TYPE DEVICE    SIZE  NODE NAME
init         1 root  cwd       DIR    3,1    1024     2 /
init         1 root  rtd       DIR    3,1    1024     2 /
init         1 root  txt       REG    3,1  618184 73446 /bin/busybox
init         1 root  mem       REG    0,0             0 [heap] (stat:
No such file or directory)
init         1 root  mem       REG    3,1 1491141 20429 /lib/libc-2.5.so
init         1 root  mem       REG    3,1  190963 20427 /lib/libm-2.5.so
init         1 root  mem       REG    3,1   47607 20436 /lib/libcrypt-2.5.so
init         1 root  mem       REG    3,1  129767 20432 /lib/ld-2.5.so
init         1 root    0u      CHR    5,1           219 /dev/console (deleted)
~# mount -o remount,rw /
~# rpm -ivh /tmp/glibc-2.5-1.i586.rpm
Preparing...                ########################################### [100%]
   1:glibc                  ########################################### [100%]
~# mount -o remount,ro /
mount: mounting /dev/hda1 on / failed: Device or resource busy
~# /tmp/lsof|head
COMMAND    PID USER   FD      TYPE DEVICE    SIZE   NODE NAME
init         1 root  cwd       DIR    3,1    1024      2 /
init         1 root  rtd       DIR    3,1    1024      2 /
init         1 root  txt       REG    3,1  618184  73446 /bin/busybox
init         1 root  mem       REG    0,0              0 [heap] (stat:
No such file or director)
init         1 root  mem       REG    3,1          20429
/lib/libc-2.5.so (path inode=20462)
init         1 root  mem       REG    3,1          20427
/lib/libm-2.5.so (path inode=116283)
init         1 root  mem       REG    3,1          20436
/lib/libcrypt-2.5.so (path inode=11628)
init         1 root  mem       REG    3,1          20432
/lib/ld-2.5.so (path inode=20461)
init         1 root    0u      CHR    5,1            219 /dev/console (deleted)

Well, this makes sense but is quite annoying: does that mean that I
cannot upgrade the glibc in a dynamically-linked busybox?

I have two solutions in mind but I would greatly appreciate others:

  1. Use a static link. This means that the glibc will be "installed"
twice: in the busybox executable and in the system, I don't like it.
Besides this was discouraged in some busybox versions if I remember
well.

  2. Upgrade from an initramfs. This is annoying because I download
updates from the network, which means that the network would have to
be configured (DHCP...) in the initramfs and also in the system.

Busybox version is 1.8.2 and glibc is a copy of OpenSUSE 10.2 files,
but I think this does not matter here.

Thanks.



More information about the busybox mailing list