Skip to content

Commit

Permalink
Fix zfs-mount.service failure on boot
Browse files Browse the repository at this point in the history
The mount(8) command will helpfully try to resolve any device name
which is passed in.  It does this by applying some simple heuristics
before passing it along to the registered mount helper.

Normally this fine.  However, one of these heuristics is to prepend
the current working directory to the passed device name.  If that
resulting directory name exists mount(8) will perform the mount(2)
system call and never invoke the helper utility.

Since the cwd for systemd when running as the system instance is
the root directory the default mount points created by zfs(8) can
cause a mount failure.

This change avoids the issue by explicitly setting the cwd to
a different path when performing the mount.

Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#5719
  • Loading branch information
behlendorf authored and wli5 committed Feb 27, 2017
1 parent 14f6082 commit aa8dbc8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions etc/systemd/system/zfs-mount.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Before=local-fs.target
Type=oneshot
RemainAfterExit=yes
ExecStart=@sbindir@/zfs mount -a
WorkingDirectory=-/sbin/

[Install]
WantedBy=zfs-share.service
Expand Down

0 comments on commit aa8dbc8

Please sign in to comment.