@@ -4079,17 +4079,32 @@ step_start_services() {
40794079 # ── 2. Verify NoizDNS tunnels actually started ──────────────────────────────
40804080 # If NoizDNS services failed (wrong binary, bad config, etc.), remove them
40814081 # so the DNS Router doesn't crash-loop trying to connect to dead backends.
4082- sleep 1
4082+ sleep 3
40834083 for noiz_tag in noiz1 noiz-ssh; do
40844084 if dnstm tunnel list 2> /dev/null | grep -q " tag=${noiz_tag} " ; then
40854085 if ! systemctl is-active --quiet " dnstm-${noiz_tag} .service" 2> /dev/null; then
4086- print_warn " NoizDNS tunnel ${noiz_tag} failed to start — removing to protect DNS Router"
4087- dnstm tunnel stop --tag " $noiz_tag " 2> /dev/null || true
4088- dnstm tunnel remove --tag " $noiz_tag " 2> /dev/null || true
4089- rm -f " /etc/systemd/system/dnstm-${noiz_tag} .service.d/10-noizdns-binary.conf" 2> /dev/null || true
4090- rmdir " /etc/systemd/system/dnstm-${noiz_tag} .service.d" 2> /dev/null || true
4091- systemctl daemon-reload 2> /dev/null || true
4092- print_info " Removed ${noiz_tag} — other tunnels will work normally"
4086+ # Retry — give it more time before removing
4087+ print_info " Waiting for ${noiz_tag} to start..."
4088+ sleep 5
4089+ systemctl restart " dnstm-${noiz_tag} .service" 2> /dev/null || true
4090+ sleep 3
4091+ if ! systemctl is-active --quiet " dnstm-${noiz_tag} .service" 2> /dev/null; then
4092+ print_warn " NoizDNS tunnel ${noiz_tag} failed to start — removing to protect DNS Router"
4093+ local noiz_log
4094+ noiz_log=$( journalctl -u " dnstm-${noiz_tag} .service" -n 5 --no-pager 2> /dev/null || true)
4095+ if [[ -n " $noiz_log " ]]; then
4096+ echo -e " ${DIM} Last log lines:${NC} "
4097+ echo " $noiz_log " | while IFS= read -r l; do echo -e " ${DIM}${l}${NC} " ; done
4098+ fi
4099+ dnstm tunnel stop --tag " $noiz_tag " 2> /dev/null || true
4100+ dnstm tunnel remove --tag " $noiz_tag " 2> /dev/null || true
4101+ rm -f " /etc/systemd/system/dnstm-${noiz_tag} .service.d/10-noizdns-binary.conf" 2> /dev/null || true
4102+ rmdir " /etc/systemd/system/dnstm-${noiz_tag} .service.d" 2> /dev/null || true
4103+ systemctl daemon-reload 2> /dev/null || true
4104+ print_info " Removed ${noiz_tag} — other tunnels will work normally"
4105+ else
4106+ print_ok " NoizDNS tunnel ${noiz_tag} started successfully (after retry)"
4107+ fi
40934108 fi
40944109 fi
40954110 done
@@ -5052,11 +5067,20 @@ do_add_domain() {
50525067 done
50535068
50545069 # Verify NoizDNS tunnels started — remove dead ones to protect router
5055- sleep 1
5070+ sleep 3
50565071 for _ntag in ${noiz_tag:- } ${noiz_ssh_tag:- } ; do
50575072 [[ -z " $_ntag " ]] && continue
50585073 if dnstm tunnel list 2> /dev/null | grep -q " tag=${_ntag} " ; then
50595074 if ! systemctl is-active --quiet " dnstm-${_ntag} .service" 2> /dev/null; then
5075+ # Retry — give it more time before removing
5076+ print_info " Waiting for ${_ntag} to start..."
5077+ sleep 5
5078+ systemctl restart " dnstm-${_ntag} .service" 2> /dev/null || true
5079+ sleep 3
5080+ if systemctl is-active --quiet " dnstm-${_ntag} .service" 2> /dev/null; then
5081+ print_ok " NoizDNS tunnel ${_ntag} started successfully (after retry)"
5082+ continue
5083+ fi
50605084 print_warn " NoizDNS tunnel ${_ntag} failed to start — removing to protect DNS Router"
50615085 dnstm tunnel stop --tag " $_ntag " 2> /dev/null || true
50625086 dnstm tunnel remove --tag " $_ntag " 2> /dev/null || true
0 commit comments