dfree command is not working anymore in samba

Bug #1310792 reported by Peter de Kraker
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
samba
Incomplete
Unknown
samba (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

I have a ZFS On Linux setup as my main backup/fileserver that uses RaidZ1 (similar to raid 5: 3 disks, 1 parity). Because Linux doesn't show the free space correctly for the complete disk/mount point, the disk space indicator on my Windows machine for this share gives the wrong info. The solution in Samba 3 / Ubuntu 13.10 was to add a "dfree command = scriptname" configuration option to smb.cnf that knew how to figure out the correct disk space/usage. This was all working and the total disk space was displayed correctly in Windows Explorer on the client.

However, now after upgrading to 14.04, the diskspace suddenly gets displayed all wrong again. I checked the script (it worked ok) and even let it output "0 0" to see if it actually gets called by samba, but nothing changed on the indicator of my windows machine. I did reboots of the server, and the client, and nothing changed. I also changed the "dfree command" to a invalid scriptname, and moved it from global to a share section. Nothing worked.

Testparm gives no errors, so it looks like samba somehow just ignores this parameter. Manpage for smb.conf shows that the "dfree command" option is available.

Looks like a regression to me, and is frustrating, because I can't see how much space I am using on my fileserver.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: samba 2:4.1.6+dfsg-1ubuntu2
ProcVersionSignature: Ubuntu 3.13.0-24.46-generic 3.13.9
Uname: Linux 3.13.0-24-generic x86_64
NonfreeKernelModules: zfs zunicode zavl zcommon znvpair
ApportVersion: 2.14.1-0ubuntu3
Architecture: amd64
CurrentDesktop: Unity
Date: Mon Apr 21 22:43:53 2014
InstallationDate: Installed on 2013-09-29 (204 days ago)
InstallationMedia: Ubuntu-Server 13.04 "Raring Ringtail" - Release amd64 (20130423.1)
NmbdLog:

OtherFailedConnect: Yes
SambaServerRegression: Yes
SmbConfIncluded: Yes
SourcePackage: samba
UpgradeStatus: Upgraded to trusty on 2014-04-21 (0 days ago)

Revision history for this message
Peter de Kraker (peterdekraker) wrote :
Revision history for this message
Peter de Kraker (peterdekraker) wrote :

I did some more digging through the logs, and it turns out that the command is called, but fails due to not being called as root user.
For access to the zfs stats you need to be root. This worked ok in 13.10, but it looks like the dfree command is not executed as root user anymore. I would call this a regression, but maybe this is intentional? Still, it makes my dfree command useless...

[2014/04/22 12:48:52.745632, 0] ../source3/smbd/dfree.c:128(sys_disk_free)
  disk_free: file_lines_load() failed for command '/home/peter/scripts/zfs_free.sh .'. Error was : No child processes
Unable to open /dev/zfs: Permission denied.
Unable to open /dev/zfs: Permission denied.

Revision history for this message
Steve H (steveh7) wrote :

If your computer is trusted, here's a workaround: https://gist.github.com/steveh/7356e2ba93af5869f385

Revision history for this message
Peter de Kraker (peterdekraker) wrote :

My workaround for now is to allow zfs module access to all users from the zfs group, instead of only root.
This way the zfs command can be run by by users from that group.

/etc/udev/rules.d/91-zfs-permissions.rules
#Use this to add a group and more permissive permissions for zfs
#so that you don't always need run it as root. beware, users not root
#can do nearly EVERYTHING, including, but not limited to destroying
#volumes and deleting datasets. they CANNOT mount datasets or create new
#volumes, export datasets via NFS, or other things that require root
#permissions outside of ZFS.
ACTION=="add", KERNEL=="zfs", MODE="0660", GROUP="zfs"

Note that you need to add the zfs group and add the users to it. This is also a bit risky, because every user of that group can now modify zfs stuff. (But on your own homeserver this is not really a problem)

Changed in samba:
status: Unknown → Confirmed
Changed in samba:
status: Confirmed → Incomplete
Revision history for this message
Red Ink (redink) wrote :

I'm having the same problem, or at least symptoms, with ext4 filesystems and Ubuntu 14.04. The Samba server I'm trying to connect to is still running 13.10, and the problem only started after I upgraded one of my laptops to 14.04.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in samba (Ubuntu):
status: New → Confirmed
Changed in samba (Ubuntu):
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.