xfs_scrub: don't set WorkingDirectory= in systemd job
PATCH 1/1 xfs_scrub: don't set WorkingDirectory= in systemd job
From: Darrick J. Wong <[email protected]>
Somewhere between systemd 237 and 245, they changed the order in which a job has its uid/gid set; capabilities applied; and working directory set. Whereas before they did it in an order such that you could set the working directory to a path inaccessible to 'nobody' (either because they did it before changing the uid or after adding capabilities), now they don't and users instead get a service failure:
[email protected]: Changing to the requested working directory failed: Permission denied [email protected]: Failed at step CHDIR spawning /usr/sbin/xfs_scrub: Permission denied [email protected]: Main process exited, code=exited, status=200/CHDIR
Regardless, xfs_scrub works just fine with PWD set to /, so remove that directive.
--- scrub/[email protected] | 1 - 1 file changed, 1 deletion(-)
scrub/[email protected] +0 -1
@@ -5,7 +5,6 @@ Documentation=man:xfs_scrub(8) [Service] Type=oneshot -WorkingDirectory=%I PrivateNetwork=true ProtectSystem=full ProtectHome=read-only
Quoted 9 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Somewhere between systemd 237 and 245, they changed the order in which a job has its uid/gid set; capabilities applied; and working directory set. Whereas before they did it in an order such that you could set the working directory to a path inaccessible to 'nobody' (either because they did it before changing the uid or after adding capabilities), now they don't and users instead get a service failure:
Quoted 8 lines
[email protected]: Changing to the requested working directory failed: Permission denied [email protected]: Failed at step CHDIR spawning
/usr/sbin/xfs_scrub: Permission denied [email protected]: Main process exited, code=exited, status=200/CHDIRRegardless,
xfs_scrubworks just fine with PWD set to /, so remove that directive.Signed-off-by Darrick J. Wong <[email protected]>
systemd is a black box to me but given this change is self contained and scrub is "experimental" let's go for it? ;) I'll pull this in.
Quoted 17 lines
--- scrub/[email protected] | 1 - 1 file changed, 1 deletion(-)scrub/[email protected] +0
-1@@ -5,7 +5,6 @@ Documentation=man:xfs_scrub(8) [Service] Type=oneshot -WorkingDirectory=%I PrivateNetwork=true ProtectSystem=full ProtectHome=read-only