mbentley / docker-timemachine

Docker image to run Samba (compatible Time Machine for macOS)
Apache License 2.0
527 stars 65 forks source link

[Bug]: The backup disk image could not be created #153

Closed jeremyhiggs closed 7 months ago

jeremyhiggs commented 7 months ago

Describe the Bug

I receive the error "The backup disk image could not be created" when trying to backup for the first time

Expected Behavior

A successful backup!

Steps to Reproduce

  1. Launch the Docker image
  2. Add the destination on the Mac
  3. Login
  4. Force backup to commence

How You're Launching the Container

docker run -d --restart=always \
  --name timemachine \
  --net=host \
  -e ADVERTISED_HOSTNAME="" \
  -e CUSTOM_SMB_CONF="false" \
  -e CUSTOM_USER="false" \
  -e DEBUG_LEVEL="1" \
  -e MIMIC_MODEL="TimeCapsule8,119" \
  -e EXTERNAL_CONF="/users" \
  -e HIDE_SHARES="no" \
  -e TM_USERNAME="timemachine" \
  -e TM_GROUPNAME="timemachine" \
  -e TM_UID="1000" \
  -e TM_GID="1000" \
  -e PASSWORD="timemachine" \
  -e SET_PERMISSIONS="true" \
  -e SHARE_NAME="TimeMachine" \
  -e SMB_INHERIT_PERMISSIONS="no" \
  -e SMB_NFS_ACES="no" \
  -e SMB_METADATA="stream" \
  -e SMB_PORT="445" \
  -e SMB_VFS_OBJECTS="acl_xattr fruit streams_xattr" \
  -e VOLUME_SIZE_LIMIT="0" \
  -e WORKGROUP="WORKGROUP" \
  -v /mnt/timemachine/backup:/opt \
  -v timemachine-var-lib-samba:/var/lib/samba \
  -v timemachine-var-cache-samba:/var/cache/samba \
  -v timemachine-run-samba:/run/samba \
  -v /home/ubuntu/timemachine:/users \
  mbentley/timemachine:smb

/home/ubuntu/timemachine/jeremy.conf:

TM_USERNAME=jeremy
TM_GROUPNAME=jeremy
PASSWORD=XXXX
SHARE_NAME=jeremy
VOLUME_SIZE_LIMIT=""
TM_UID=1000
TM_GID=1000

Container Logs

INFO: CUSTOM_SMB_CONF=false; generating [global] section of /etc/samba/smb.conf...
INFO: Creating /var/log/samba/cores
INFO: Avahi - generating base configuration in /etc/avahi/services/smbd.service...
INFO: Loading values from /users/jeremy.conf
INFO: Avahi - adding the 'dk0', 'jeremy' share txt-record to /etc/avahi/services/smbd.service...
INFO: Group jeremy doesn't exist; creating...
INFO: User jeremy doesn't exist; creating...
INFO: Setting password from environment variable
chpasswd: password for 'jeremy' changed
INFO: INFO: CUSTOM_SMB_CONF=false; generating [jeremy] section of /etc/samba/smb.conf...
INFO: Samba - Created User jeremy password set to none.
INFO: Samba - Enabled user jeremy.
INFO: Samba - setting password
INFO: changed ownership of '/opt/jeremy' to 1000:1000
INFO: mode of '/opt/jeremy' changed to 0770 (rwxrwx---)
INFO: Avahi - completing the configuration in /etc/avahi/services/smbd.service...
INFO: running test for xattr support on your time machine persistent storage location...
INFO: xattr test successful - your persistent data store supports xattrs
INFO: Detected filesystem for /opt/jeremy is ext4
INFO: Detected filesystem for /opt/zara is ext4
INFO: entrypoint complete; executing 's6-svscan /etc/s6'
dbus socket not yet available; sleeping...
nmbd version 4.18.9 started.
Copyright Andrew Tridgell and the Samba Team 1992-2023
query_name_response: Multiple (2) responses received for a query on subnet 192.168.100.4 for name WORKGROUP<1d>.
This response was from IP 192.168.100.253, reporting an IP address of 192.168.100.253.
smbd version 4.18.9 started.
Copyright Andrew Tridgell and the Samba Team 1992-2023
INFO: Profiling support unavailable in this build.
dbus socket not yet available; sleeping...
dbus socket not yet available; sleeping...
dbus socket not yet available; sleeping...
dbus socket not yet available; sleeping...
dbus socket not yet available; sleeping...
dbus socket not yet available; sleeping...
dbus socket not yet available; sleeping...
Found user 'avahi' (UID 86) and group 'avahi' (GID 86).
Successfully dropped root privileges.
avahi-daemon 0.8 starting up.
WARNING: No NSS support for mDNS detected, consider installing nss-mdns!
Loading service file /etc/avahi/services/smbd.service.
*** WARNING: Detected another IPv4 mDNS stack running on this host. This makes mDNS unreliable and is thus not recommended. ***
Joining mDNS multicast group on interface docker0.IPv4 with address 172.17.0.1.
New relevant interface docker0.IPv4 for mDNS.
Joining mDNS multicast group on interface eth0.IPv6 with address fd79:381f:5d64:41ac:ba27:ebff:fe92:ee22.
New relevant interface eth0.IPv6 for mDNS.
Joining mDNS multicast group on interface eth0.IPv4 with address 192.168.100.4.
New relevant interface eth0.IPv4 for mDNS.
Joining mDNS multicast group on interface lo.IPv6 with address ::1.
New relevant interface lo.IPv6 for mDNS.
Joining mDNS multicast group on interface lo.IPv4 with address 127.0.0.1.
New relevant interface lo.IPv4 for mDNS.
Network interface enumeration completed.
Registering new address record for 172.17.0.1 on docker0.IPv4.
Registering new address record for fd79:381f:5d64:41ac:ba27:ebff:fe92:ee22 on eth0.*.
Registering new address record for 192.168.100.4 on eth0.IPv4.
Registering new address record for ::1 on lo.*.
Registering new address record for 127.0.0.1 on lo.IPv4.
Server startup complete. Host name is ubuntu.local. Local service cookie is 538583596.
Service "ubuntu" (/etc/avahi/services/smbd.service) successfully established.
*****

Samba name server UBUNTU is now a local master browser for workgroup WORKGROUP on subnet 172.17.0.1

***

Additional Context

/mnt/timemachine/backup:

ls -al /mnt/timemachine/backup
total 12
drwxr-sr-x 3 ubuntu ubuntu 4096 Dec  6 16:53 .
drwxr-xr-x 4 ubuntu ubuntu 4096 Dec  6 06:44 ..
drwxrwx--- 2 ubuntu ubuntu 4096 Dec  6 16:53 jeremy

The /mnt/timemachine/backup/jeremy directory is empty. I have confirmed that my user (ubuntu, with uid 1000) can write to it.

I saw in #84 that writing to NTFS would not be supported. The underlying filesystem is ext4, in this case. I tried vfat/FAT32, but that didn't seem to work, due to a lack of permissions support. I also found in a few instances people using ext4 without problems.

Any ideas?

jeremyhiggs commented 7 months ago
Screenshot 2023-12-06 at 21 11 44
jeremyhiggs commented 7 months ago

I bumped the debug level up to "3" and found this:

open_directory: unable to create CFC36EEB-B9CB-51AC-A5C3-C5A958D8A394_2023-12-06-222746.sparsebundle/bands. Error was NT_STATUS_ACCESS_DENIED

There are file access attempts previously that seem to have run fine:

jeremy opened file .com.apple.timemachine.supported-8bd88a3b-bee-4d3f-b430-1c8a1510ba36 read=Yes write=No (numopen=2)
unpack_nt_owners: owner sid mapped to uid 1000
unpack_nt_owners: group sid mapped to gid 1000
jeremy closed file .com.apple.timemachine.supported-8bd88a3b-bee-4d3f-b430-1c8a1510ba36 (numopen=0) NT_STATUS_OK
jeremy opened file .com.apple.timemachine.supported-8bd88a3b-bee-4d3f-b430-1c8a1510ba36 read=No write=No (numopen=2)
smbd_do_setfilepathinfo: .com.apple.timemachine.supported-8bd88a3b-bee-4d3f-b430-1c8a1510ba36 (fnum 305212056) info_level=1013 totdata=1
jeremy closed file .com.apple.timemachine.supported-8bd88a3b-bee-4d3f-b430-1c8a1510ba36 (numopen=1) NT_STATUS_OK
jeremyhiggs commented 7 months ago

I was able to get this working:

Until I added the umask flag (0000 initially) it wasn't working. 🤷🏻‍♂️