If this is the first time you've used Yard, do the following:
This contains basic information about what devices you'll be using and their capacities. Everything in it has to be in Perl syntax, but it's all simple variable assignments so you don't need to know Perl.
This file specifies what your bootdisk
will contain. Review this file carefully, especially the selections
of /etc
and /sbin files. Comments at the head of
the file describe the options. I have included everything necessary
for a simple boot sequence, but I don't know how much distributions
vary in their structure. I've used Yard with both Slackware and
RedHat with little modification.
You will probably discover that the default Bootdisk_Contents contains more files than you can fit on a rescue disk. This is intentional: it is easier to delete unnecessary files from Bootdisk_Contents than to guess what files should be added to a minimal Bootdisk_Contents. Two other file sets are included for illustration.
Bootdisk_Contents.sample
is a reasonable set of rescue files
that fits on one disk.
Bootdisk_Contents.minimal
is a small set of files.
Yard will catch many but not all errors. For example, if you change
/etc/inittab to use getty_ps
instead of
getty
, check_root_fs will make sure getty_ps
is included on the disk, but it won't warn you that the calling syntax is
different.
Check the files in the Replacements
subtree that comes with the Yard
distribution. By default, any file mentioned in Bootdisk_Contents
will be copied unchanged from your hard disk. Some things have to be
changed, however, since a rescue disk is pared-down and can't access the
hard disk during boot. You can specify that a different file be used in
place of one mentioned, eg:
/etc/inittab <= ./Replacements/etc/inittab
This causes ./Replacements/etc/inittab (which comes with Yard) to be used for /etc/inittab on the rescue disk. These replacement files are very short so there isn't much to check.
When you ran ``make copies'', the program create_fstab.pl
created the file ./Replacements/etc/fstab from your fstab.
Two modifications are done:
If you have a /etc/lilo.conf, the make copies
will also
create a file ./Replacements/etc/lilo.conf. If you intend to use
Lilo, check this file.
Your system may require dynamically loaded libraries that are not visible
to ldd. Brief comments on this are included in
Bootdisk_Contents
, and explained here.
If your system uses PAM (Pluggable Authentication Modules), you must make some provision for it on your bootdisk or you will not be able to login. PAM, briefly, is a sophisticated modular method for authenticating users and controlling their access to services. An easy way to determine if your system uses PAM is to check your hard disks's /etc directory for a file pam.conf or a pam.d directory; if either exists, you must provide some minimal PAM support. (Alternatively, run ldd on your login executable; if the output includes libpam.so, you need PAM.)
Fortunately, security is usually of no concern with bootdisks, since anyone who has physical access to a machine can usually do anything they want anyway. Therefore, you can essentially disable PAM by creating a simple /etc/pam.conf file in your root filesystem that looks like this:
OTHER auth optional /lib/security/pam_permit.so OTHER account optional /lib/security/pam_permit.so OTHER password optional /lib/security/pam_permit.so OTHER session optional /lib/security/pam_permit.so
Also copy the file /lib/security/pam_permit.so
to your root
filesystem. This library is only about 8K so it imposes minimal overhead.
Note that this configuration allows anyone complete access to the files and services on your machine. If you care about security on your bootdisk for some reason, you'll have to copy some or all of your hard disk's PAM setup to your root filesystem. Be sure to read the PAM documentation carefully, and copy any libraries needed in /lib/security onto your root filesystem.
Yard's check_root_fs
can detect whether you need PAM,
and will warn you if you have not configured it. It will also scan the
configuration file(s) and warn if you have specified a service with no
corresponding library.
If you are using glibc (aka libc6), you will have to make provisions for name services or you will not be able to log in. The file /etc/nsswitch.conf controls database lookups for various servies. If you don't plan to access services from the network (eg, DNS or NIS lookups), you need only prepare a simple nsswitch.conf file that looks like this:
passwd: files shadow: files group: files hosts: files services: files networks: files protocols: files rpc: files ethers: files netmasks: files bootparams: files automount: files aliases: files netgroup: files publickey: files
This specifies that every service be provided only by local files. You
will also need to include /lib/libnss_files.so.1
, which will
be loaded dynamically to handle the file lookups.
If you plan to access the network from your bootdisk, you may want to
create a more elaborate nsswitch.conf file. See the
nsswitch man page for details. Keep in mind that you must
include a file /lib/libnss_
service.so.1
for each service you specify.
Yard's check_root_fs
can detect whether you need to
configure NSS, and will warn you if you haven't. It will also scan the
configuration file and warn if you have specified a service with no
corresponding library.
When you're done customizing these two files, su to root and run:
make_root_fs
This program constructs an initial, uncompressed root filesystem that
the rescue floppy will contain. It works in four passes. First it
processes the Bootdisk_Contents
file and notes special cases
(links and replacements). Next it sets up linked file chains
mentioned in the first step but not included. It looks for required
library files (eg, libc.so) and the loaders required for them.
Finally, it notes any hard-linked files. After that, if the files all
fit, it constructs the filesystem.
make_root_fs
will produce occasional messages
showing what it's doing. Any errors should be prominent. Detailed
output will go to make_root_fs.log
in case you want
to see exactly what the program did. If this is the first time you've
run make_root_fs
for a bootdisk, you should review
the log file. In particular, Yard includes information about the
libraries needed by your chosen files, which is worth checking.
It is especially worth checking if you run out of space.
When you are satisfied with the output, proceed to the next step. You can also chdir to the mount directory and look at the rescue filesystem as it will exist at boot time.
At this point, run:
check_root_fs
This checks the root filesystem for errors and omissions. It knows about the format of inittab, fstab, passwd, pam.conf, etc., and checks them for problems. It also checks scripts for missing interpreters, missing files, etc. It also checks configuration of PAM and NSS, mentioned in the previous section.
Look over the warnings and go back to step 1 if necessary. The warnings
are saved on check_root_fs.log
for later inspection.
Note that you may get a lot of warnings like:
Home directory of userX (...) is missing
Shell of userX (/mnt/bin/bash) doesn't exist
You can ignore these if you don't intend to login as userX.
When you're satisfied with the output from
check_root_fs
, unmount any existing floppy in the drive,
insert a new diskette, and run:
write_rescue_disk
This prorgam takes your kernel and the (compressed) root filesystem and
produces a rescue disk from it. write_rescue_disk
shouldn't produce any errors at this point unless you've exceeded the
floppy capacity after compression. The program's output is copied to
write_rescue_disk.log
.
If you've selected the disk_set=DOUBLE option, the program will write the kernel onto the first disk, then prompt you to change disks, after which it will write the root disk.
If you've selected the disk_set=SINGLE option and your compressed filesystem is too large to be contained on a single floppy with the kernel, the program will offer to create a double-disk set.
If your compressed filesystem is too large to be contained on a floppy, you can try formatting your floppy at a higher density. 1440K is the default, but higher densities are possible with many drives (I have an old, unexceptional floppy drive and BIOS that will support densities up to 1722K). See
man fdand
man fdformatfor details.
You're done. Shut down your system and try to boot from the floppy(ies).
If the boot fails, see the following section on Troubleshooting.
Note that when you boot the rescue disk, it will not automatically mount any of the devices mentioned in your /etc/fstab. This is intentional: rescue disks are often used when a hard disk is inoperational or in an inconsistent state, so hard disks should not automatically be mounted. If you want to mount your other devices, you'll have to do that manually.
The create_fstab
script arranges for your existing hard disk
entries to be placed under /OLDROOT so you can mount them manually.
So from the rescue disk you can type:
mount /OLDROOT
and your hard disk partition usually mounted as root will be mounted under OLDROOT. For example, if you want to run a bash shell under your old root filesystem, you may simply do:
mount /OLDROOT
chdir /OLDROOT ; chroot /OLDROOT bash