(This is a cross post from askubuntu, as I think here are more people to know how to get this working)

I want to set up Ubuntu 16.04 like a live CD. This worked great in Ubuntu 12.04 but with 16.04 there are problems. Services are crashing, CRON doesn't work, X doesn't work, I can't even login to the shell. So I think 16.04 needs some modification. If I mount the root drive as read/write, everything works like it should. So, the OS itself is OK.

To let Ubuntu boot in read-only mode I replace the kernel parameter "rw" by "ro" and use a script in initramfs:




prereqs() {
  echo "$PREREQ"

case $1 in
  exit 0


# Create mount points for the read-only and read/write layers:
mkdir "${ro_mount_point}" "${rw_mount_point}"

# Move the already-mounted root filesystem to the ro mount point:
mount --move "${rootmnt}" "${ro_mount_point}"

# Mount the read/write filesystem:
mount -t tmpfs root.rw "${rw_mount_point}"

# Mount the union:
mount -t aufs -o "dirs=${rw_mount_point}=rw:${ro_mount_point}=ro" root.union "${rootmnt}"

# Correct the permissions of /:
chmod 755 "${rootmnt}"

# Make sure the individual ro and rw mounts are accessible from within the root
# once the union is assumed as /.  This makes it possible to access the
# component filesystems individually.
mkdir "${rootmnt}/ro" "${rootmnt}/rw"
mount --bind "${ro_mount_point}" "${rootmnt}/ro"
mount --bind "${rw_mount_point}" "${rootmnt}/rw"

# ro_root end

How to set up Ubuntu 16.04 with ro root drive and rw fs layer correctly?

  • 1
    You should delete the other post if you want this one to stay open. – garethTheRed May 12 '16 at 6:40
  • I was using a ro-root just fine on 15.10, now with 16.04 the machine doesn't even boot. – Jonathan Neufeld Jun 17 '16 at 2:32

Use the standard Ubuntu package "overlayroot". In Ubuntu 16.04, this package is automatically installed. You simply need to enable it by editing /etc/overlayroot.conf and adding the following setting:


Reboot the Ubuntu 16.04 system, and you're done. You may want to add a kernel boot entry to your grub configuration to make it easy to temporarily disable the read-only root filesystem for patches, etc. The way to do this is to add a grub entry that passes a kernel argument as follows:


See more at: https://spin.atomicobject.com/2015/03/10/protecting-ubuntu-root-filesystem/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.