Bug 26772 - Umstellung von initrd auf initramfs
Umstellung von initrd auf initramfs
Status: RESOLVED WORKSFORME
Product: UCS
Classification: Unclassified
Component: UCS Installer
UCS 3.0
All Linux
: P5 enhancement (vote)
: ---
Assigned To: Philipp Hahn
:
Depends on: 25416
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-12 08:57 CEST by Philipp Hahn
Modified: 2016-11-04 16:10 CET (History)
1 user (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Further conceptual development
Max CVSS v3 score:


Attachments
Run kvm using initramfs (4.20 KB, text/plain)
2012-11-05 20:13 CET, Philipp Hahn
Details
Update UCRV base/univention-nitrd (3.55 KB, patch)
2013-09-19 13:21 CEST, Philipp Hahn
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2012-04-12 08:57:29 CEST
+++ 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.
Comment 1 Philipp Hahn univentionstaff 2012-11-05 20:13:35 CET
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>
Comment 2 Philipp Hahn univentionstaff 2013-03-24 21:08:08 CET
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.
Comment 3 Philipp Hahn univentionstaff 2013-09-19 13:21:55 CEST
Created attachment 5447 [details]
Update UCRV base/univention-nitrd
Comment 4 Philipp Hahn univentionstaff 2013-09-27 15:51:16 CEST
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
Comment 5 Philipp Hahn univentionstaff 2016-11-04 16:10:31 CET
Since UCS-4 we're now using the Debian Installer -> no longer relevant