# read-only root

## oliwel

Hi,

I am trying to make a read-only root but I am running into trouble with the /lib64 directory storing the startup stuff.

Is there an easy way to move these links to /tmp or /var?

If anybody can point me to a good howto I'd appreciate that.

Oliver

----------

## Sadako

Could you tell us what start up stuff you're referring to within /lib64?

If it needs to be modified each boot, it shouldn't really be in /lib in the first place...

BTW, baselayout 1, or 2 with openrc?

----------

## oliwel

Hi,

its baselayout 2 with openrc, actually its a "linux vserver" guest.

I mean these ones:

/lib64/rc/init.d/started/apache2

and afair these are generated on each boot...

Oliver

----------

## whig

I've got a system going, read-only squashfs combined with tmpfs by using aufs. Newly created files are stored in ram. Those may suit, check them out.

----------

## oliwel

Hi whig,

I am currently using an aufs setup but it has some drawbacks related to the used virtualisation technologie, and a slight overhead when dealing with larger directories. Therefore I want to get rid of it if possible.

The prefered solution would be:

* static and read-only rootfs

* tmfs on /dev

* data partition mounted on /var

I also got solutions in adopted startup scripts to handle individual /etc configs but as written in the initial post I am unable to get rid of the bootup files in /lib64/rc

Oliver

----------

## dermund

Hello oliwel,

 *oliwel wrote:*   

> I am unable to get rid of the bootup files in /lib64/rc

 

This is a bit vague.

You're using an aufs setup atm. Do you just see in your aufs that the files /lib64/rc are created - or have you already tried your desired "r/o rootfs" setup and running into an concrete error?

Are you sure this is the only problem you have with this setup?

I am just curious, because I tried, for fun to boot into a readonly rootfs and I ran into a few problems...

----------

## oliwel

Hi dermund,

indeed I just looked at the aufs overlay :=)

I had a r/o setup running ages before which was a baselayout 1 and the only trick were some special files on /dev which I substituted with a ram fs.

Oliver

----------

## dermund

Hey oliwel,

I would first check what the r/o boot process gives you. Then you have a better idea of that being worth the effort or not.

If the apache service is the only one that complains on startup, you can

- backup the original contents from "/lib/rc" to somewhere

- mount another tmpfs at "/lib/rc"

- copy back the backup-ed contents to the tmpfs

I don't know which drawbacks you experienced using aufs, but I have to note that aufs has features to exclude certain directories from an overlay instead of doing an overlay of the whole / .

Also several overlays with differenciated mount options are possible.

If you apply that to your "performance related directories" you maybe don't suffer from performance drawbacks anymore.

----------

## whig

How about

```
mkdir /var/tmp/rc

mount --rbind /var/tmp/rc /lib64/rc
```

or just a symlink.

----------

