Bug 81169

Summary: ConditionNeedsUpdate should not match read-only fs
Product: systemd Reporter: Enrico Scholz <enrico.scholz>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Enrico Scholz 2014-07-10 12:18:53 UTC
The ldconfig.service fails when /etc is on a read-only mounted filesystem.  Although this condition can be checked explicit in this service file, a better fix might be to imply a 'ConditionPathIsReadWrite' check for 'ConditionNeedsUpdate'
Comment 1 Enrico Scholz 2014-07-10 12:38:04 UTC
I see, code contains such a check already.  Unfortunately, checking for ST_RDONLY (--> 0x01) does not work on NFS filesystems. Check for 'access(..., W_OK)' might be more appropriate


# strace stat -f /etc
statfs64("/etc", 88, ...  f_flags=4128})

# strace touch /etc/x
open("/etc/x", O_RDWR|O_CREAT|O_LARGEFILE, 0666) = -1 EROFS (Read-only file system)

# systemctl status ldconfig
��� ldconfig.service - Rebuild Dynamic Linker Cache
   Loaded: loaded (/lib/systemd/system/ldconfig.service; static)
   Active: failed (Result: exit-code) since Tue 2014-06-10 15:35:20 UTC; 40min ago
     Docs: man:ldconfig(8)
  Process: 566 ExecStart=/sbin/ldconfig -X (code=exited, status=1/FAILURE)
 Main PID: 566 (code=exited, status=1/FAILURE)

ldconfig[566]: /sbin/ldconfig: Can't create temporary cache file /etc/ld.so.cache~: Read-only file system

# systemctl --version
systemd 215
Comment 2 Lennart Poettering 2014-08-18 21:18:41 UTC
I added a second check with access() now, in the hope this improves things a bit for NFScases like yours:

http://cgit.freedesktop.org/systemd/systemd/commit/?id=70421bdce2719d76efffd8afdc28433c75aac5a2

Can you please check if this makes this work for you? Thanks!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.