I'm running Debian Bookworm on a TS412 (QNAP); it stores the kernel & initrd in flash. It has a total of 16MB of flash. So even after tweaking with the MD partitions the best I can get is a 12MB initrd . I'm using xz compression. But even so, the initial initrd was 12.5MB. I know the common fix is to reduce modules, but they are not the real issue.

2984    .../usr/lib/modules
6036    .../usr/share
18824   .../usr/lib/arm-linux-gnueabi

Looking in arm-linux-gnueabi it had stuff like libX11... This machine does not even have a console (even getting a serial line is difficult) it certainly does not need "X".

So I removed lots of packages totally (apt-get remove ...) in fact rather more than I should really. But the result was a much smaller initrd (about 5MB IIRC) which boots and runs just fine.

Problem is, if I ssh onto the box and run say emacs(1) it'd be nice to project the GUI version back to my normal desktop (which has lots of memory and big displays, etc.) but this would require installing the X client libraries on the TS412.

Now I don't see why just because I have the package with the X client libraries installed, that a copy needs to be kept on initrd, they aren't needed during boot. Is there a way to limit other stuff from getting onto initrd, not just modules (which are not the culprit)

I've already tried document searches for guides to limit initrd.

  • 3
    it would seem like a mistake that these were included in the initrd to begin with, indeed. Oct 21, 2023 at 14:35
  • 3
    Instead of ssh -X my-box emacs you can mount part of the box' FS with sshfs and use emacs on your main machine.
    – xhienne
    Oct 21, 2023 at 21:55
  • I can't help but wonder, are you using some kind of weird variant of debian that the initramfs is being used as the real root?
    – Tom Yan
    Oct 22, 2023 at 5:51
  • @TomYan that's not the case. I discovered I also had X11 libraries pulled in one Debian's initramfs but not an other, and checked why, hence my answer. But if something is not on the actually installation (the actual / ) it can't be pulled in initramfs. So when OP removed some key packages, this triggered a rebuild of initramfs (or it was triggered manually), without the extra cruft which didn't exist anymore.
    – A.B
    Oct 22, 2023 at 9:41
  • So "projecting emacs" was just an example where I'd like to install stuff on QNAP (as a convenience) but not have it appear on initrc. I'm sure the initrd is NOT ending up as /(root) because I have a script installed in /etc/initramfs-tools/scripts/local-top/ which chooses root dynamically.
    – GraemeV
    Oct 23, 2023 at 16:23

2 Answers 2


There could be a binary intended to display graphical information during boot that would pull libraries it depends upon in the initramfs file.

One such binary available on most architectures, including armel is the label.so plugin provided by plymouth-label as a plugin for Plymouth in order to have a graphical display with text during boot. This plugin depends on various X11 libraries and is used to render text. When this plugin is added to the initramfs all the libraries it depends upon are also added so it can be used in the boot phase. This is advertised by the package's dependencies: plymouth-label depends on libcairo2 which itself depends on various X11 library packages including libx11-6 providing the library libX11.so.6.

The initramfs hook adding label.so would be /usr/share/initramfs-tools/hooks/plymouth:

PLUGIN_PATH="$(plymouth --get-splash-plugin-path)"

case "${THEME_NAME}" in
      PLUGINS="text.so details.so"
      PLUGINS="text.so details.so label.so"


  if [ -f ${PLUGIN_PATH}/${PLUGIN} ]
      copy_exec ${PLUGIN_PATH}/${PLUGIN}

copy_exec is a shell function (provided by initramfs-tools-core) that will pull the dependencies whenever needed in addition to copying the binary, relying on ldd to discover what's needed.

so it appears it would be pulled only when a non-text setting is used in Plymouth... in order to display text.

As a QNAP's main purpose is not video, having plymouth installed and especially this plugin should be avoided, avoiding X11 libraries to be pulled in the initramfs file.

I fail to see any other cause for this behavior. There could be an other similar package causing this behavior for similar reasons.

  • I missed the "So I removed lots of packages totally". But searching in /var/log/apt/* should still be able to tell if this triggered the removal of plymouth-label.
    – A.B
    Oct 22, 2023 at 5:56
  • $ ls /usr/share/initramfs-tools/hooks dmsetup fuse kmod plymouth thermal flash_kernel_set_root keymap mdadm qcontrol udev fsck klibc-utils ntfs_3g resume zz-busybox So I do have plymouth (which I guess addresses the initial question) . I see I also have ntfs_3g and I have not need any Microsoft formats (certainly not to boot) also mdadm and dmsetup and I boot from simple partitions (I do use RAID, but later)
    – GraemeV
    Oct 23, 2023 at 16:33
  • I guess it would be useful to understand the "general principal" ... Given I find "X" (;- ) ) on initrd, how do I work back to the cause (akin to apt-rdepends) $ apt-rdepends plymouth | wc .... 312 929 7945 BTW does not include sting X11
    – GraemeV
    Oct 23, 2023 at 16:47
  • You already removed plymouth-label by your previous actions. The only place left is the logs. So as I wrote in my first answer's comment, you have to check for the word plymouth-label in /var/log/apt (most logs are compressed by the way: zcat or zgrep...)
    – A.B
    Oct 23, 2023 at 16:56
  • To be clear: installing X11 on the server won't add it in initramfs. Only very special packages meant for running at boot with graphics would do this. The only one I found is plymouth-label. If your package is not related to booting, it won't do it. If your package (related to booting) is not related to display, it won't do it. If it does both, you might consider reading its description and checking its dependencies. plymouth (alone) won't do it either. While it's not written, that's the probable reason plymouth-label was packaged separately. For its cumbersome dependencies.
    – A.B
    Oct 23, 2023 at 17:03

Having followed the logic of @A.B useful reply. I knocked up a quick & dirty pair of scripts to help in following back up the depends tree. (the A.B. answer remains the answer to the specific question)

graeme@qnap412u:/tmp/myinitrd$ xzcat /boot/initrd.img-6.1.0-13-marvell  | cpio -i
34382 blocks

graeme@qnap412u:/tmp/myinitrd$ ~/bin/genxrefs.sh /tmp/myinitrd/  > /tmp/refs
Doing /tmp/myinitrd/usr/lib/klibc-tUxlTFMpGlp_BpS5UnpMpyc8b3g.so
    not a dynamic executable
Doing /tmp/myinitrd/usr/lib/arm-linux-gnueabi/ld-linux.so.3
Doing /tmp/myinitrd/usr/lib/arm-linux-gnueabi/libkmod.so.2.4.0

graeme@qnap412u:/tmp/myinitrd$ ~/bin/whoneeds.awk  libudev /tmp/refs 
libudev.so.1 is used by /tmp/myinitrd/usr/lib/arm-linux-gnueabi/libdevmapper.so.1.02.1

graeme@qnap412u:/tmp/myinitrd$ ~/bin/whoneeds.awk devmapper  /tmp/refs 
graeme@qnap412u:/tmp/myinitrd$ ~/bin/whoneeds.awk libatomic  /tmp/refs 
libatomic.so.1 is used by /tmp/myinitrd/usr/lib/arm-linux-gnueabi/libkmod.so.2.4.0
libatomic.so.1 is used by /tmp/myinitrd/usr/lib/arm-linux-gnueabi/libcrypto.so.3

graeme@qnap412u:/tmp/myinitrd$ cat ~/bin/genxrefs.sh
#! /bin/bash -ue

# This will fail if any names uses spaces or commas (at a pinch, we could use TAB)


objs=$(find ${INITDIR} -type f -name '*.so.*' -o -path '*.so')

# This is going to mess up if anybody uses spaces in pathnames
for obj in ${objs}
    echo "Doing ${obj}" >&2
    ldd ${obj} | while read line
    requires=${line%% =>*}
    requires=${requires%% *} # 1st word
    requires=$(basename ${requires})

    # Ugly , we use commas because, for example quoted strings are too hard in awk(1)
    echo "${obj},${requires},${provided}"
graeme@qnap412u:/tmp/myinitrd$ cat ~/bin/whoneeds.awk
#! /usr/bin/awk -f
    # NB this version of awk does not appear to understand FPAT


{ if ( index($2, STRING) > 0 )
    print $2 " is used by " $1 }
  • On my original initrd: graeme@qnap412u:/tmp/myinitrd$ ~/bin/whoneeds.awk X11 /tmp/refs libX11.so.6 is used by /home/graeme/initrd1/usr/lib/arm-linux-gnueabi/libcairo.so.2.11600.0 libX11.so.6 is used by /home/graeme/initrd1/usr/lib/arm-linux-gnueabi/libXext.so.6.4.0 libX11.so.6 is used by /home/graeme/initrd1/usr/lib/arm-linux-gnueabi/libpangocairo-1.0.so.0.4600.2 libX11.so.6 is used by /home/graeme/initrd1/usr/lib/arm-linux-gnueabi/libXrender.so.1.3.0 libX11.so.6 is used by /home/graeme/initrd1/usr/lib/arm-linux-gnueabi/plymouth/label.so
    – GraemeV
    Oct 24, 2023 at 1:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .