Univention Bugzilla – Bug 26772
Umstellung von initrd auf initramfs
Last modified: 2016-11-04 16:10:31 CET
+++ This bug was initially created as a clone of Bug #25416 comment 2 +++ Da der Fehler einer zu kleinen RAMDISK regelmäßig auftritt (gefühlt jede UCS-Release) sollte hier IMHO langfristig darüber nachgedacht werden, wo nicht auf InitRamFS-Umgestellt wird. Der kleine aber feine Unterschied ist folgender: - Die InitRamDisk (initrd) hat einen fest reservierten Speicherbereich, der dem Kernel mitgegeben werden muß. Dadurch ist die Größe fix. Außerdem enthält sie ein normales ext[234]-Dateisystem, dessen Daten nochmals im BufferCache zwischengespeichert werden, wie dies auch bei einem ext[234]-Dateisystem auf einer Festplatte der Fall wäre. <http://de.wikipedia.org/wiki/Initrd> - Ein InitRamFileSystem (initramfs) dagegen ist ein tmpfs, das direkt den im BufferCache lebt und damit die Daten nicht im RAM verdoppelt. Außerdem kann ein TempFs dynamisch bis zur maximalen Haupspeichergröße wachsen (sofern man das nicht künstlich einschränkt). Statt einer ext[234]-Datei wird ein cpio-Archiv verwendet, das wie die initrd auch per gzip/bzip/lzma/xz komprimiert sein kann. <http://de.wikipedia.org/wiki/Initramfs> Beide Formate können über das "initrd"-Keyword in der grub.cfg bzw. pxe-Konfiguration übergeben werden, der Kernel erkennt automatisch, ob es ein (komprimiertes) cpio-Archiv ist oder ein anderes Dateisystem für die initrd.
Created attachment 4772 [details] Run kvm using initramfs Die Umstellung ist einfach: 1. Statt vorher ein extX-Dateisystem anzulegen und darin den Installer zu installieren, installiet man einfach alles in einem temporären Verzeichnis. 2. Symlink "/init ? bin/busybox" anlegen, weil /init statt bin/init ausgeführt wird. 3. Das ganze per "find -print0 | cpio -o -null --format=newc | gzip -9 > initramfs.cpio.gz" packen. Ein Test mit KVM war efolgreich, allerdings steht Bug #24564 einem vollautomatischen Test im Weg. Das Verwenden von InitRamFs hat zudem den Vorteil, daß mehere Archive verwendet werden können, die sich ergänzen (d.h. der Reihe nach ggf. überschreiben). Wetere Informationen unter <http://en.gentoo-wiki.com/wiki/Initramfs>
Using InitRamFs has another big advantage: Multiple cpio archives can be used to easily extend images: For example adding a 2nd file allows adding the preseed.cfg file or additional hook script to the Debian Installer (Bug #30547). SysLinux and PxeLinux support adding multiple files by separating them with comma: label ucs kernel debian-installer/amd64/linux append auto=true priority=critical vga=788 -- quiet initrd debian-installer/amd64/initrd.gz,preseed.cfg.cpio An also ramdisk_size no longer needs to be specified on the kernel command line, since the initramfs lives in buffercache and initially can use all memory.
Created attachment 5447 [details] Update UCRV base/univention-nitrd
This switch-over would also help fixing bugs in or customizing the UCS installer, for example ticket #2013090221002951. FYI: The CPIO archive must be (only) gzip compressed; all other compression methods don't work, so no "bzip2", "xz", "lzma", "compress", plain and I only got [ 0.400944] Trying to unpack rootfs image as initramfs... [ 2.463699] rootfs image is not initramfs (junk in compressed archive); looks like an initrd Setting up a serial console to debug such issues helps, since the kernel doesn't find a root file system otherwise and aborts with an OOPS, which is not shown in the graphical vga=788 console. Setting up a serial kernel console on the other side breaks the installer, which only knows about /lib/terminfo/l/linux and not about vt102, which is the default for the serial console. Since vt102 is monochrome, Python fails to initialize the color pairs for /lib/univention-installer/main.py +570
Since UCS-4 we're now using the Debian Installer -> no longer relevant