Something Not working correctly with hostname of router screwing up Time Machine

ComputerSteve

Regular Contributor
I keep having to reconfigure time machine because the hostname of the router is changing. For instance I modified my router to say "AC86U-DEN" in the hostname tab of LAN - LAN IP, & when I go to time machine i'm seeing "AC86U-DEN-27.local". If I reboot the router it changes to something else. I am running the latest Merlin 386.4. I honestly never ran into this problem before IDK?
 

RMerlin

Asuswrt-Merlin dev
Where are you changing the hostname? Make sure you do that on the LAN page. Time Machine uses the content of the lan_hostname nvram variable to set up the hostname.
 

ComputerSteve

Regular Contributor
Where are you changing the hostname? Make sure you do that on the LAN page. Time Machine uses the content of the lan_hostname nvram variable to set up the hostname.
I think I got it resolved. IDK how but it seems to be staying stable at the hostname I set. Thanks =)
 

ComputerSteve

Regular Contributor
Yeah so this isn't working right.. The hostname is wrong or changes every time you reboot the AC86U... I have my hostname set to AC86U-DEN-418 & every time I reboot it randomly changes to something else with numbers added to it. I can get it back to the correct name but I have to change the host name then disable / re-enable time machine.
 

ComputerSteve

Regular Contributor
So heres what happens after restart. I renamed the device RT-AC86U & now after rebooting it displays RT-AC86U-16... If I enable and disable time machine in the USB application tab of 192.168.1.1 or if I got to http://192.168.1.1/Advanced_LAN_Content.asp and change the Host Name it corrects it back to the appropriate name but after I reboot it again it again adds a random number to the end.
 

ComputerSteve

Regular Contributor
Where are you changing the hostname? Make sure you do that on the LAN page. Time Machine uses the content of the lan_hostname nvram variable to set up the hostname.
Yeah so after further research and if I run this command SSH in ps w | grep avahi-daemon.. This keeps changing after reboot with some random number added to it. Even though the host name is not changing. I can get it back to normal by either enabling / disabling time machine or changing the host name on the lan page.
 

RMerlin

Asuswrt-Merlin dev
is there a way to set that to something? Meaning force avahi-daemon to stay on a particular name?
It will use the content of lan_hostname (which is why I asked you where you were setting your hostname). If that value is invalid, then it will use the productid variable as a fallback, which is typically the model name.

If avahi ends up using something else, then you'll have to study the avahi code to determine why it's not using the value provided by the config (like if it's invalid or there's a duplicate on your network).

I have no issue with it here, the two routers I currently have running both use my lan_hostname in their generated config file. Avahi browse also confirms the name:

Code:
[email protected]:~$ avahi-browse -a | grep Apple
+  ens33 IPv4 stargate88ax                                  Apple File Sharing   local
+  ens33 IPv4 stargate88ax                                  Apple TimeMachine    local
 
Last edited:

toaruScar

Regular Contributor
Yeah so after further research and if I run this command SSH in ps w | grep avahi-daemon.. This keeps changing after reboot with some random number added to it. Even though the host name is not changing. I can get it back to normal by either enabling / disabling time machine or changing the host name on the lan page.
If the PID of avahi keeps increasing, that means the process keeps crashing all the time. Maybe there's something wrong with the config.
 

ComputerSteve

Regular Contributor
If the PID of avahi keeps increasing, that means the process keeps crashing all the time. Maybe there's something wrong with the config.
it doesn't crash all the time its only after a reboot & there is no other device that has a similar name. I mean this is the only RT-AC86U on my network. I have RT-AC5300's as nodes. It doesn't matter what the name is after reboot the name changes, & I have to manually change it back, then it stays.
 

ComputerSteve

Regular Contributor
It will use the content of lan_hostname (which is why I asked you where you were setting your hostname). If that value is invalid, then it will use the productid variable as a fallback, which is typically the model name.

If avahi ends up using something else, then you'll have to study the avahi code to determine why it's not using the value provided by the config (like if it's invalid or there's a duplicate on your network).

I have no issue with it here, the two routers I currently have running both use my lan_hostname in their generated config file. Avahi browse also confirms the name:

Code:
[email protected]:~$ avahi-browse -a | grep Apple
+  ens33 IPv4 stargate88ax                                  Apple File Sharing   local
+  ens33 IPv4 stargate88ax                                  Apple TimeMachine    local
@RMerlin do I need to set a domain name ? Right now thats blank. I've always had that blank though for as long as i've been using your firmware. Also as I said I tried a random name like home-418router and every-time I rebooted it came back with some number added to it. The samba one is fine it always stays the correct name its the time machine one that keeps changing after reboot only.
 

ColinTaylor

Part of the Furniture
Next time it happens, before correcting it, SSH into the router and post the output of these commands:
Code:
cat /tmp/avahi/avahi-daemon.conf
nvram get lan_hostname
nvram get productid
 

john9527

Part of the Furniture
It's a bug in avahi-daemon, I think unique to IPv6, where avahi detects it's own probe as a duplicate hostname and adds a number suffix. There are a couple of fixes in release 0.8 (the router is on 0.7) which help, but I don't think it's completely fixed. @RMerlin, I've backported the fixes to my fork if you want to take a look (I had trouble with updating to 0.8 on MIPS)

I can't look it up right now, but if you do a google search there is a cache parameter in avahi-daemon.conf that you could set via a postconf custom script which some have posted as a workaround.
 

RMerlin

Asuswrt-Merlin dev
It's a bug in avahi-daemon, I think unique to IPv6, where avahi detects it's own probe as a duplicate hostname and adds a number suffix. There are a couple of fixes in release 0.8 (the router is on 0.7) which help, but I don't think it's completely fixed. @RMerlin, I've backported the fixes to my fork if you want to take a look (I had trouble with updating to 0.8 on MIPS)

I can't look it up right now, but if you do a google search there is a cache parameter in avahi-daemon.conf that you could set via a postconf custom script which some have posted as a workaround.
I'll see if updating to 0.8 is doable, otherwise I will investigate the backports.
 

ComputerSteve

Regular Contributor
I'll see if updating to 0.8 is doable, otherwise I will investigate the backports.
Ok when I run -
cat /tmp/avahi/avahi-daemon.conf

[Server]
host-name=AC86U-DEN-418
aliases=RT-AC86U
aliases_llmnr=RT-AC86U
use-ipv4=yes
use-ipv6=no
deny-interfaces=eth0
ratelimit-interval-usec=1000000
ratelimit-burst=1000

[publish]
publish-a-on-ipv6=no
publish-aaaa-on-ipv4=no

[wide-area]
enable-wide-area=yes

[rlimits]
rlimit-core=0
rlimit-data=4194304
rlimit-fsize=0
rlimit-nofile=768
rlimit-stack=4194304
rlimit-nproc=3

When I run - nvram get lan_hostname I get:
AC86U-DEN-418

When I run -
nvram get productid
I GET:
RT-AC86U

HOWERVER IF I RUN ps w | grep avahi-daemon
2991 nobody 3276 S avahi-daemon: running [AC86U-DEN-426.local] & THATS WRONG LOL SEE WHAT I'M SAYING !!
16230 Admin 5516 S grep avahi-daemon
 

ComputerSteve

Regular Contributor
I can fix the AC86U-DEN-426.local by enabling and re-enabling time machine in USB Applications then it corrects itself
UPDATE: I just did that & see now when I run ps w | grep avahi-daemon its correct & time machine is working again. However I have to do this after every reboot.
16906 nobody 3172 S avahi-daemon: running [AC86U-DEN-418.local]
17040 Admin 5516 S grep avahi-daemon
 

Jeffrey Young

Very Senior Member
I suppose as a work around, if you are on Merlin, is to put an entry in service-start to restart time machine (e.g service restart_timemachine). Maybe put in a 1 or 2 minute sleep time first to make sure it actually gets started, or get fancy and put in a timed loop checking for time machine running first - as you did above (ps w | grep avahi-daemon)
 

ComputerSteve

Regular Contributor
I’m a novice lol how would I do that at the beginning of reboot lol. Can you create it and I just copy and paste it into ssh lol
 

Jeffrey Young

Very Senior Member
Check out the instructions here;


The script is /jffs/scripts/services-start

Chances are, if you have other scripts already installed, you probably have the script already. You just need to add your code to the end of it.
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top