No, really: The initrd is too big

A while back I remember seeing news around the ‘net about Linus Torvalds voicing concern over the growing size of the kernel. Things like that are usually non-issues for me and I think they are for most end-users, but it’s the first thing I thought of when I put Ubuntu onto a 2Gb 4200rpm drive and dropped it into a Pentium with 32Mb of memory in it.

For the longest time now, my mental limbo-pole for Ubuntu on any computer has been 32Mb: Without 32Mb in the machine, the installer program twitched and flailed uncontrollably until you finally took it off life support and cut the power. You could, conceivably run Ubuntu on a machine with less memory than that, although dipping much lower — even by just 8Mb or so — left you in dangerous territory.

Or so I thought. I was pleased to find the random 16Mb stick of PC66 at the bottom of a box in my local recycling shop last week, and after a 12-hour marathon of memtest, it’s showing no defects whatsoever. But the aforementioned 2Gb hard drive with a clean installation of Ubuntu on it refused to start all the same. “The initrd is too big,” it said, quite politely.

I see elsewhere on the Internet where BIOS settings can come into play, but this time it might be that the initrd is just too big. How big can it be? I thought, and transplanted the drive (again … swapping drives is the story of my life) in an effort to find out. And the answer was 40Mb.

Good grief. I must be looking at that wrong. Discrepancies like that can only be explained as some mistake of mine. In any case, the error message was telling the truth. That is too big.

Now the size of a stock Linux kernel and the size of the initrd in a vanilla installation of Ubuntu 9.10 are not necessarily related, but I could swear this was never a problem before now. I am more-or-less certain that I have installed minimal Ubuntu systems on computers with only 32Mb of memory — some within the past couple of years — and they started up fine. And Debian runs without complaint on the machine, although I haven’t needed to check the size of the initrd in Debian, so it might be different. (It appears to be less than 8Mb for initrd.img-2.6.32-trunk-486.)

I suppose weight gain is the only excuse. Forty megabytes is considerable when your world is topped off by a 550Mhz Celeron, and no machine has more than 192Mb. But this world never has a need for more than about 24 of those 192Mb at any given time … unless of course, you’re trying to start up Ubuntu.

I’ll have to scrape around a little more and see if there is any way to carve down that 40Mb number, and maybe actually get the system working without having to swap memory chips as well as hard drives. I don’t hold out much hope though … 40Mb might be a stumbling block for a beat-up leftover 166Mhz Thinkpad, but to anyone else who’s not living in 1998, 40Mb here or there is nothing to voice concern over. Unless you are Linus.

17 thoughts on “No, really: The initrd is too big

  1. nflenz

    Why not just remove the initrd from menu.lst? The system should boot fine if the root filesystem uses ext3.

    Reply
  2. ajlec2000

    I believe Ubuntu has been growing from release to release. I don’t think the Ubuntu Community is developing the OS with machines like yours in mind.

    Right now the bare minimum for install is 64M of ram and its not recommended.

    The recommended minimum is 384M and I don’t think that amount can handle the compiz whiz bang desktop.

    Within a couple of years my 512M machines may not be suitable for Ubuntu. (Which is one reason I hang out here looking to learn more about the minimalist approach.)

    Reply
  3. Gusar

    That initrd probably contains modules for as much hardware as possible. Meaning you don’t need 98% of the stuff in there.
    Your best route is to compile a custom kernel which has what you need for that particular machine and only that. If you compile everything statically (no modules), you’ll get an image of around 2.5MB.

    Reply
    1. K.Mandla Post author

      I was hoping someone would check theirs and find a different number. I double- and triple-checked mine, but 40Mb still sounds unnaturally huge. I halfway suspect some sort of error in the installation. …

      Reply
  4. matt

    The initrd is likely that big because it has all modules included (it was made to suit almost any hardware configuration). So it has any possible driver for RAID or crypto libs or different hard disc controllers, etc.

    Arch Linux gets around this by making two initrd images. One with *only* the modules you need based on your hardware and a “fallback” initrd with all the modules. You use the customized initrd for regular use but if it somehow gets misconfigured you can drop back to the fallback to boot and then fix the problem. I’ve never had to use the fallback, though.

    See here: http://wiki.archlinux.org/index.php/Mkinitcpio

    And you actually don’t *need* an initrd unless you are doing something tricky (root crypto, usb boot, raid, etc).

    If you are running on such limited hardware you really should be configuring your own kernel. It would be a night and day difference on such a low powered system.

    Reply
  5. steve

    Indeed. Compiling your own kernel having the filesystem type and appropriate hdd hardware drivers included rather than as modules negates the need for an initrd altogether, as well as speeding up boot times. I’m sure you know this though 😉

    Reply
  6. Morten

    I just had a look and mine (using Linux Mint 8 => Ubuntu 9.10)
    are about 8 MB – and when uncompressed 23 MB
    It seem something strange is going on in your machine.

    Reply
  7. Pingback: Links 4/2/2010: Scientific Linux Reviewed, Google Tablets | Boycott Novell

  8. peekaboo

    If you don’t have gigabytes worth of memory you either fail at putting together hardware or fail at earning money.

    Either way it’s just fail at a level that doesn’t even justify me writing this.

    Or if you’re living in a third world country I can forgive you, but that’s about it.

    Reply
  9. Pingback: Good news or bad news? Still no X « Motho ke motho ka botho

  10. Pingback: Tale of two Ubuntus « Motho ke motho ka botho

  11. Pingback: From 32 to 43 « Motho ke motho ka botho

Leave a reply to nflenz Cancel reply