mbentley / docker-timemachine

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

[Help]: Can't Connect to Time Machine #152

Closed Kentakoong closed 10 months ago

Kentakoong commented 10 months ago

Describe the Bug

I created an docker container, quite similar settings as the template one, but ends up not connecting.

Expected Behavior

The container should run normally

Steps to Reproduce

I used the docker run command, then connect in the Finder App.

How You're Launching the Container

docker run -d --restart=always \
  --name timemachine \
  --net=host \
  -e ADVERTISED_HOSTNAME="Kentakoong's Time Machine" \
  -e CUSTOM_SMB_CONF="false" \
  -e CUSTOM_USER="false" \
  -e DEBUG_LEVEL="1" \
  -e MIMIC_MODEL="TimeCapsule8,119" \
  -e EXTERNAL_CONF="" \
  -e HIDE_SHARES="no" \
  -e TM_USERNAME="KentakoongTimeMachine" \
  -e TM_GROUPNAME="KentakoongTimeMachine" \
  -e TM_UID="1000" \
  -e TM_GID="1000" \
  -e PASSWORD="kenta2549" \
  -e SET_PERMISSIONS="false" \
  -e SHARE_NAME="kentakoong-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" \
  -v /hdd/timemachine:/opt/timemachine \
  -v timemachine-var-lib-samba:/var/lib/samba \
  -v timemachine-var-cache-samba:/var/cache/samba \
  -v timemachine-run-samba:/run/samba \
  mbentley/timemachine:smb

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: Avahi - using Kentakoong's Time Machine as hostname.
INFO: Avahi - adding the 'dk0', 'kentakoong-timemachine' share txt-record to /etc/avahi/services/smbd.service...
INFO: Group timemachine doesn't exist; creating...
INFO: User timemachine doesn't exist; creating...
INFO: Setting password from environment variable
chpasswd: password for 'timemachine' changed
INFO: INFO: CUSTOM_SMB_CONF=false; generating [kentakoong-timemachine] section of /etc/samba/smb.conf...
INFO: Samba - Created Added user timemachine.
INFO: Samba - Enabled user timemachine.
INFO: Samba - setting password
INFO: SET_PERMISSIONS=false; not setting ownership and permissions for /opt/timemachine
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/timemachine 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
smbd version 4.18.9 started.
Copyright Andrew Tridgell and the Samba Team 1992-2023
INFO: Profiling support unavailable in this build.
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.
Joining mDNS multicast group on interface veth0b36654.IPv6 with address fe80::ec0b:59ff:fe56:790c.
New relevant interface veth0b36654.IPv6 for mDNS.
Joining mDNS multicast group on interface br-901e1b51f9ea.IPv6 with address fe80::42:cbff:fe8a:e6f0.
New relevant interface br-901e1b51f9ea.IPv6 for mDNS.
Joining mDNS multicast group on interface br-901e1b51f9ea.IPv4 with address 172.18.0.1.
New relevant interface br-901e1b51f9ea.IPv4 for mDNS.
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 enp4s0.IPv6 with address fe80::a61f:72ff:fe75:d585.
New relevant interface enp4s0.IPv6 for mDNS.
Joining mDNS multicast group on interface enp4s0.IPv4 with address 192.168.1.200.
New relevant interface enp4s0.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 fe80::ec0b:59ff:fe56:790c on veth0b36654.*.
Registering new address record for fe80::42:cbff:fe8a:e6f0 on br-901e1b51f9ea.*.
Registering new address record for 172.18.0.1 on br-901e1b51f9ea.IPv4.
Registering new address record for 172.17.0.1 on docker0.IPv4.
Registering new address record for fe80::a61f:72ff:fe75:d585 on enp4s0.*.
Registering new address record for 192.168.1.200 on enp4s0.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 kentakoong-server.local. Local service cookie is 2971835820.
Service "Kentakoong's Time Machine" (/etc/avahi/services/smbd.service) successfully established.
*****

Samba name server KENTAKOONG-SERVER is now a local master browser for workgroup WORKGROUP on subnet 172.17.0.1

*****
*****

Samba name server KENTAKOONG-SERVER is now a local master browser for workgroup WORKGROUP on subnet 172.18.0.1

*****
*****

Samba name server KENTAKOONG-SERVER is now a local master browser for workgroup WORKGROUP on subnet 192.168.1.200

*****

Additional Context

No response

mbentley commented 10 months ago

This isn't relevant to the connection issue but your path for the persistent data volume isn't right. This -v /hdd/timemachine:/opt/timemachine \ should be -v /hdd/timemachine:/opt/KentakoongTimeMachine \ because you tell it to use KentakoongTimeMachine for the username. Your data would be stored inside the container and lost when you update the container if you don't correct this.

You do not want to set ADVERTISED_HOSTNAME because you're telling your machine to try to talk to a host at that hostname. For one, the hostname isn't a valid hostname that you're setting and I am guessing you don't have a hostname set in DNS for it. It should work fine after removing that env var line.

mbentley commented 10 months ago

Let me know if that doesn't solve the problem.

Kentakoong commented 10 months ago

Still not working with these configs.

Screenshot 2023-12-10 at 20 52 41

Logs

docker run -d --restart=always \
  --name timemachine \
  --net=host \
  -e CUSTOM_SMB_CONF="false" \
  -e CUSTOM_USER="false" \
  -e DEBUG_LEVEL="1" \
  -e MIMIC_MODEL="TimeCapsule8,119" \
  -e EXTERNAL_CONF="" \
  -e HIDE_SHARES="no" \
  -e TM_USERNAME="KentakoongTimeMachine" \
  -e TM_GROUPNAME="KentakoongTimeMachine" \
  -e TM_UID="1000" \
  -e TM_GID="1000" \
  -e PASSWORD="kenta2549" \
  -e SET_PERMISSIONS="false" \
  -e SHARE_NAME="kentakoong-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" \
  -v /hdd/timemachine:/opt/KentakoongTimeMachine \
  -v timemachine-var-lib-samba:/var/lib/samba \
  -v timemachine-var-cache-samba:/var/cache/samba \
  -v timemachine-run-samba:/run/samba \
  mbentley/timemachine:smb

Command

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: Avahi - adding the 'dk0', 'kentakoong-timemachine' share txt-record to /etc/avahi/services/smbd.service...
INFO: Group KentakoongTimeMachine doesn't exist; creating...
INFO: User KentakoongTimeMachine doesn't exist; creating...
INFO: Setting password from environment variable
chpasswd: password for 'KentakoongTimeMachine' changed
INFO: INFO: CUSTOM_SMB_CONF=false; generating [kentakoong-timemachine] section of /etc/samba/smb.conf...
INFO: Samba - Created User KentakoongTimeMachine password set to none.
INFO: Samba - Enabled user KentakoongTimeMachine.
INFO: Samba - setting password
INFO: SET_PERMISSIONS=false; not setting ownership and permissions for /opt/KentakoongTimeMachine
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/KentakoongTimeMachine 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
smbd version 4.18.9 started.
Copyright Andrew Tridgell and the Samba Team 1992-2023
INFO: Profiling support unavailable in this build.
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.
Joining mDNS multicast group on interface veth17e5959.IPv6 with address fe80::c843:3aff:fe7b:1fdf.
New relevant interface veth17e5959.IPv6 for mDNS.
Joining mDNS multicast group on interface br-901e1b51f9ea.IPv6 with address fe80::42:cbff:fe8a:e6f0.
New relevant interface br-901e1b51f9ea.IPv6 for mDNS.
Joining mDNS multicast group on interface br-901e1b51f9ea.IPv4 with address 172.18.0.1.
New relevant interface br-901e1b51f9ea.IPv4 for mDNS.
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 enp4s0.IPv6 with address fe80::a61f:72ff:fe75:d585.
New relevant interface enp4s0.IPv6 for mDNS.
Joining mDNS multicast group on interface enp4s0.IPv4 with address 192.168.1.200.
New relevant interface enp4s0.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 fe80::c843:3aff:fe7b:1fdf on veth17e5959.*.
Registering new address record for fe80::42:cbff:fe8a:e6f0 on br-901e1b51f9ea.*.
Registering new address record for 172.18.0.1 on br-901e1b51f9ea.IPv4.
Registering new address record for 172.17.0.1 on docker0.IPv4.
Registering new address record for fe80::a61f:72ff:fe75:d585 on enp4s0.*.
Registering new address record for 192.168.1.200 on enp4s0.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 kentakoong-server.local. Local service cookie is 209070634.
Service "kentakoong-server" (/etc/avahi/services/smbd.service) successfully established.
*****

Samba name server KENTAKOONG-SERVER is now a local master browser for workgroup WORKGROUP on subnet 172.17.0.1

*****
*****

Samba name server KENTAKOONG-SERVER is now a local master browser for workgroup WORKGROUP on subnet 172.18.0.1

*****
*****

Samba name server KENTAKOONG-SERVER is now a local master browser for workgroup WORKGROUP on subnet 192.168.1.200

*****
mbentley commented 9 months ago

Can you ping the hostname kentakoong-server? You need working DNS if not.

Kentakoong commented 9 months ago

Yep, I could totally ping it normally, since I use it for ssh too

mbentley commented 9 months ago

Not sure why it's not working then. I am able to take your exact command and it get working:

https://github.com/mbentley/docker-timemachine/assets/414445/2091d33c-c2be-4f1c-a860-a209fffacf7a

Try increasing the log verbosity from DEBUG_LEVEL=1 to DEBUG_LEVEL=3 and seeing if there are any errors returned when you try to connect.

Kentakoong commented 9 months ago

got it, I'll try that