FedoraThis forum is for the discussion of the Fedora Project.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Even since before the system-upgrade from F34, it's been generating huge initramfs files, nearly 50M for the latest installed kernel-core and kernel-modules, as much as 5 times the size of those on Mageia, openSUSE and Debian. Did I miss some new method of configuring initramfs files during the last Fedora release or three?
Other major distros still have simple config options to limit initrd modules to those required by the hardware on which installed. What follows are all from one multiboot PC with most recent versions of Debian, Fedora, Mageia, openSUSE & Ubuntu:
Code:
-rw------- 1 4891630 Jan 3 2018 deb09/boot/initrd.img-4.9.0-4-amd64
-rw------- 1 4896357 Jul 14 2018 deb09/boot/initrd.img-4.9.0-6-amd64
-rw------- 1 4899382 Jul 8 2019 deb09/boot/initrd.img-4.9.0-8-amd64
-rw------- 1 4902282 Nov 14 2019 deb09/boot/initrd.img-4.9.0-9-amd64
-rw------- 1 4902341 Nov 14 2019 deb09/boot/initrd.img-4.9.0-11-amd64
-rw------- 1 4904281 Nov 1 2020 deb09/boot/initrd.img-4.9.0-12-amd64
-rw------- 1 4905303 Nov 1 2020 deb09/boot/initrd.img-4.9.0-14-amd64
-rw------- 1 5868686 Jan 18 2019 deb10/boot/initrd.img-4.19.0-1-amd64
-rw------- 1 6672744 Jul 30 2019 mga6/boot/initrd-4.14.131-desktop-1.mga6.img
-rw------- 1 6673440 Apr 29 2018 mga6/boot/initrd-4.14.30-desktop-3.mga6.img
-rw------- 1 6678266 Mar 17 2019 mga6/boot/initrd-4.14.104-desktop-2.mga6.img
-rw------- 1 6720795 Sep 14 2018 mga6/boot/initrd-4.14.69-desktop-1.mga6.img
-rw------- 1 7077571 Nov 2 2020 deb11/boot/initrd.img-5.9.0-1-amd64
-rw------- 1 7179247 Feb 3 2021 deb11/boot/initrd.img-5.10.0-2-amd64
-rw------- 1 7197306 Aug 18 02:36 deb11/boot/initrd.img-5.10.0-5-amd64
-rw------- 1 7201143 Nov 28 03:12 deb11/boot/initrd.img-5.10.0-8-amd64
-rw------- 1 7202517 Nov 28 03:12 deb11/boot/initrd.img-5.10.0-9-amd64
-rw------- 1 7277408 Dec 2 2018 s423/boot/initrd-4.4.162-78-default
-rw------- 1 7278120 Jan 18 2019 s423/boot/initrd-4.4.165-81-default
-rw------- 1 7280000 Jul 14 2018 s423/boot/initrd-4.4.138-59-default
-rw------- 1 7282436 Mar 11 2019 s423/boot/initrd-4.4.175-89-default
-rw------- 1 7283248 Sep 12 2018 s423/boot/initrd-4.4.143-65-default
-rw------- 1 7318600 May 25 2019 s423/boot/initrd-4.4.179-99-default
-rw------- 1 7459008 Mar 11 2019 deb10/boot/initrd.img-4.19.0-2-amd64
-rw------- 1 7537719 May 15 2019 deb10/boot/initrd.img-4.19.0-4-amd64
-rw------- 1 7540430 Oct 16 2019 deb10/boot/initrd.img-4.19.0-5-amd64
-rw------- 1 7547150 Feb 4 2020 deb10/boot/initrd.img-4.19.0-6-amd64
-rw------- 1 7548672 Nov 1 2020 deb10/boot/initrd.img-4.19.0-11-amd64
-rw------- 1 7549951 Mar 29 2021 deb10/boot/initrd.img-4.19.0-16-amd64
-rw------- 1 7549954 Nov 1 2020 deb10/boot/initrd.img-4.19.0-9-amd64
-rw------- 1 7550571 Jan 9 2021 deb10/boot/initrd.img-4.19.0-12-amd64
-rw------- 1 7551747 Nov 1 2020 deb11/boot/initrd.img-4.19.0-12-amd64
-rw------- 1 7551896 Jul 4 2019 s423/boot/initrd-4.4.180-102-default
-rw------- 1 7552347 Jan 9 2021 deb10/boot/initrd.img-4.19.0-13-amd64
-rw------- 1 7552376 Aug 18 01:14 deb10/boot/initrd.img-4.19.0-17-amd64
-rw------- 1 7558756 Nov 28 01:18 deb10/boot/initrd.img-4.19.0-18-amd64
-rw------- 1 7740691 Mar 15 2018 mga6/boot/initrd-4.14.20-desktop-1.mga6.img
-rw------- 1 7782684 Nov 1 2020 ub18/boot/initrd.img-4.15.0-106-generic
-rw------- 1 7784025 Jan 29 2021 ub18/boot/initrd.img-4.15.0-122-generic
-rw------- 1 7784030 Jan 29 2021 ub18/boot/initrd.img-4.15.0-135-generic
-rw------- 1 7917913 Jan 29 2021 ub20/boot/initrd.img-4.15.0-106-generic
-rw------- 1 7976747 Jan 29 2021 ub20/boot/initrd.img-5.4.0-52-generic
-rw------- 1 7976836 Jan 29 2021 ub20/boot/initrd.img-5.4.0-37-generic
-rw------- 1 7976891 Jan 29 2021 ub20/boot/initrd.img-5.4.0-65-generic
-rw------- 1 8799244 Jul 29 2019 s151/boot/initrd-4.12.14-lp151.28.10-default
-rw------- 1 8800588 Jun 21 2019 s151/boot/initrd-4.12.14-lp151.28.7-default
-rw------- 1 8802076 Feb 3 2020 s151/boot/initrd-4.12.14-lp151.28.36-default
-rw------- 1 8847700 Oct 14 2019 s151/boot/initrd-4.12.14-lp151.28.20-default
-rw------- 1 8850848 Jun 21 2020 s151/boot/initrd-4.12.14-lp151.28.52-default
-rw------- 1 8858080 Nov 2 2020 s151/boot/initrd-4.12.14-lp151.28.75-default
-rw------- 1 8858640 Jan 5 2021 s151/boot/initrd-4.12.14-lp151.28.67-default
-rw------- 1 8867356 Feb 12 2021 s151/boot/initrd-4.12.14-lp151.28.91-default
-rw------- 1 9103836 Mar 1 2020 boot/boot/initrd-5.3.18-lp152.4-default
-rw------- 1 9142384 Jun 21 2020 s152/boot/initrd-5.3.18-lp152.19-default
-rw------- 1 9148540 Jan 5 2021 s152/boot/initrd-5.3.18-lp152.41-default
-rw------- 1 9157920 Feb 12 2021 s152/boot/initrd-5.3.18-lp152.63-default
-rw------- 1 9170992 May 20 2021 s152/boot/initrd-5.3.18-lp152.75-default
-rw------- 1 9175444 Aug 18 16:27 s152/boot/initrd-5.3.18-lp152.87-default
-rw------- 1 10800864 Feb 3 2020 stw/boot/initrd-5.3.12-2-default
-rw------- 1 10832188 Feb 4 2020 stw/boot/initrd-5.4.14-1-default
-rw------- 1 10853061 Apr 21 2019 mga7/boot/initrd-5.0.9-desktop-1.mga7.img
-rw------- 1 10883318 Jul 30 2019 mga7/boot/initrd-5.1.18-desktop-1.mga7.img
-rw------- 1 10908572 Mar 6 2020 boot/boot/initrd-5.5.7-1-default
-rw------- 1 10990545 Feb 4 2020 mga7/boot/initrd-5.3.13-desktop-2.mga7.img
-rw------- 1 11021091 Nov 1 2020 mga7/boot/initrd-5.7.19-desktop-3.mga7.img
-rw------- 1 11032825 Jun 20 2020 mga7/boot/initrd-5.4.17-desktop-1.mga7.img
-rw------- 1 11044008 Jun 20 2020 mga7/boot/initrd-5.5.15-desktop-3.mga7.img
-rw------- 1 11044050 Jun 20 2020 mga7/boot/initrd-5.6.14-desktop-2.mga7.img
-rw------- 1 11075470 Mar 28 2021 mga7/boot/initrd-5.10.25-desktop-1.mga7.img
-rw------- 1 11562808 Jun 21 2020 stw/boot/initrd-5.5.13-1-default
-rw------- 1 11607724 Jun 21 2020 stw/boot/initrd-5.6.14-1-default
-rw------- 1 11664520 Aug 20 01:47 s153/boot/initrd-5.3.18-59.19-default
-rw------- 1 11947840 Jun 21 2020 mga8/boot/initrd-5.6.14-desktop-2.mga7.img
-rw------- 1 12012735 Nov 1 2020 mga8/boot/initrd-5.7.12-desktop-1.mga8.img
-rw------- 1 12037227 Nov 1 2020 mga8/boot/initrd-5.8.13-desktop-1.mga8.img
-rw------- 1 12045820 Nov 1 2020 mga8/boot/initrd-5.9.3-desktop-1.mga8.img
-rw------- 1 12300456 Oct 19 02:48 s153/boot/initrd-5.3.18-59.27-default
-rw------- 1 12518893 Mar 28 2021 mga8/boot/initrd-5.10.25-desktop-1.mga8.img
-rw------- 1 13982640 Oct 17 2020 stw/boot/initrd-5.7.11-1-default
-rw------- 1 14297136 Jan 6 2021 stw/boot/initrd-5.9.14-1-default
-rw------- 1 14323212 Jan 6 2021 stw/boot/initrd-5.8.15-1-default
-rw------- 1 14903320 Aug 18 22:40 stw/boot/initrd-5.12.13-1-default
-rw------- 1 14948098 Nov 27 03:05 stw/boot/initrd-5.14.14-3-default
-rw------- 1 14997416 Mar 18 2021 stw/boot/initrd-5.10.16-1-default
-rw------- 1 15051994 Nov 27 02:51 stw/boot/initrd-5.13.12-1-default
-rw------- 1 15319588 Jun 13 02:45 stw/boot/initrd-5.11.16-1-default
-rw------- 1 17672286 Jan 3 2018 deb08/boot/initrd.img-4.8.0-0.bpo.2-amd64
-rw------- 1 18028936 Jan 3 2018 deb08/boot/initrd.img-4.9.0-0.bpo.4-amd64
-rw------- 1 19293507 Feb 11 2021 f34/boot/initramfs-5.10.14-200.fc33.x86_64.img
-rw------- 1 19946363 Nov 29 2020 f33/boot/initramfs-5.8.18-300.fc33.x86_64.img
-rw------- 1 20034174 Jan 28 2021 f33/boot/initramfs-5.9.16-200.fc33.x86_64.img
-rw------- 1 20195276 Aug 18 11:15 f34/boot/initramfs-5.11.19-300.fc34.x86_64.img
-rw------- 1 20270226 Aug 18 07:35 f33/boot/initramfs-5.10.23-200.fc33.x86_64.img
-rw------- 1 21237225 Jun 21 2020 deb08/boot/initrd.img-4.9.0-0.bpo.6-amd64
-rw------- 1 50025276 Aug 18 11:35 f34/boot/initramfs-5.12.14-300.fc34.x86_64.img
-rw------- 1 50363865 Aug 18 07:46 f33/boot/initramfs-5.11.19-200.fc33.x86_64.img
-rw------- 1 50374741 Aug 18 07:51 f33/boot/initramfs-5.12.14-200.fc33.x86_64.img
-rw------- 1 50795425 Nov 29 02:34 f34/boot/initramfs-5.13.15-200.fc34.x86_64.img
-rw------- 1 51022337 Nov 29 02:25 f35/boot/initramfs-5.14.18-300.fc35.x86_64.img
-rw------- 1 51207057 Nov 29 02:55 f34/boot/initramfs-5.14.18-200.fc34.x86_64.img
Do you have any compression options set? I'd say the initramfs image isn't being compressed. You need to tell dracut to do it, IIRC it won't on its own.
-rw------- 1 51207057 Nov 29 02:55 f34/boot/initramfs-5.14.18-200.fc34.x86_64.img
lsinitrd output for that image is here. It contains 2855 lines. Is there anything in it that indicates what or whether any compression was used to construct it?
I'm not aware of any available options to set for the automatic generation of these files when each new kernel is installed, if not from /etc/dracut.conf.d/d*.conf or /etc/dracut.conf. It used to be that hostonly="yes" was enough to keep them down to a more sane size. Where might compression have been disabled, or an over-bloated module set included? I certainly don't need that nls stuff, but what else represents excess?
I found the bigger part of the problem. A several releases back, dracut started complaining about lack of whitespace in /etc/dracut.conf.d/*conf. So, I made sure each uncommented line had whitespace adjacent to each quote mark. Including changing hostonly="yes" to hostonly=" yes " was the mistake. Now that the whitespace is gone, new images are down about 60%. Still, 20,000K is significantly bigger than those of the other distros that I use. And, the line count change was low, down from 2855 for 5.14.18 to 2842 for 5.16.12.
Except for Slackware's, which didn't exist when OP was composed, all file initrd outputs below are from initrds in OP.
Code:
# file initramfs-5.14.18-200.fc34.x86_64.img # Fedora 34 51207057
initramfs-5.14.18-200.fc34.x86_64.img: ASCII cpio archive (SVR4 with no CRC)
# file initrd-5.14.14-3-default # Tumbleweed 14948098
initrd-5.14.14-3-default: ASCII cpio archive (SVR4 with no CRC)
# file initrd-5.10.25-desktop-1.mga8.img # Mageia 8 12518893
initrd-5.10.25-desktop-1.mga8.img: gzip compressed data, max compression, from Unix, original size modulo 2^32 27212288
# file initrd.img-5.10.0-9-amd64 # Debian 11 7202517
initrd.img-5.10.0-9-amd64: gzip compressed data, was "mkinitramfs-MAIN_G0Zety", last modified: Sun Nov 28 08:12:49 2021, from Unix, original size modulo 2^32 18009088
# file initrd.5.15.19.gz # Slackware 15.0 8982448
initrd.5.15.19.gz: gzip compressed data, max compression, from Unix, original size modulo 2^32 26684928
So, the question apparently becomes, is compression absent on Fedora installations by default, or are mine deviants?
I did find that dracut can be configured to compress. I tried with and without xz compression on an F35 installation with kernel 5.16.12. The compressed version was only 19% smaller, at 16608652 bytes. It looks like its kitchen sink could use some trimming.
Look in /boot/initrd-tree/your-kernel-version to see what's in it.
I dug once and found modules for all sorts of exotic filesystems, bluetooth, etc. while I have a very boring PC. There is busybox and a miniature OS in there, which is mounted on / before your root drive. The only module I need is ext4, but they probably have basic usb also.
Kitchen sink, garage sink & laundry room sink. Sometime when I get ambitious I'll have to make a dracut.conf.d file that lists only components needed to get through switchroot.
lsinitrd output for that image is here. It contains 2855 lines. Is there anything in it that indicates what or whether any compression was used to construct it?
man 5 dracut.conf:
Code:
compress="{cat|bzip2|lzma|xz|gzip|lzo|lz4|zstd|<compressor [args ...]>}"
Compress the generated initramfs using the passed compression program.
If you pass it just the name of a compression program, it will call
that program with known-working arguments. If you pass arguments, it
will be called with exactly those arguments. Depending on what you
pass, this may result in an initramfs that the kernel cannot
decompress. To disable compression, use "cat".
If that's not in any of your dracut.d conf files (or dracut.conf), you're not compressing the initrd.
Quote:
initramfs-5.14.18-200.fc34.x86_64.img: ASCII cpio archive (SVR4 with no CRC)
That does not look like a compressed initrd. If you look at the other initrds you specified, file tells you they're compressed, and tells you this one isn't.
If that's not in any of your dracut.d conf files (or dracut.conf), you're not compressing the initrd.
I have my doubts that is, or was, necessarily so. .conf files in /etc/ are not infrequently overrides of upstream's or a packager's configuration hiding somewhere in /usr/, including within a binary or other file whose name may not end with ".conf", that any /etc/ files become mere overrides to. Judging by the initramfs file size history I've seen, it may be that there was a configuration somewhere outside /etc/ that has since been changed or ceased to exist, since I've seen no compress= changes or presence in /etc/dracut.con* before putting it there after this thread's OP.
I still have some Fedora installations older than 33 I can explore for more size history as time permits....
I have my doubts that is, or was, necessarily so. .conf files in /etc/ are not infrequently overrides of upstream's or a packager's configuration hiding somewhere in /usr/, including within a binary or other file whose name may not end with ".conf", that any /etc/ files become mere overrides to. Judging by the initramfs file size history I've seen, it may be that there was a configuration somewhere outside /etc/ that has since been changed or ceased to exist, since I've seen no compress= changes or presence in /etc/dracut.con* before putting it there after this thread's OP.
Have you checked the distribution dracut.conf.d files? I don't have an fc34 box, but I can tell you looking at all of my fc35 boxes, there's no compresion enabled by default, whereas Tumblweed uses zstd by default. You said yourself, you enabled compression and got a significantly smaller file, so obviously you need to start with that permanent change.
You're comparing distributions... so if you want a smaller init use one of those other config files if on the same box. Not the same box, not the same included/excluded modules, and you're not making a fair comparison (you already indicated via post 1 you're deviating from defaults - and yes I hate the way dracut requires you to handle whitespace in its config files in an ugly way).
However, I can give you a possible hint looking at my TW and fc35 (I don't have an fc34) boxes... other than lack of compression your problem may be vi, ps, and grep on fedora. I can not speak for how long they have been included by default as I have no older fc boxes, so I can't answer your original question, but certainly explains the difference between distros.
Usually you have a whole pile of uneccessary modules in there for every conceivable filesystem and interface. Fix that if you can. Mind you, a big initrd is only a niusance if your /boot is too small..
Usually you have a whole pile of uneccessary modules in there for every conceivable filesystem and interface. Fix that if you can. Mind you, a big initrd is only a niusance if your /boot is too small..
Yeah, I had included that in my original post, but deleted it. The difference of 200K, I wouldn't go nuts myself.
My fedora initrd is 38M uncompressed, Tumbleweed is 30M compressed. Fedora boots noticeably faster.
Maybe OP has a small /boot. I only needed to learn that lesson (and headache) once when I made a 250M /boot years ago - although space was more valuable then.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.