From Fedora Project Wiki

Stateless Linux - Preparing An Image

See Stateless Linux HOWTO

Once you have prepared a base image, you need to modify it so that it can be used by stateless clients.

One thing to bear in mind is that the same image should be usable on a client using NFS root, NFS loop root, cached root or, indeed, by a standalone system or a Xen guest.

The basic things you must do are:

  • Switch on readonly-root:
$> echo "READONLY=yes" > /etc/sysconfig/readonly-root

This ensures that the init scripts do not remount the root filesystem read-write and various directories (see /etc/rwtab) are made writable using tmpfs mounts.

  • Remove the / and /boot entries from /etc/fstab
  • Disable firstboot:
$> echo "RUN_FIRSTBOOT=no" > nfs/etc/sysconfig/firstboot

You should also:

  • Check the network interface is configured to use DHCP:
$> cat > /etc/sysconfig/networking-scripts/ifcfg-eth0 << EOF
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
EOF
  • Configure the firewall

FIXME: details

  • Ensure /etc/mtab exists or the attempt to mount a tmpfs on /var/lib/stateless/writable will fail trying to lock /etc/mtab

FIXME: this seems bogus; we should be able to survive this

  • Run all the default cronjobs

FIXME: why? what does this fix?

  • Remove unwanted files

FIXME: what leaves all these lying around? Can we fix them to not be left around?

  • /etc/group- and /etc/passwd- : temporary files
  • /etc/resolv.conf : client's will get the nameservers using DHCP
  • /tmp/.mozilla : what's this?
  • /var/lib/rpm/__db.* : stale RPM locks

Notes:

  • With your NIC configured to use DHCP, you need mkinitrd >= 5.0.47-1 in order for the lease obtained by the initrd to be passed to the dhclient that gets run later