|
Laptops as Linux Kiosks
by
Jamie Zawinski
Jul - Dec 2000 This document describes how I went about turning a cheap P90 laptop into an internet kiosk. For an explanation of what my goals were, and why I decided not to use laptops for this, go back. _______________________________________________ The basic idea is that the machine mounts as many of its file systems read-only as possible; so nothing can be changed on them, thus it's always safe to power them down. The problem is that Linux really doesn't like it when certain file systems are read-only. In particular:
|
Anything that needed to be writable on the other read-only parititions would be replaced by a symlink into /var. At boot-time, /var would be created by wiping its partition, and then re-initializing it by copying the contents of the /var-ro directory into it.
Here are the steps I followed to create this system:
Install Linux.
| /boot: | 5M; |
| swap: | 128M; |
| /: | 600M; |
| /rw: | 38M. |
Now boot it.
Then edit /etc/X11/XF86Config to add real font paths:
Install some kiosk utilities:
Install these scripts (written by me) into /usr/local/sbin:
| kiosk-dm | A replacement display manager, for doing password-less logins. It simply invokes kiosk-session. |
| kiosk-session | A session script for kiosk-dm that logs in as guest without prompting for a password, then runs guest's .xsession file. |
| xsession | The guest user's .xsession file. It doesn't do much more than invoke gnome-session. |
| var-init | This script runs mkfs to recreate the /var partition from scratch; then initializes that file system with the contents of /var-ro. This is run early in the boot sequence. |
| kiosk-home-init | This script deletes everything under /var/home/guest and replaces it with a fresh copy from /var-ro/home/guest. This is run every time the guest user logs out and then back in again (e.g., when C-Alt-BS is typed.) |
| halt | This is a replacement for /usr/bin/halt that is mostly a no-op. The existing ``halt'' program gets somewhat confused by the read-only state of the world, so we need to use this stripped down version instead. |
Initialize the ``guest'' user'senvironment:
Now guest's home directory needs to move to /var: GNOME won't even start if $HOME is not writable:
Set up auto-login for the guest user:
Make the system boot read-only:
These are the device files that need to be writable. The others can stay on the read-only file system. Don't just move the whole /dev directory to /var, because some of those devices are needed before /var has been mounted!
Also move the RPM and ``locate'' databases to /var, which is where they should have been all along:
/dev/hda5 / ext2 defaults,ro 1 1
/dev/hda1 /boot ext2 defaults,ro 1 2
/dev/hda7 /var ext2 defaults 0 2
Boot up!
Make sure everything works and you're happy with the configuration.
Final security measures:
Since the contents of /var go away when the machine is booted, you might want to configure it to send its syslog messages to another server:
And that should do it... As long as the machine does not have a CDROM or floppy drive attached to it, it should be impossible to remount any of the drives writably without guessing a password or cracking root some other way.
_______________________________________________
Again, please go back to see a diskless NFS-oriented approach to this, which I've decided is a better way.