mbentley / docker-timemachine

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

[Help]: Cannot connect to announced Time Machine #151

Closed egigoka closed 7 months ago

egigoka commented 7 months ago

Describe the Bug

Error "There was a problem connecting to the server “timemachine”. The server may not exist or it is unavailable at this time. Check the server name or IP address, check your network connection and then try again." when trying to connect from Finder's Network > timemachine.

Expected Behavior

Connection successful.

Steps to Reproduce

  1. Run latest stable docker image

  2. Open Finder

  3. Open Network in sidebar

  4. Open "timemachine" image

  5. Click button "Connect as..."

  6. Error reproduced image

How You're Launching the Container

`docker run \
-a=stdin -a=stdout -a=stderr \
--name timemachine \
--network=host \
  -e ADVERTISED_HOSTNAME="timemachine" \
-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="timemachine" \
-e TM_GROUPNAME="timemachine" \
-e TM_UID="1000" \
-e TM_GID="1000" \
  -e PASSWORD="password_was_here" \
-e SET_PERMISSIONS="false" \
-e SHARE_NAME="TimeMachine" \
-e SMB_INHERIT_PERMISSIONS="no" \
-e SMB_NFS_ACES="yes" \
-e SMB_METADATA="stream" \
-e SMB_PORT="445" \
-e SMB_VFS_OBJECTS="acl_xattr fruit streams_xattr" \
  -e VOLUME_SIZE_LIMIT="750000000000" \
-e WORKGROUP="WORKGROUP" \
  -v /mnt/btr/Backups/timemachine/backups:/opt \
-v /mnt/btr/Backups/timemachine/netatalk:/var/netatalk \
-v /mnt/btr/Backups/timemachine/logs:/var/log/supervisor \
-v /mnt/btr/Backups/timemachine/var-lib-samba:/var/lib/samba \
-v /mnt/btr/Backups/timemachine/var-cache-samba:/var/cache/samba \
-v /mnt/btr/Backups/timemachine/run-samba:/run/samba \
mbentley/timemachine:latest`

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 timemachine as hostname.
INFO: Avahi - adding the 'dk0', '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
INFO: chpasswd: password for 'timemachine' changed
INFO: CUSTOM_SMB_CONF=false; generating [TimeMachine] section of /etc/samba/smb.conf...
INFO: Samba - Created User timemachine password set to none.
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 btrfs
INFO: entrypoint complete; executing 's6-svscan /etc/s6'
dbus socket not yet available; sleeping...
nmbd version 4.18.8 started.
Copyright Andrew Tridgell and the Samba Team 1992-2023
smbd version 4.18.8 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.
*** WARNING: Detected another IPv4 mDNS stack running on this host. This makes mDNS unreliable and is thus not recommended. ***
*** WARNING: Detected another IPv6 mDNS stack running on this host. This makes mDNS unreliable and is thus not recommended. ***
System host name is set to 'localhost'. This is not a suitable mDNS host name, looking for alternatives.
Joining mDNS multicast group on interface vethff43be8.IPv6 with address fe80::d86c:49ff:fecc:b235.
New relevant interface vethff43be8.IPv6 for mDNS.
Joining mDNS multicast group on interface docker0.IPv6 with address fe80::42:e5ff:fea3:f068.
New relevant interface docker0.IPv6 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 enp1s0.IPv6 with address fe80::44bc:cba3:ebe2:9c7e.
New relevant interface enp1s0.IPv6 for mDNS.
Joining mDNS multicast group on interface enp1s0.IPv4 with address 192.168.1.180.
New relevant interface enp1s0.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::d86c:49ff:fecc:b235 on vethff43be8.*.
Registering new address record for fe80::42:e5ff:fea3:f068 on docker0.*.
Registering new address record for 172.17.0.1 on docker0.IPv4.
Registering new address record for fe80::44bc:cba3:ebe2:9c7e on enp1s0.*.
Registering new address record for 192.168.1.180 on enp1s0.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 linux.local. Local service cookie is 113722982.
Service "timemachine" (/etc/avahi/services/smbd.service) successfully established.
*****

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

*****
*****

Samba name server LOCALHOST is now a local master browser for workgroup WORKGROUP on subnet 192.168.1.180

*****

Additional Context

Connecting by SMB to IP works. image

I've tried searching issues, but cannot find same error message. Sorry if this is duplicate.

mbentley commented 7 months ago

*** WARNING: Detected another IPv4 mDNS stack running on this host. This makes mDNS unreliable and is thus not recommended. ***

This indicates that you already have Avahi/mDNS on your host. See https://github.com/mbentley/docker-timemachine#conflicts-with-samba-andor-avahi-on-the-host

Do you have Samba also running on the host?

egigoka commented 7 months ago

*** WARNING: Detected another IPv4 mDNS stack running on this host. This makes mDNS unreliable and is thus not recommended. ***

This indicates that you already have Avahi/mDNS on your host. See https://github.com/mbentley/docker-timemachine#conflicts-with-samba-andor-avahi-on-the-host

Do you have Samba also running on the host?

Sorry, I indeed was running avahi-daemon on host system. Disabled systemd service avahi-daemon and removed packages avahi and nss-mdns. Also I've changed my hostname to 'infinity.local' to remove System host name is set to 'localhost'. This is not a suitable mDNS host name, looking for alternatives.

Rebooted both linux server and mac.

Now log looks like this:

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 timemachine as hostname.
INFO: Avahi - adding the 'dk0', '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
INFO: chpasswd: password for 'timemachine' changed
INFO: CUSTOM_SMB_CONF=false; generating [TimeMachine] section of /etc/samba/smb.conf...
INFO: Samba - Created User timemachine password set to none.
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 btrfs
INFO: entrypoint complete; executing 's6-svscan /etc/s6'
dbus socket not yet available; sleeping...
nmbd version 4.18.8 started.
Copyright Andrew Tridgell and the Samba Team 1992-2023
smbd version 4.18.8 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 veth9171150.IPv6 with address fe80::a0ba:11ff:fe16:46c0.
New relevant interface veth9171150.IPv6 for mDNS.
Joining mDNS multicast group on interface docker0.IPv6 with address fe80::42:95ff:fe8a:d9b0.
New relevant interface docker0.IPv6 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 enp1s0.IPv6 with address fe80::44bc:cba3:ebe2:9c7e.
New relevant interface enp1s0.IPv6 for mDNS.
Joining mDNS multicast group on interface enp1s0.IPv4 with address 192.168.1.180.
New relevant interface enp1s0.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::a0ba:11ff:fe16:46c0 on veth9171150.*.
Registering new address record for fe80::42:95ff:fe8a:d9b0 on docker0.*.
Registering new address record for 172.17.0.1 on docker0.IPv4.
Registering new address record for fe80::44bc:cba3:ebe2:9c7e on enp1s0.*.
Registering new address record for 192.168.1.180 on enp1s0.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 infinity.local. Local service cookie is 3704897121.
Service "timemachine" (/etc/avahi/services/smbd.service) successfully established.
*****

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

*****
*****

Samba name server INFINITY is now a local master browser for workgroup WORKGROUP on subnet 192.168.1.180

*****

Now I have two entries in "Network" tab: image

And both with same STR give same error: image image

Connecting with Go > Connect to server via IP to SMB still works: image

And immense gratitude for your time in answering and supporting these images.

mbentley commented 7 months ago

OK so you can connect. I'm honestly not sure about why you would not just be able to connect through Finder directly - I am able to connect directly via Finder when I am using both macvlan and --net=host

How are you changing the hostname to infinity.local? Are you setting that for your actual host that is running Docker or is that something you're setting on the container? Is that valid in your local DNS?

So I just did a quick test and this works fine where the container ends up getting my host (in my case I have a test VM called vmlab and it shows up as vmlab and I can connect directly through finder with it using the test credentials:

docker run -d --restart=always --name timemachine --net=host -e TM_USERNAME="timemachine" -e TM_UID="1000" -e TM_GID="1000" -e PASSWORD="timemachine" -e SET_PERMISSIONS="false" -e VOLUME_SIZE_LIMIT="1 T" -v timemachine-data:/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

mbentley commented 7 months ago

Yeah, so I can almost guarantee it's setting ADVERTISED_HOSTNAME. Same issue as https://github.com/mbentley/docker-timemachine/issues/152