systemd-resolved won't start on read-only filesystem, unless run outside systemd #5610
Description
Submission type
- Bug report
- Request for enhancement (RFE)
systemd version the issue has been seen with
systemd version 232, Arch Linux ARM (systemd 232-8) on Raspberry Pi
Expected behaviour you didn't see
/run/systemd/resolve/resolve.conf was not created, even though /run is on tmpfs and writable.
Unexpected behaviour you saw
systemd-resolved fails to launch:
# systemctl restart systemd-resolved
Job for systemd-resolved.service failed because of unavailable resources or another system error.
See "systemctl status systemd-resolved.service" and "journalctl -xe" for details.
# systemctl status systemd-resolved
* systemd-resolved.service - Network Name Resolution
Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
Active: failed (Result: resources) since Wed 2017-02-01 11:13:07 AEST; 4s ago
Docs: man:systemd-resolved.service(8)
http://www.freedesktop.org/wiki/Software/systemd/resolved
http://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
http://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
Feb 01 11:13:07 rpi systemd[1]: systemd-resolved.service: Unit entered failed state.
Ignore the last line (dated Feb 01) - since the filesystem is read only, no new log entries can be created. This means journalctl -xe provides no further details either.
However systemd-resolved appears to work fine when run directly:
# /usr/lib/systemd/systemd-resolved
Positive Trust Anchors:
. IN DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5
Negative trust anchors: 10.in-addr.arpa 16.172.in-addr.arpa 17.172.in-addr.arpa 18.172.in-addr.arpa 19.172.in-addr.arpa 20.172.in-addr.arpa 21.172.in-addr.arpa 22.172.in-addr.arpa 23.172.in-addr.arpa 24.172.in-addr.arpa 25.172.in-addr.arpa 26.172.in-addr.arpa 27.172.in-addr.arpa 28.172.in-addr.arpa 29.172.in-addr.arpa 30.172.in-addr.arpa 31.172.in-addr.arpa 168.192.in-addr.arpa d.f.ip6.arpa corp home internal intranet lan local private test
Using system hostname 'rpi'.
# ls /run/systemd/resolve/resolv.conf
-rw-r--r-- 1 systemd-resolve systemd-resolve 547 Feb 1 11:12 /run/systemd/resolve/resolv.conf
It only seems to be that when systemd-resolved is started by systemd itself that it fails. None of the other systemd services are failing.
For the record, remounting the root filesystem read/write (with mount / -o remount,rw) so that the journal can be viewed makes systemctl restart systemd-resolved succeed, so there are no errors recorded in the journal anyway.
Steps to reproduce the problem
- Mark the root filesystem as readonly (in
/etc/fstaband the kernel command line) - Confirm
/runor whereversystemd-resolvedneeds to store its files is read-write, e.g. by putting atmpfsmount here. This is the default for Arch Linux ARM. - Reboot
cat /run/systemd/resolve/resolv.confwill return a file not found error- Run
/usr/lib/systemd/systemd-resolvedand observe thecatcommand in the previous step now works, even though the root filesystem is still read-only.