Bug 169412

Summary: initrd images are frighteningly large
Product: [Fedora] Fedora Reporter: Andy Ross <andy>
Component: mkinitrdAssignee: Peter Jones <pjones>
Status: CLOSED INSUFFICIENT_DATA QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 4Keywords: FutureFeature
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-02-23 06:30:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andy Ross 2005-09-27 23:13:25 UTC
The FC4 initrd image inclues these four very large, statically linked
binaries (sizes from the current x86_64 distribution).  They make up
the bulk of the space in the image; the kernel modules are actually a
fairly small fraction:

  -rwxr-xr-x  1 andy andy 502872 Sep 27 15:47 ./bin/insmod
  -rwxr-xr-x  1 andy andy 539352 Sep 27 15:47 ./bin/nash
  -rwxr-xr-x  1 andy andy 662640 Sep 27 15:47 ./bin/udev
  -rwxr-xr-x  1 andy andy 662672 Sep 27 15:47 ./bin/udevstart

The dynamically linked counterparts are not nearly so big:
  
  -rwxr-xr-x  1 root root 9888 Jul 22 14:06 /sbin/insmod
  -rwxr-xr-x  1 root root 59008 May 20 20:45 /sbin/udev
  -rwxr-xr-x  1 root root 59008 May 20 20:45 /sbin/udevstart

I even built a dyamic nash just for completeness:

  -rwxrwxr-x  1 andy andy 40928 Sep 27 13:11 ./mkinitrd-4.2.15/nash

And just for arguments sake, note that the total waste here is
actually more than the entire C library:
  
  -rwxr-xr-x  1 root root 1544248 Aug 15 07:15 /lib64/libc-2.3.5.so

Now this is mostly an aesthetic argument, but this just seems
ridiculous to me given the really minimal work that needs to happen in
the initrd.  The extra I/O involved at least has the potential to be a
performance problem.  I tried timing the difference (with a stopwatch)
between the default initrd and a custom kernel without one (the time
between launch from grub and the start of the real init) and got about
1.2 seconds, but that could be inside the noise.

How hard would it be to write up a tiny libc for these to link
statically against rather than pulling in huge chunks of glibc?

Or just include a glibc/newlib image and runtime linker?

Or, as a fancy and (IMHO) elegant hack: have mkinitrd generate not a
script for nash, but an actual C program with no libc dependence that
can be built and installed as the "/init" binary in the image.  The
commands accepted by nash and the (*really* minimal) udev
functionality implemented by the current initrd should be replaceable
more or less 1:1 with equivalent C code...

Comment 1 Andy Ross 2005-09-28 00:06:14 UTC
Some of this is clearly glibc's fault.  See bug 169414

Comment 2 Andy Ross 2005-09-28 16:44:42 UTC
Jakub in bug 169414 says that static linkage to glibc is not supported, and
recommends dietlibc, uclibc or klibc.

Comment 3 Christian Iseli 2007-01-22 11:52:45 UTC
This report targets the FC3 or FC4 products, which have now been EOL'd.

Could you please check that it still applies to a current Fedora release, and
either update the target product or close it ?

Thanks.

Comment 4 petrosyan 2008-02-23 06:30:55 UTC
Fedora Core 4 is no longer maintained.

Setting status to "INSUFFICIENT_DATA". If you can reproduce this bug in the
current Fedora release, please reopen this bug and assign it to the
corresponding Fedora version.