[systemd-devel] Using timedatectl on a readonly rootfile system using mender
Lennart Poettering
lennart at poettering.net
Fri Sep 4 15:27:23 UTC 2020
On Do, 20.08.20 14:22, Shravan Singh (shravan at bluesparq.com) wrote:
> But no one is telling how to resolve my issue with a read-only
> rootfs.
There's no concept for having some files in /etc writable and others
not. And you cannot use symlinking for this, nor bind mounts, since
config files in /etc are usually updated atomically, i.e. new versions
written in full into temporary files and then moved into place
atomically so that you either see the old or the new but never
anything half-written. This means that the dir of the file to update
needs to be writable and that the old inode goes away entirely on
update instead of being updated.
I must say I see little point in having "etc mostly read-only"
though. I mean, either your config is entirely read-only or it
isn't. If it is read-only /etc being read-only is not a problem. If it
can be modified then make /etc the source of truth for it and
writable, and drop everything else from it, so that it only contains
the writable data you care about. A lot of software these days falls
back to fallback settings below /usr somewhere if their config files
in /etc don#t exist, and for the stuff that doesn't work like this,
move it over and symlink it from /etc (you can create those symlinks
with tmpfiles.d factory options).
> There are other files which can be overwritten in /etc that are linked to a
> file in /run directory for eg /etc/resolv.conf file.
Well, that file is quite different, resolve.conf is historically was
configuraiton but today is more state than configuraiton, i.e. it is
usually configured dynamically via DHCP or so. Hence people started to
manage it in /run and leave /etc/resolv.conf only as a compat symlink
in place, if you so will.
> Then why not /etc/localtime. Why is localtime guarded so much
> I refuse to believe that I am the only person facing this problem. But I
> did find some leads now. Will keep you posted
/etc/localtime is generally considered to be configuration and not
state, hence people are typically fine with leaving it in /etc, since
that's where persistant configuration is supposed to be.
I am sorry, but /etc on Linux is a single directory, and you can only
cleanly choose between all configuration read only or none, there's no
nice way for a middle ground. Sorry.
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list