Distri: 20x faster initramfs (initrd) from scratch
&quot;I currently have no desire to make minitrd available outside of distri. While the technical challenges (such as extending the generator to not rely on distri&#x27;s hermetic packages) are surmountable, I don&#x27;t want to support people&#x27;s initramfs remotely.<p>Also, I think that people&#x27;s efforts should in general be spent on rallying behind dracut and making it work faster, thereby benefiting all Linux distributions that use dracut (increasingly more).&quot;<p>As described on the website unixsheikh.com recently posted to HN^1 and making the front page^2, I think this illustrates one difference between &quot;Linux&quot; and BSD.  Much of what unixsheikh describes has been said before however I think it still remains true today.  I am currently using Linux and open to being persuaded otherwise.  I want to learn &quot;the Linux way&quot; if there is such a thing.<p>That said, I always found booting to ramdisk, &quot;root on mfs&quot;, &quot;mfsroot&quot;, or whatever people might call it, very straightforward on BSD.  They maintained and provided all the necessary tools, some of them have no Linux equivalent.  Things stayed more or less the same so once the process was learnt, there seemed little chance of the goalposts moving.  One did not need to be a contributor to understand these processes.  Sometimes I get the feeling I am just not smart enough for Linux, and it <i>seems</i> like these processes are constantly subject to change.  (I hope to find the truth is otherwise.)<p>As a BSD end user, I found it relatively easy to compile a custom kernel and a custom, statically-linked, multi-call binary as a userland, like busybox but using utilities &quot;as is&quot; not pared down with features missing, to be inserted into the kernel.  I could boot from USB stick^3 to ramdisk root, pull out the USB stick, e.g., if I needed the USB port, then chroot into any userland.  This was extremely flexible and allowed for easy experimentation.  Sometimes I might have that userland prepared on internal media, the USB stick, or some other external media, or I might create it dynamically by downloading and extracting binary sets.  This &quot;targetroot&quot;^4 userland might be mounted, usually r&#x2F;o, on HDD or it might just be mfs&#x2F;tmpfs.<p>Apparently, the author was inspired to make his own distribution because he found the package installation process too slow for large packages, e.g. qemu.^5  He tried using SquashFS images to speed up the process.  I did the same thing in 2012 using cloop2 compressed filesystem images for large packages, e.g. ghostscript, on NetBSD.  I would keep them on the USB stick and just mount them over an executable directory as necessary.  I was not using these large programs too frequently and I was running entirely from tmpfs, no HDD, so I did not want them occupying space and depleting RAM.<p>1. <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;from?site=unixsheikh.com" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;from?site=unixsheikh.com</a><p>2. <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;front?day=2020-01-20" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;front?day=2020-01-20</a><p>3. Thanks to the excellent BSD bootloaders I could manually choose the kernel during boot.  I would have several kernels on the USB stick.  Of course the kernel did not have to reside on the USB stick, I could load it from any connected media.  At one point I was able to boot NetBSD kernels using the FreeBSD bootloader.<p>4.  TBH, I still do not know the true story behind targetroot.  Things in BSD always have a history behind them.  Surely there is a story behind the &quot;targetroot&quot; directory.<p>5  <a href="https:&#x2F;&#x2F;michael.stapelberg.ch&#x2F;posts&#x2F;2019-08-17-linux-package-managers-are-slow&#x2F;" rel="nofollow">https:&#x2F;&#x2F;michael.stapelberg.ch&#x2F;posts&#x2F;2019-08-17-linux-package...</a><p>&quot;How can minitrd be 20 times faster than dracut?<p>dracut is mainly written in shell, with a C helper program. It drives the generation process by spawning lots of external dependencies (e.g. ldd or the dracut-install helper program). I assume that the combination of using an interpreted language (shell) that spawns lots of processes and precludes a concurrent architecture is to blame for the poor performance.&quot;<p>Interesting that dracut uses bash, not dash for its scripts.   Would dash be any faster.  Are bash features a necessity for the simple tasks dracut performs.<p>Also, could dracut use readelf instead of the bash shell script ldd.  According to Wikipedia, the Linux man page for ldd asserts it is a security risk.<p>Does default Ubuntu include a manpage for ldd.  Mine is missing.