| Rev | Author | # | Line |
|---|---|---|---|
| 1 | KevinCroft | 1 | How to eliminate the need for initrd in red hat enterprise linux 4 or Centos 4. |
| 2 | |||
| 2 | KevinCroft | 3 | !!! Background |
| 1 | KevinCroft | 4 | |
| 5 | Initrd is normally reserved for modules used to bring up the root filesystem that cannot be linked into the kernel, such as a propriety SCSI or RAID drivers. Once the root filesystem is readable any number of modules can be loaded from disk instead of initrd. | ||
| 6 | |||
| 7 | Red Hat Enterprise Linux uses initrd to create temporary device nodes '''/dev/console''' and '''/dev/null''' on a ram disk which is used to handle console IO when the kernel hands control to init, at which point udev kicks in and creates its own virtual device nodes. | ||
| 8 | |||
| 9 | The trouble is, the console and null devices never exist as real file objects inside the /dev directory, and without them a non-initrd kernel will fail with the dreaded "Warning: no initial console found" message. | ||
| 10 | |||
| 11 | !!! The Solution | ||
| 12 | Create the '''console''' and '''null''' devices as real files inside /dev. | ||
| 13 | |||
| 14 | Boot using the default initrd-based kernel, for me this is: | ||
| 15 | <verbatim> | ||
| 16 | title Centos-4 i386 (2.6.9-11.EL) | ||
| 17 | root (hd0,1) | ||
| 18 | kernel /vmlinuz-2.6.9-11.EL ro root=LABEL=/ rhgb quiet | ||
| 19 | initrd /initrd-2.6.9-11.EL.img | ||
| 20 | </verbatim> | ||
| 21 | |||
| 22 | Log in as root, re-mount your root file-system to a new area (/mnt/root), and copy the console and null device nodes: | ||
| 23 | <verbatim> | ||
| 24 | mkdir -p /mnt/root | ||
| 25 | mount /dev/hda3 /mnt/root | ||
| 26 | cd /dev | ||
| 27 | cp -a console null tty1 tty2 tty3 /mnt/root/dev | ||
| 28 | </verbatim> | ||
| 29 | |||
| 30 | The '''console''', '''null''', and '''tty''' devices are now real files inside the /dev directory and will survive a reboot - unlike the devices created by udev and initrd. | ||
| 31 | |||
| 32 | You can also do this by booting the install CD, mounting your root partition, and creating the device files. | ||
| 33 | |||
| 34 | !!! etc files | ||
| 35 | |||
| 36 | If you created three TTY nodes in the above, edit /etc/inittab to match by removing all but one of the tty's. (the init scripts will launch an additional 2 tty's). | ||
| 37 | |||
| 38 | <verbatim> | ||
| 39 | # Run gettys in standard runlevels | ||
| 40 | 1:2345:respawn:/sbin/mingetty tty1 | ||
| 41 | # - remove the other 5 | ||
| 42 | </verbatim> | ||
| 43 | |||
| 44 | !!! Kernel Settings | ||
| 45 | |||
| 46 | You can now create a lean and mean kernel without ram disk support, initrd, /dev/pts, or /dev. | ||
| 47 | Details: | ||
| 48 | |||
| 49 | !!! Device Drivers/Block Devices | ||
| 50 | <verbatim> | ||
| 51 | < > Normal floppy disk support | ||
| 52 | < > Compaq SMART2 support | ||
| 53 | < > Compaq Smart Array 5xxx support | ||
| 54 | < > Mylex DAC960/DAC1100 PCI RAID Controller support | ||
| 55 | < > Micro Memory MM5415 Battery Backed RAM support (EXPERIMENTAL) | ||
| 56 | <*> Loopback device support | ||
| 57 | < > Cryptoloop Support (NEW) | ||
| 58 | < > Network block device support | ||
| 59 | < > Promise SATA SX8 support | ||
| 60 | < > RAM disk support | ||
| 61 | () Initramfs source file(s) | ||
| 62 | [*] Support for Large Block Devices | ||
| 63 | < > Packet writing on CD/DVD media | ||
| 64 | IO Schedulers ---> (only anticipatory) | ||
| 65 | < > ATA over Ethernet support | ||
| 66 | </verbatim> | ||
| 67 | |||
| 68 | !!! Device Drivers/Character Devices | ||
| 69 | <verbatim> | ||
| 70 | [ ] Non-standard serial port support | ||
| 71 | Serial drivers ---> | ||
| 72 | [ ] Legacy (BSD) PTY support | ||
| 73 | IPMI ---> | ||
| 74 | Watchdog Cards ---> | ||
| 75 | < > Intel/AMD/VIA HW Random Number Generator support | ||
| 76 | < > /dev/nvram support | ||
| 77 | < > Enhanced Real Time Clock Support | ||
| 78 | < > Generic /dev/rtc emulation | ||
| 79 | < > Double Talk PC internal speech card support | ||
| 80 | < > Siemens R3964 line discipline | ||
| 81 | < > Applicom intelligent fieldbus card support | ||
| 82 | < > Sony Vaio Programmable I/O Control Device support (EXPERIMENTAL) | ||
| 83 | Ftape, the floppy tape device driver ---> | ||
| 84 | <*> /dev/agpgart (AGP Support) | ||
| 85 | < > ALI chipset support | ||
| 86 | < > ATI chipset support | ||
| 87 | < > AMD Irongate, 761, and 762 chipset support | ||
| 88 | < > AMD Opteron/Athlon64 on-CPU GART support | ||
| 89 | < > Intel 440LX/BX/GX, I8xx and E7x05 chipset support | ||
| 90 | <*> NVIDIA nForce/nForce2 chipset support | ||
| 91 | < > SiS chipset support | ||
| 92 | < > Serverworks LE/HE chipset support | ||
| 93 | < > VIA chipset support | ||
| 94 | < > Transmeta Efficeon support | ||
| 95 | < > Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) | ||
| 96 | < > ACP Modem (Mwave) support | ||
| 97 | < > RAW driver (/dev/raw/rawN) (OBSOLETE) | ||
| 98 | </verbatim> | ||
| 99 | |||
| 100 | !!! Filesystems/Pseudo Filesystems | ||
| 101 | <verbatim> | ||
| 102 | [*] /proc file system support | ||
| 103 | [ ] /proc/kcore support | ||
| 104 | [ ] /dev file system support (OBSOLETE) | ||
| 105 | [ ] /dev/pts Extended Attributes | ||
| 106 | [*] Virtual memory file system support (former shm fs) | ||
| 107 | [ ] tmpfs Extended Attributes | ||
| 108 | [ ] HugeTLB file system support | ||
| 109 | </verbatim> | ||
| 110 | |||
| 111 | !!! Grub Config | ||
| 112 | remember grub's ''(hdx,y)'' syntax is zero based. | ||
| 113 | <verbatim> | ||
| 114 | splashimage=(hd0,1)/grub/splash.xpm.gz | ||
| 115 | timeout 10 | ||
| 116 | default 0 | ||
| 117 | fallback 1 | ||
| 118 | |||
| 119 | title RHEL-4 (2.6.12.3) | ||
| 120 | kernel (hd0,1)/bzImage-2.6.13 root=/dev/hda3 | ||
| 121 | |||
| 122 | title Gentoo (2.6.12.13) | ||
| 123 | kernel (hd0,1)/bzImage-2.6.13 root=/dev/hda9 | ||
| 124 | </verbatim> | ||
| 125 | |||
| 126 | !!! It's working, but udev fails | ||
| 127 | This is a false positive. Chances are you've built a static or mostly-static kernel but the '''/sbin/startudev''' script assumes a module-ladden kernel and fails to load scsi and ide modules (which you've probably builtin). | ||
| 128 | |||
| 129 | Edit the script and comment out some of the statements near the end: | ||
| 130 | <verbatim> | ||
| 131 | kill_udevd | ||
| 132 | |||
| 133 | # scsi_replay ... -\ | ||
| 134 | # ret=$[$ret + $?] \ comment out these 4 lines if you've builtin SCSI and IDE drivers. | ||
| 135 | # kill_udevd ... / | ||
| 136 | # ide_scan ... -/ | ||
| 137 | |||
| 138 | /sbin/udevstart | ||
| 139 | </verbatim> | ||
| 140 | |||
| 141 | Now reboot and you should see '''OK''' in green letters. |
lib/blame.php:177: Warning: Invalid argument supplied for foreach()