Just setup a Mac Mini running Ubuntu Server 19.04 with Samba 4.10.0. On macOS Mojave clients, I see the server twice - once as "Mac Mini" (pretty hostname) with the correct Mac Mini icon and once as "mac-mini" (static hostname) with a question mark icon.
I explicitly setup a service in Avahi for the former. Something seems to be auto-registering the second one.
Here's my /etc/avahi/avahi-daemon.conf (thought disallow-other-stacks would prevent systemd-resolve from doing its thing):
[server]
deny-interfaces=softether
disallow-other-stacks=yes
ratelimit-interval-usec=1000000
ratelimit-burst=1000
/etc/avahi/services/timemachine.service
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="no">Mac Mini</name>
<service>
<type>_smb._tcp</type>
<port>445</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=Macmini</txt-record>
</service>
<service>
<type>_adisk._tcp</type>
<txt-record>sys=waMa=0,adVF=0x100</txt-record>
<txt-record>dk0=adVN=Backup,adVF=0x82</txt-record>
</service>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
<service>
<type>_ssh._tcp</type>
<port>22</port>
</service>
<service>
<type>_sftp-ssh._tcp</type>
<port>22</port>
<txt-record>path=/home/someone</txt-record>
<txt-record>u=someone</txt-record>
</service>
</service-group>
Relevant parts of /etc/samba/smb.conf (note: not specifying fruit:model because it doesn't show the right icon and I want Avahi to set it anyway):
[global]
workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
server role = standalone server
fruit:time machine = yes
ea support = yes
disable netbios = yes
disable spoolss = yes
allow trusted domains = no
load printers = no
mdns name = mdns
Here's what avahi-browse sees for what I don't want:
# avahi-browse -a | grep mac-mini
+ lan IPv6 mac-mini Apple TimeMachine local
+ lan IPv4 mac-mini Apple TimeMachine local
+ lan IPv6 mac-mini Microsoft Windows Network local
+ lan IPv4 mac-mini Microsoft Windows Network local
+ lan IPv6 mac-mini _device-info._tcp local
+ lan IPv4 mac-mini _device-info._tcp local
+ lo IPv4 mac-mini Microsoft Windows Network local
+ lo IPv4 mac-mini _device-info._tcp local
+ lo IPv4 mac-mini Apple TimeMachine local
Here's how the one I want appears:
# avahi-browse -a | grep "Mac Mini"
+ lan IPv6 Mac Mini SSH Remote Terminal local
+ lan IPv4 Mac Mini SSH Remote Terminal local
+ lo IPv4 Mac Mini SSH Remote Terminal local
+ lan IPv6 Mac Mini Apple TimeMachine local
+ lan IPv4 Mac Mini Apple TimeMachine local
+ lo IPv4 Mac Mini Apple TimeMachine local
+ lan IPv6 Mac Mini _device-info._tcp local
+ lan IPv4 Mac Mini _device-info._tcp local
+ lo IPv4 Mac Mini _device-info._tcp local
+ lan IPv6 Mac Mini SFTP File Transfer local
+ lan IPv4 Mac Mini SFTP File Transfer local
+ lo IPv4 Mac Mini SFTP File Transfer local
+ lan IPv6 Mac Mini Apple File Sharing local
+ lan IPv4 Mac Mini Apple File Sharing local
+ lo IPv4 Mac Mini Apple File Sharing local
+ lan IPv6 Mac Mini Microsoft Windows Network local
+ lan IPv4 Mac Mini Microsoft Windows Network local
+ lo IPv4 Mac Mini Microsoft Windows Network local
Any thoughts as to what's dynamically registering the services for mac-mini vs. what I've explicitly registered using the Avahi service definition?
Since Ubuntu 17.10 the version of samba present will automatically "register" the presence of its server to the rest of the network using mDNS. There is no need to do so in a /etc/avahi/services/xxx.service file.
Since you are doing so for a partilular reason I would suggest disabling that feature in samba:
Edit /etc/samba/smb.conf and right under the
workgroup = WORKGROUP
line add this one:You can try to just restart smbd ( sudo service smbd restart ) but I think you have to reboot the system.