[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Size of initrd



On Sun 22 Nov 2020 at 23:46:54 (-0500), Stefan Monnier wrote:
> >> I have two machines with very similar setups: both running Debian i386
> >> testing, they actually come from the same install done years ago
> >> and were cloned at some point in time.
> >> 
> >> One of the has /boot/initrd.img files that take about 15MB while the
> >> other has /boot/initrd.img files that take about 30MB (in both cases,
> >> they are compressed with `lzma`).
> >> 
> >> Any idea what this difference could come from (or how I could try and
> >> track it down) and how I could fix the size to be more like 15MB?
> >
> > The initramfs is a compressed cpio archive (of the initial file
> > system at boot time).
> 
> Duh!  Indeed, even `file` tells me that.
> It turns out that the bigger one says it's an "ASCII cpio archive",
> whereas the smaller one says it's an LZMA compressed file.
> 
> So apparently the issue is that while I configured "lzma" on both
> machines in /etc/initramfs, one of the two machines maybe doesn't have
> `lzma` installed?
> 
> > You can inspect it like so:
> >
> >   gunzip < /boot/initrd.img-4.19.0-10-amd64 | cpio -it | less
> 
> The "smaller" archive (the one that got compressed) gives me the kind of
> listing I expected (except I see a lot of X11-related crap in there, it
> looks like some kind of "boot splash screen" code got in there even
> I thought I had all that disabled),
> but oddly the "bigger" archive gives me a much smaller list:
> 
>     % cpio -vt < yuca-initrd.img-5.9.0-2-686-pae  
>     drwxr-xr-x   2 root     root            0 Aug 20 08:00 kernel
>     drwxr-xr-x   2 root     root            0 Aug 20 08:00 kernel/x86
>     drwxr-xr-x   2 root     root            0 Aug 20 08:00 kernel/x86/microcode
>     drwxr-xr-x   2 root     root            0 Aug 20 08:00 kernel/x86/microcode/.enuineIntel.align.0123456789abc
>     -rw-r--r--   1 root     root      3692544 Aug 20 08:00 kernel/x86/microcode/GenuineIntel.bin
>     7214 blocs
>     % l yuca-initrd.img-5.9.0-2-686-pae
>     -rw-r--r-- 1 monnier users 24421797 nov 21 14:51 yuca-initrd.img-5.9.0-2-686-pae
>     %
> 
> How come the archive weighs in at 24MB when it doesn't even contain 4MB
> of data?

Use unmkinitramfs. It appears you've only looked at the first archive,
the early one, which gets the kernel into shape. The second, main one
is the big one.

Cheers,
David.


Reply to: