Linux that restores itself on each reboot

linux

I'm looking for methods and software to help create a variant of lubuntu that will restore itself to an install state and/or update on every boot. I'm thinking of doing things like putting the root filesystem on a squashfs and using unionfs and tmpfs to make root writable, but automagically restorable. I'm thinking of updating the squashfs with rsync. Perhaps there are other ways to approach the problem. Perhaps root needn't be writable at all. All thoughts welcome.

The home dir would be writable in the usual way.

The goal, if it matters, is a Linux that's simple to maintain from the home office, but that functions correctly for customers. We have some custom software that we wish for customers to be able to run trivially on equipment we provide. Ideally these devices would have a "restore to factory" function that would put it back the way we intended. If this is part of the normal boot cycle, so much the better.

Why lubuntu? Personal preference for this application. It has a usable desktop, but doesn't take up much ram.

Best Answer

SquashFS is the underlying mechanism used in LiveCDs. There are others, but they all represent an overlay. What you want to do is study LiveCDs to see how they get the root mounted on top of the CD (read only) and either a RAM filesystem (easily disposed of) or lay onto a loopback device file on a local drive (non-volatile).

What I think you want to do is create a local file for squash and either delete it as the last step of a shutdown or the first step of a startup. Automatic cleanup is required. Then you guys can distribute an image of the base machine with periodic updates.

Oh, and before you get any bright ideas, multiple overlays might be possible but are strongly discouraged due to some nasty VFS complications.

Of course, you could create loopback files on a local drive for home directories, as though they were encrypted home directories, which might allow for easy backup to external media.