[systemd-devel] Is there a reason to forcefully create /etc/mtab?

Lennart Poettering lennart at poettering.net
Sun Jul 6 12:09:02 PDT 2014


On Sun, 06.07.14 13:01, Leonid Isaev (lisaev at umail.iu.edu) wrote:

> Hi,
> 
> 	I have a read-only / filesystem and /etc/mtab points to
> /proc/self/mounts as it should.
> 	So, in systemd-215 tmpfile.d fails to create a symbolic link /etc/mtab
> because /usr/lib/tmpfiles.d/etc.conf contains is a line "L+ /etc/mtab - - - -
> ../proc/self/mounts". 
> 	Is this intentional? Besides failing on ro /, it is also confusing
> because /etc/mtab can be supplied by a package (in archlinux, the 'filesystem'
> package), so why tmpfiles instead of including this symlink with systemd?
> 	The same question applies to the entire etc.conf: why does tmpfiles
> touch /etc at all, especially if /etc is already properly set up?

tmpfiles won't do anything with the symlink if it already exists and
already points to the right place. It will only create the symlink (and
possible delete the existing file) if it is missing or not of the righ
type or not pointing to the right place.

The reason I added this was current behaviour of mount(8), which created
/etc/mtab as file if it was missing, and that even with -n. (which got
fixed in git upstream afaik, but not yet released?). This is useful when
/etc is booted up empty.

Anyway, the tmpfiles stuff we do is intended to be a NOP if /etc is
already set up properly.

Of course, we could be a pinch smarter here, and actually understand
relative symlinks when comparing if the existing symlink aready points
to the right place...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list