[systemd-devel] PrivateTmp and multiple Exec* lines
lennart at poettering.net
Wed Mar 16 16:11:26 PDT 2011
On Wed, 16.03.11 14:19, Tom Gundersen (teg at jklm.no) wrote:
> Hi all,
> I'm trying to make native systemd units for bootchart2 (see:
> <https://github.com/mmeeks/bootchart>). I ran into the following
> The unit bootchart-done.service has to execute two tasks: run a binary
> that generates some files in a private tmp directory:
> ExecStart=/lib/bootchart/bootchart-collector -c --dump /tmp
> then tar the generated files together and save them somewhere the user
> can find them:
> ExecStart=/bin/tar -zcf "$BOOTLOG_DEST" /tmp/header /tmp/dmesg /tmp/*.log
> This does not work, as each of the ExecStart lines will get a
> different private namespace for their /tmp dir, so the second line
> will not find the files generated by the first.
> Is this a bug or by design? To me it would make sense if a service
> stays inside the same namespace until it is stopped or restarted.
> What do you think?
This is by design actually, PrivateTmp= is only useful if you are not
interested in sharing any data you place in /tmp with anybody. There's
no distinction regarding that "anybody" between yourself at a later
point in time or somebody completely different.
One of the nice features of the namespaces is that they automatically go
away if your process dies. Making them live longer would be much less
sexy and more fragile.
So I have no plans in extending the lifetime of the private tmp option
to multiple processes of the same service.
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel