just-containers / s6-overlay

s6 overlay for containers (includes execline, s6-linux-utils & a custom init)
Other
3.7k stars 208 forks source link

Setting S6_READ_ONLY_ROOT does not copy `/etc` to `/run/s6/etc` #555

Closed rauanmayemir closed 10 months ago

rauanmayemir commented 10 months ago

With env vars set like this:

S6_BEHAVIOUR_IF_STAGE2_FAILS=1
S6_READ_ONLY_ROOT=1

I was expecting /etc to be copied to /run/s6/etc, but that's not the case. Is it a bug, or did I misunderstood the readme and supposed to copy it myself?

Even if configs are copied, would supervisor use /run/s6/etc dir instead of /etc for compiling the supervision tree? I.e can I still use S6_STAGE2_HOOK to manipulate user bundle?

rauanmayemir commented 10 months ago

No, even copying manually has no bearing on supervision setup.

skarnet commented 10 months ago

In general the files in /etc are not (supposed to be) written by s6-overlay, so there is no reason to copy the entire /etc.

The services declared in /etc/services.d are copied to /run/s6/legacy-services for supervision.

The s6-rc database is created in /run/s6/db, from sources directly read from /etc.

Is there anything that isn't working in your setup?

rauanmayemir commented 10 months ago

It's just I used stage2 hook to control the user bundle, and since root fs is read-only, I couldn't manipulate user/contents.d.

I am now adding a scratch volume to /etc/s6-overlay/s6-rc.d/user/contents.d and creating whatever services I need that way, so there is no problem now.