Opensuse 13.1, live media and overlayfs
In an earlier post, I mentioned some problems when installing 13.1M3 from a live USB. This post will provide a little background.
Live media are designed for a CD or DVD, which is read-only. However, the running live system wants to have a read-write disk. This is achieved with the aid of “overlayfs”.
What is overlayfs?
Apparently, “overlayfs” is a new file system available with kernel 3.10, though no doubt it was experimented with in earlier kernels. It allows two file systems to be overlaid, with files initially read from one of those and written to the other. In opensuse 13.1M3, it is being use instead of a unionfs that was previously used by some distros. If you google for “overlayfs” you can find some limited documentation, a situation that should improve over time.
The live system, on startup, mounts the CD at “/livecd”, and then mounts a compressed file system from there on “/read-only” (using squashfs). It also mounts a read-write file system on “/read-write”. If the live system is running from a CD or DVD device, then the read-write file system will be a ram disk. If booted from a live CD, it will attempt to mount partition 3, perhaps first creating that partition as a place to save data.
Finally, overlayfs is used to mount “/”, specified as an overlay. The lower file system of the overlay is “/read-only” and the upper file system is “/read-write”.
The idea is that we are supposed to see the files in the lower file system, unless they have been overwritten on the upper file system. Deleting a file amounts to creating a symlink with special attributes on the upper file system. In principle, you can read files from the lower file system, unless overwritten. So the read-write file system only gets changes. Putting the upper file system on the third partition of a USB makes those changes persistent when booting from a USB.
What goes wrong?
I’m not sure of what is failing. In my tests, all works as intended when the read-write file system is a ram disk. But when it is a USB partition, it seems to work for all directories other than “/boot”. If I look at “/read-only/boot” it has the expected files. If I look at “/read-write/boot”, it is empty and with no sign of the symlinks used to delete files. But if I look at “/boot”, which should be the overlay, it is empty. I have tried creating a file there (with “touch x”) and that does to to “/read-write/boot/x”. But there is no sign of the files from “/read-only/boot” which should be visible.
I am only seeing that problem with “/boot”. I’ve checked “/etc”, and it is behaving correctly. The effect of the problem on “/boot” is that an install from the running live system fails to install a kernel.