Samba functions but unable to use it as a MacOS Time Machine destination

This has been driving me nuts and I hope someone here can help point me in the right direction. I've freshly installed 13.0-RELEASE on a server. I've installed Samba 4.13.7 and Avahi (packages samba413 and avahi, installed using pkg and not ports).

My /usr/local/etc/smb4.conf file is as follows:
Code:
[global]
     workgroup = WORKGROUP
     security = user
     passdb backend = tdbsam
     fruit:aapl = yes

[Time Machine]
    comment = Time Machine
    path = /data/timemachine
    browseable = yes
    writeable = yes
    spotlight = yes
    vfs objects = catia fruit streams_xattr
    fruit:time machine = yes
    fruit:metadata = stream
    create mask = 0600
    directory mask = 0700

I've enabled and started samba_server and avahi-daemon in /etc/rc.conf, and enabled dbus as well (required for avahi).

I've created a dedicated user for this, named timemachine. This user has been configured as a samba user (sambapasswd -a timemachine).

The target /data/timemachine is a zfs dataset with compression=lz4 and quota=2TB, and otherwise default properties. The directory is user- and group-owned by timemachine.

drwx------ 2 timemachine timemachine 3 Apr 17 10:54 /data/timemachine/

Permissions on the directory have been tested at 0700 and 0777 with no change in results.

On my macbook, in Finder I'm able to see the Time Machine share being broadcast like expected. I can open it, authenticate as the timemachine user, and write to the directory. I've verified that the files are created on the server just as I would expect.

In the Time Machine menu when I go to Add Disk, it also appears as a valid Time Machine target just as I would expect. I connect to it, authenticate, and it looks like it's ready to back up. But when it begins, it just throws an error saying "Time Machine couldn't back up to SERVER.local"

The logs on the mac show the following:
Code:
2021-04-17 10:52:36  Starting manual backup

2021-04-17 10:52:36  Attempting to mount 'smb://timemachine@SERVER._smb._tcp.local./Time%20Machine'


2021-04-17 10:52:40  Mounted 'smb://timemachine@SERVER._smb._tcp.local./Time%20Machine' at '/Volumes/.timemachine/SERVER_smb._tcp.local./3322C5F6-7936-47B1-9EC7-42D3972AA8A7/Time Machine'

2021-04-17 10:52:40  Initial network volume parameters for 'Time Machine' {disablePrimaryReconnect: 0, disableSecondaryReconnect: 0, reconnectTimeOut: 60, QoS: 0x0, attributes: 0x1C}

2021-04-17 10:52:40  Configured network volume parameters for 'Time Machine' {disablePrimaryReconnect: 0, disableSecondaryReconnect: 0, reconnectTimeOut: 30, QoS: 0x20, attributes: 0x1C}

2021-04-17 10:52:41  Mountpoint '/Volumes/.timemachine/SERVER._smb._tcp.local./3322C5F6-7936-47B1-9EC7-42D3972AA8A7/Time Machine' is still valid

2021-04-17 10:52:41  Mountpoint '/Volumes/.timemachine/SERVER._smb._tcp.local./3322C5F6-7936-47B1-9EC7-42D3972AA8A7/Time Machine' is still valid

2021-04-17 10:52:41  Creating a sparsebundle using Case-sensitive APFS filesystem

2021-04-17 10:52:41  Failed to create '/Volumes/.timemachine/SERVER._smb._tcp.local./3322C5F6-7936-47B1-9EC7-42D3972AA8A7/Time Machine/1EA0B124-7090-5391-8CDF-2267673EB331.sparsebundle', results: {

2021-04-17 10:52:43  Backup failed (20: BACKUP_FAILED_DISK_IMAGE_NOT_CREATED)

I'm at a loss. I can't figure out why Time Machine can see it but not use it, while I'm still able to use it like a normal share.
 
Already tried an APFS file-based image, then a tmutil setdestination, instead of the Samba 4.8+ Time Machine support?
Failed to create '/Volumes/.timemachine/SERVER._smb._tcp.local./3322C5F6-7936-47B1-9EC7-42D3972AA8A7/Time Machine/1EA0B124-7090-5391-8CDF-2267673EB331.sparsebundle', results: {
You can make a fixed-sized Mac OS Extended (Journaled) image, an APFS filesystem, by "hand"

I don't often use Mac, maybe new versions of the operating system understand when you try to write to an smb share and do it by themselves.
EDIT: newer Samba should do it
However, nothing prevents you from trying "manually"
 
Already tried an APFS file-based image, then a tmutil setdestination, instead of the Samba 4.8+ Time Machine support?

No, but I was wanting this to be done just with samba from my fileserver just so I can have a central target for all my Macs.

Fortunately, as often seems to happen, immediately after posting this I think I found my solution. I added "zfsacl" to the vfs objects line, and it seems to work now. It failed at first but then when I tried to kick it off again it worked, and my backup is now running.
 
Lifted from my working setup

Code:
[global]
fruit:aapl = yes
fruit:nfs_aces = yes
fruit:copyfile = no
fruit:model = MacSamba

[TimeMachine]
    vfs objects = acl_xattr catia fruit streams_xattr
    fruit:resource = file
    fruit:time machine = yes
    fruit:time machine max size = 150G
    fruit:metadata = netatalk
    fruit:locking = netatalk
    fruit:encoding = native
        path = /your/path
        valid users = <your_user>
        public = no
        writable = yes
        printable = no
        create mask = 0664
        directory mask = 0755

 
Lifted from my working setup

[snip]

My instances started not working some time ago (40+days) and I don't know why. I kept encountering "The backup image could not be created".

This configuration let me get past that error and get this created:

Code:
[16:32 tm dvl /usr/local/timemachine] % du -ch dvl-air01
3.0K    dvl-air01/air01.sparsebundle/mapped
8.9M    dvl-air01/air01.sparsebundle/bands
8.9M    dvl-air01/air01.sparsebundle
8.9M    dvl-air01
8.9M    total
[16:33 tm dvl /usr/local/timemachine] %

This comes to mind: Does this configuration need to be updated given it is 2.5 years old now? Newer samba, etc.

Thanks.
 
I've got a note to myself in my setup:
# --- Time Machine requirements
# You will need to "touch .com.apple.timemachine.supported"
# in the Time Machine directory otherwise it will throw
# a fit with "does not support the required capabilities"
also apparently
Code:
fruit:advertise_fullsync = true
enables a bunch of stuff you need.
 
Is this what you mean?
Code:
[20:44 tm dvl /usr/local/timemachine] % ls -l
total 74
drwxr-xr-x  3 dvl-air01 dvl-air01 4 2024.01.14 18:08 dvl-air01/
drwxr-xr-x  3 dvl-pro02 dvl-pro02 4 2024.01.14 18:19 dvl-pro02/
drwxr-xr-x  3 dvl-pro03 dvl-pro03 4 2024.01.14 18:56 dvl-pro03/

[20:44 tm dvl /usr/local/timemachine] % sudo touch dvl-air01/.com.apple.timemachine.supported
[20:44 tm dvl /usr/local/timemachine] % sudo touch dvl-pro02/.com.apple.timemachine.supported
[20:45 tm dvl /usr/local/timemachine] % sudo touch dvl-pro03/.com.apple.timemachine.supported
[20:45 tm dvl /usr/local/timemachine] %

I wasn't seeing those errors.
 
I have a bunch of nonsensical notes about zfsacl being a source of constant problems. IDK if this is the right thing to do or not but I did this

zfs set aclinherit=discard ZPOOL_FOR_TIME_MACHINE

Code:
vfs objects = catia fruit streams_xattr acl_xattr
 
I have a bunch of nonsensical notes about zfsacl being a source of constant problems. IDK if this is the right thing to do or not but I did this

zfs set aclinherit=discard ZPOOL_FOR_TIME_MACHINE

Code:
vfs objects = catia fruit streams_xattr acl_xattr

I'm sure that's the ZFS_FILESYSTEM` not ZPOOL
 
I have a bunch of nonsensical notes about zfsacl being a source of constant problems. IDK if this is the right thing to do or not but I did this

zfs set aclinherit=discard ZPOOL_FOR_TIME_MACHINE

Code:
vfs objects = catia fruit streams_xattr acl_xattr

We match on that list night, apart from ordering:

Code:
vfs objects = acl_xattr catia fruit streams_xattr
 
I'll try that zpool configuration change:

Code:
[15:36 r730-03 dvl ~] % zfs get -r aclinherit data01/timemachine
NAME                          PROPERTY    VALUE          SOURCE
data01/timemachine            aclinherit  restricted     default
data01/timemachine/dvl-air01  aclinherit  restricted     default
data01/timemachine/dvl-pro02  aclinherit  restricted     default
data01/timemachine/dvl-pro03  aclinherit  restricted     default

[15:40 r730-03 dvl ~] % sudo zfs set aclinherit=discard data01/timemachine

[15:41 r730-03 dvl ~] % zfs get -r aclinherit data01/timemachine         
NAME                          PROPERTY    VALUE          SOURCE
data01/timemachine            aclinherit  discard        local
data01/timemachine/dvl-air01  aclinherit  discard        inherited from data01/timemachine
data01/timemachine/dvl-pro02  aclinherit  discard        inherited from data01/timemachine
data01/timemachine/dvl-pro03  aclinherit  discard        inherited from data01/timemachine
[15:41 r730-03 dvl ~] %
 
I'll try that zpool configuration change:

Code:
[15:36 r730-03 dvl ~] % zfs get -r aclinherit data01/timemachine
NAME                          PROPERTY    VALUE          SOURCE
data01/timemachine            aclinherit  restricted     default
data01/timemachine/dvl-air01  aclinherit  restricted     default
data01/timemachine/dvl-pro02  aclinherit  restricted     default
data01/timemachine/dvl-pro03  aclinherit  restricted     default

[15:40 r730-03 dvl ~] % sudo zfs set aclinherit=discard data01/timemachine

[15:41 r730-03 dvl ~] % zfs get -r aclinherit data01/timemachine        
NAME                          PROPERTY    VALUE          SOURCE
data01/timemachine            aclinherit  discard        local
data01/timemachine/dvl-air01  aclinherit  discard        inherited from data01/timemachine
data01/timemachine/dvl-pro02  aclinherit  discard        inherited from data01/timemachine
data01/timemachine/dvl-pro03  aclinherit  discard        inherited from data01/timemachine
[15:41 r730-03 dvl ~] %
Backups seem fine. All running as expected.
 
Back
Top