Comment 14 for bug 1750780

Revision history for this message
Scott Moser (smoser) wrote :

I agree with reverting change in bionic, and that xenial still needs some fix.

I recreated your failure in xenial and agree with your change there.
I used this job as it actually tries to write to the private tmp.

If I change 'ExecStart' below to be just '/bin/true' like in your job, it does not fail (status says 'code=exited, status=0/SUCCESS). But the command below seems to never get exited (it produces no output).

So it seems to me that the 'Read only filesystem' error is not even from the service itself, but rather from systemd, and also dependent on the content in ExecStart.

$ cat /lib/systemd/system/my-ptmp-test.service
[Unit]
Description=foo
DefaultDependencies=no
[Service]
Type=oneshot
PrivateTmp=yes
ExecStart=/bin/sh -ec 'f=/tmp/my.txt; uptime > $f; echo ==; cat $f; echo ==; cat /proc/mounts'
[Install]
WantedBy=multi-user.target

Then we can see the same failure:

$ journalctl -o short-monotonic --no-pager | grep --context=2 my-ptmp-test
[ 7.715220] xenial-20180223-142555 systemd[1]: Created slice System Slice.
[ 7.718923] xenial-20180223-142555 systemd[1]: Created slice system-systemd\x2dfsck.slice.
[ 7.740250] xenial-20180223-142555 systemd[1]: my-ptmp-test.service: Failed to run 'start' task: Read-only file system
[ 7.749135] xenial-20180223-142555 systemd[1]: Failed to start foo.
[ 7.754114] xenial-20180223-142555 systemd[1]: my-ptmp-test.service: Unit entered failed state.
[ 7.760217] xenial-20180223-142555 systemd[1]: my-ptmp-test.service: Failed with result 'resources'.
[ 7.764170] xenial-20180223-142555 systemd[1]: Starting Load Kernel Modules...
[ 7.775558] xenial-20180223-142555 systemd[1]: Starting Journal Service...

$ systemctl status my-ptmp-test.service --no-pager --full
● my-ptmp-test.service - foo
   Loaded: loaded (/lib/systemd/system/my-ptmp-test.service; enabled; vendor preset: enabled)
   Active: failed (Result: resources)