|Prev||Appendix A. Appendices|
Yet Another Gotcha: A burned CD must be a minimum size or it will be unreadable to most operating systems: 1.5MB < minimum <= 9.5MB. I haven't had a chance to test this and see where it is exactly, and I don't know what spec would apply, if any. Someone want to look this up for me and update this file with the answer? Fortunately this will not affect the final product, but interim builds must use padding to get past this limitation.
Yet Another Gotcha: An init ramdisk must actually be created on /dev/ram*, or it won't be usable. All testing I've done using an initrd created inside a loopback file has failed after the filesystem is mounted. Somehow it's able to find the image at the correct seek, recognize the ext2 filesystem but then when it tries to run init it chokes. /dev/ram* init ramdisks don't have this problem.
Do not e2defrag a loopback device. ;-) You won't be able to umount it if you mount it.
YAG: I had problems starting syslogd from initrd but NOT from rd-base. It turned out to be a nasty undocumented gotcha: if /var/run doesn't exist, syslogd won't run because it can't create its pid file. The directory can be completely empty. Also, syslogd will run, but it won't do anything without both libnss_files.so and /etc/services. Finally, must use tty1-6 for syslogd (?).
Some quasi-kludges had to be introduced to make mtools behave. In order to get around the need to have a physical floppy in the drive (which was ridiculous given that no real floppy is ever used once the CD is burned), I had to throw in my own mtools.conf to make it think a loopback file was the A: drive. This would have been a lot easier if the curmudgeonly tool accepted unix files in addition to DOS A: syntax.
YAG: klogd locks the /proc filesystem. You have to kill klogd to umount it.
The following files are needed for PAM:
OK, the story is, the first line in pwdb.conf after user must be unix+shadow for anything to work. If you don't have /usr/lib/cracklib_dict*, you will get a friendly 'Critical error' failure when trying to change a password with pam_cracklib. You use mkdict/packer to create the dictionary.
YAG: ld-linux.so MUST be +x or normal users can't run programs.
/etc/login.defs stores configuration information for shadow passwords and login security. It is largely undocumented. Ditto for /etc/default/useradd.
I save a lot of space by symlinking libc, ld-linux, etc. from /lib to /initrd. So don't umount initrd! :)
devfs is extremely difficult to work with -- possibly one of the most disruptive changes I have made to date. Having said that, I think it's also going to be one of the best things I've put in because it saves space, it removes maintenance of the dev tarball, it eliminates the need for a sudo'd tar, and it's easier to administrate. Some problems I've encountered:
You must run devfsd to get anywhere because so many programs just refuse to search anywhere but the default dir for their devices. mingetty is one such.
When you have devfs=mount option set, it automatically umounts/remounts /dev when you do a change_root() (for example when Repairlix switches from the initrd to /dev/ram1.) This is actually helpful, but can be confusing. [UPDATE]: I'm not using change_root/real-root-dev any more now that pivot_root has proven successful. Unfortunately, pivot_root doesn't do the automatic move of devfs.
YAG: The kernel parameter init= is ignored if root= is not present. To use an initrd with init=xxxx, you must also specify root=/dev/ram.
ramfs: I finally got this filesystem working as root(/). This is how:
Get pivot_root from util-linux 2.10h or newer. You'll probably have to compile it from source - most distros aren't including pivot_root in their package of util-linux yet (justifiably, since it doesn't work on a 2.2 kernel).
The initrd must have init on it. You must pass the following parameters to the kernel: initrd=<your initrd img> root=/dev/ram init=/sbin/init(or wherever init is). The root= parameter is important - tells Linux not to panic if /linuxrc is missing.
inittab should have a sysinit that points to a shell script. This script must do the following:
mkdir /ramfs # unless your initrd has this directory already. mount -t ramfs rootramfs /ramfs cd /ramfs tar xvfj real_root_filesystem.tar.bz2 mount -t devfs rootdevfs /ramfs/dev # unless you're not using devfs. # pivot_root doesn't attempt to # remount devfs, unlike the real-root-dev pivot_root /ramfs /ramfs/initrd # real_root_filesystem should contain # /initrd, unless you want to put the # initrd somewhere else.
Incidentally, you'll probably end up with a hösed mtab after this is done - pivot_root doesn't take care of updating mtab entries. It's probably a good idea to just cat /proc/mounts > /etc/mtab after pivot_root. You won't be able to trust mount otherwise.