[Pkg-zfsonlinux-devel] Bug#842237: zfs-share.service tries to call /usr/sbin/rm
Petter Reinholdtsen
pere at hungry.com
Thu Oct 27 09:28:47 UTC 2016
[Fabian Grünbichler]
> Bug #832938 changed the bindir macro to /usr/sbin in order to move the
> arc* python scripts there. Unfortunately, this macro is also used in the
> zfs-share.service.in file as the location of the "rm" binary - which is
> installed to /bin on Debian systems.
>
> This leads to the following error message:
> Oct 26 14:00:20 srv04 systemd[3046]: Failed at step EXEC spawning /usr/sbin/rm: No such file or directory
>
> and the file /etc/df/sharetab is not deleted on boot (/service start).
Thank you for letting us know.
> The correct approach seems to be to patch the arc* script automake files
> to use the sbindir macro (although that currently gets set to /sbin ,
> not /usr/sbin , so maybe the scripts need some special casing here),
> and not to change the bindir macro to point to an sbin directory.
>
> The quick and dirty fix is to hardcode /bin/rm in
> zfs-share.service.in.
If I understand you correctly, you propose this change, which make sense
to me if the tools should only be executable by root, independent of the
rm problem at hand:
diff --git a/cmd/arc_summary/Makefile.am b/cmd/arc_summary/Makefile.am
index 815af3b..defa4b2 100644
--- a/cmd/arc_summary/Makefile.am
+++ b/cmd/arc_summary/Makefile.am
@@ -1 +1 @@
-dist_bin_SCRIPTS = arc_summary.py
+dist_sbin_SCRIPTS = arc_summary.py
diff --git a/cmd/arcstat/Makefile.am b/cmd/arcstat/Makefile.am
index 8987b24..71e4125 100644
--- a/cmd/arcstat/Makefile.am
+++ b/cmd/arcstat/Makefile.am
@@ -1 +1 @@
-dist_bin_SCRIPTS = arcstat.py
+dist_sbin_SCRIPTS = arcstat.py
diff --git a/cmd/dbufstat/Makefile.am b/cmd/dbufstat/Makefile.am
index 19bffb0..1a4b4ef 100644
--- a/cmd/dbufstat/Makefile.am
+++ b/cmd/dbufstat/Makefile.am
@@ -1 +1 @@
-dist_bin_SCRIPTS = dbufstat.py
+dist_sbin_SCRIPTS = dbufstat.py
diff --git a/debian/rules b/debian/rules
index 15e0592..9c7d462 100755
--- a/debian/rules
+++ b/debian/rules
@@ -48,7 +48,7 @@ endif
@# Build the userland, but don't build the kernel modules.
dh_auto_configure -- \
- --bindir=/usr/sbin \
+ --bindir=/usr/bin \
--sbindir=/sbin \
--libdir=/lib \
--with-udevdir=/lib/udev \
But given that rm by definition always is available in /bin/,
independent of how zfs was compiled, I believe this change make more
sense to fix this exact problem:
diff --git a/etc/systemd/system/zfs-share.service.in b/etc/systemd/system/zfs-share.service.in
index 688731e..494f5cb 100644
--- a/etc/systemd/system/zfs-share.service.in
+++ b/etc/systemd/system/zfs-share.service.in
@@ -9,7 +9,7 @@ PartOf=smb.service
[Service]
Type=oneshot
RemainAfterExit=yes
-ExecStartPre=- at bindir@/rm -f /etc/dfs/sharetab
+ExecStartPre=-/bin/rm -f /etc/dfs/sharetab
ExecStart=@sbindir@/zfs share -a
[Install]
Perhaps we should commit both?
--
Happy hacking
Petter Reinholdtsen
More information about the Pkg-zfsonlinux-devel
mailing list