# [SOLVED] Why is the kernel's initramfs so big?

## uber.grog

Hi all. I've just upgraded my system from an x86 P4 to x86_64 Athlon (see here & here for details). Everything is running great, but I hadn't noticed until upgrading from kernel 2.6.27-r3 to 2.6.27-r4 using genkernel that the initramfs is now 21Mb after the change to x86_64 (/boot ran out of space because I still had a couple of older kernel images). I have no recollection what it was previously, but comparing it with my x86 file server (an x86 PII), the initramfs is only 2.6Mb.

How is this affecting my system, other than my /boot partition running out of space? What do I have to look at to trim this down? Is that possibly where the embedded drivers are & moving them to modules would help?

I'm not sure how to proceed. Thanks in advance for your help.Last edited by uber.grog on Wed Nov 26, 2008 9:26 pm; edited 1 time in total

----------

## NeddySeagoon

uber.grog,

The initrd is thrown away during the boot process and the space is released.

The only effects are the boot time and the size of your /boot partition.

If you roll your own kernel, you don't need an initrd at all, unless you want some boot time eye-candy.

----------

## uber.grog

 *NeddySeagoon wrote:*   

> If you roll your own kernel, you don't need an initrd at all, unless you want some boot time eye-candy.

 

So you're saying that this arch just has more 'boot-candy' then the other? This is the entry from my grub.conf file. If I simply remove the initrd line the system will still boot?

```
#title=Gentoo Linux (2.6.27-gentoo-r4)

root (hd0,0)

kernel /boot/kernel-genkernel-x86_64-2.6.27-gentoo-r4 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/sda3

initrd /initramfs-genkernel-x86_64-2.6.27-gentoo-r4
```

If that's the case, how could I get genkernel NOT to build the initramfs at all?

----------

## NeddySeagoon

uber.grog,

It has a lot more, or bigger junk in the initrd. If you remove the initrd and do nothing else, your system will not boot as the initrf contains the kernel modules needed to mount your real root.

However, if you make your own kernel, with everything needed to boot built in, no initrd is needed.

There are a few userspace tools that can be run very early in the boot sequence then make use of an initrd. Thats things like uvesafb and splashutils, which together give you a graphical boot up.

----------

## uber.grog

 *NeddySeagoon wrote:*   

> uber.grog,
> 
> It has a lot more, or bigger junk in the initrd. If you remove the initrd and do nothing else, your system will not boot as the initrf contains the kernel modules needed to mount your real root.
> 
> However, if you make your own kernel, with everything needed to boot built in, no initrd is needed.
> ...

 

ok, that makes sense. So I guess back to the original question form a different angle, how can I tell exactly what is in the initramfs file? I don't have splashutils installed & I don't know what uvesafb is, unless that's the kernel option FB_UVESA (Userspace VESA VGA graphics support), which I do have enabled for some reason but am sure hasn't been changed since going to x86_64. tx

----------

## NeddySeagoon

uber.grog,

It sounds like you are using Genkernel, in which case, you get lots of stuff in the initrd.

Yep, uvesafb is User Space Framebufer support. It gives you a graphics ability in the console and its userspace part goes in the initrd.

Its not 21 Mb though.

Your first step is to make your own kernel that does not need an initrd.  That guide is old be the principles are still good.

----------

## uber.grog

 *NeddySeagoon wrote:*   

> uber.grog,
> 
> It sounds like you are using Genkernel, in which case, you get lots of stuff in the initrd.
> 
> Yep, uvesafb is User Space Framebufer support. It gives you a graphics ability in the console and its userspace part goes in the initrd.
> ...

 

Thanks for the link. I also found the switch in the genkernel manpage "--no-initrdmodules". I'll play around with that. I assume I could even just do 'genkernel kernel' & not build the initrd at all. I'll try that too.

If I understand correctly, the bottom line is that I shouldn't be concerned, but there are steps I can take shrink or even eliminate the initrd file. I'll do some testing & report back what I find.

Thanks very much for the help Neddy.

----------

## uber.grog

HOLY C**P! In my first test I passed the "--no-initrdmodules" switch to genkernel & used the "kernel" action instead of "all", & the initrd is now only 1/2Mb!

```
$ ll /boot/ini*r4*

-rw-r--r-- 1 root root 569K Nov 27 09:06 /boot/initramfs-genkernel-x86_64-2.6.27-gentoo-r4

-rw-r--r-- 1 root root  21M Nov 25 10:26 /boot/initramfs-genkernel-x86_64-2.6.27-gentoo-r4.old
```

BUT (there's always a "but", isn't there?  :Smile: ), there's an error in the generkenl output:

```
[...snip...]

* initramfs: >> Initializing...

*         >> Appending base_layout cpio data...

*         >> Appending auxilary cpio data...

*         >> Appending busybox cpio data...

* initramfs: Not copying modules...

usr/share/genkernel/gen_funcs.sh: line 427: popd: /var/tmp/genkernel/4875.9066.18648.25607/initramfs-busybox-temp: No such file or directory

*

* Kernel compiled successfully!
```

I haven't tried to boot this kernel yet. Should I be worried?

----------

## uber.grog

 *uber.grog wrote:*   

> 
> 
> ```
> 
> * initramfs: Not copying modules...
> ...

 

I believe this may have to do with bug 186654. This post from 2008-04-23 seems to indicate it still hadn't been fixed in genkernel-3.4.10_pre9 with no followup, so while I'm running genkernel-3.4.10-r2, it seems it still should be open. If someone can confirm that I'm on the right track I'll post my info to the bug.

Anyway, if this is just a false error I can get back on track. It seems I'm loading A LOT of modules into my initrd. Which to me would indicate I'm building A LOT of modules. I guess need to delve into my settings & see what I can get rid of.

TX

----------

