How to upgrade glibc

Christophe Osuna christophe.osuna at gmail.com
Thu Apr 17 12:30:48 UTC 2008


2008/4/17, Denys Vlasenko <vda.linux at googlemail.com>:
> On Thursday 17 April 2008 12:03, Alessandro Rubini wrote:
>  >
>  > > 3. Tell the kernel not to delete the file when it is overwritten. How?
>  > > By creating a hard link.
>  >
>  > Not really. When you open the file for writing, it gets truncated. Anybody
>  > who is using the file will have problems.
>  >
>  > If you first unlink the file, any user will remain happy (the
>  > filesystem storage is recovered when the file is no more in use, no
>  > need to unlink at next reboot).
>  >
>  > However, after you unlinked a shared library, no dynamic executable
>  > using it can start any more (but the ones running keep happily
>  > running).
>  >
>  > So, right after the unlink(2) you need rename(2). You need them both
>  > in the same executable.
>
>
> unlink is not really needed, rename will succeed even without it:
>

"mv" does succeed and the applications are not annoyed by this change;
the filesystem is, however. See below:

~# cd /lib
/lib# mount -o remount,rw /
/lib# cp libc-2.5.so libc-2.5.so.new
/lib# mv libc-2.5.so.new libc-2.5.so
/lib# mount -o remount,ro /
mount: mounting /dev/hda1 on / failed: Device or resource busy
/lib#

And after rebooting:

Checking root filesystem...
e2fsck 1.40.2 (12-Jul-2007)
/dev/hda1 was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Deleted inode 26549 has zero dtime.  Fix? yes

Deleted inode 44964 has zero dtime.  Fix? yes

Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences:  -(113601--114688) -(114946--115321) -(182785--183392)
Fix? yes

Free blocks count wrong for group #13 (6238, counted=7326).
Fix? yes

Free blocks count wrong for group #14 (5150, counted=5526).
Fix? yes

Free blocks count wrong for group #22 (4872, counted=5480).
Fix? yes

Free blocks count wrong (407568, counted=409640).
Fix? yes

Inode bitmap differences:  -26549 -44964
Fix? yes

Free inodes count wrong for group #13 (1979, counted=1980).
Fix? yes

Free inodes count wrong for group #22 (1956, counted=1957).
Fix? yes

Free inodes count wrong (119071, counted=119073).
Fix? yes


/dev/hda1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/hda1: 1287/120360 files (2.6% non-contiguous), 71144/480784 blocks


Below is an example of the "hard links" solution:

~# cd /lib
/lib# mount -o remount,rw /
/lib# cp libc-2.5.so libc-2.5.so.new
/lib# ln libc-2.5.so libc-2.5.so.old
/lib# mv libc-2.5.so.new libc-2.5.so
/lib# mount -o remount,ro /
/lib#

On the next reboot I have to delete /lib/libc-2.5.so.old

This would probably work. Since I am using RPM packages I intend to do
the hard link in the preinstall-script.

I am a bit confused: how do the Linux distributions handle this? I had
a look at the glibc SRPM from OpenSUSE 10.2 and the only thing related
to this is a call to "telinit u" so that it re-executes itself. But
why that, since /sbin/init is not a dynamic executable? I believe I
would need something similar in busybox but I can't imagine the amount
of work it would be to allow busybox to re-execute itself while
preserving its state.



More information about the busybox mailing list