# \[BUG\] migrate\_conf\_to\_ubuntu\_26.04.sh: Bind section breaks named when orphaned named.conf.default-zones exists (duplicate zone ".")

**URL:** <https://forum.hestiacp.com/t/bug-migrate-conf-to-ubuntu-26-04-sh-bind-section-breaks-named-when-orphaned-named-conf-default-zones-exists-duplicate-zone/22355>\
**Category:** System\
**Created:** [October 25, 2026, 6:53am UTC](https://forum.hestiacp.com/t/bug-migrate-conf-to-ubuntu-26-04-sh-bind-section-breaks-named-when-orphaned-named-conf-default-zones-exists-duplicate-zone/22355 "2026-10-25T06:53:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrmina](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/chrmina/32/8803_2.png) [@chrmina](https://forum.hestiacp.com/u/chrmina)\
**Post date:** [October 25, 2026, 6:53am UTC](https://forum.hestiacp.com/t/bug-migrate-conf-to-ubuntu-26-04-sh-bind-section-breaks-named-when-orphaned-named-conf-default-zones-exists-duplicate-zone/22355/1 "2026-10-25T06:53:59Z")

</div>

Hi all,

This is a follow-up to my earlier report ([[SOLVED] File Manager “Unknown error” after Ubuntu 26.04 upgrade — “No compatible key exchange algorithms found”](https://forum.hestiacp.com/t/solved-file-manager-unknown-error-after-ubuntu-26-04-upgrade-no-compatible-key-exchange-algorithms-found-bundled-phpseclib-vs-new-openssh/22353)) — same server, same upgrade. The official migration script (`/usr/local/hestia/install/upgrade/manual/migrate_conf_to_ubuntu_26.04.sh`) fixed the File Manager as documented, but **its Bind section broke named** , and I believe the guard logic has a gap worth reporting.

## What happened

After running the script, `bind9` fails to start:

```auto
$ sudo named-checkconf
/etc/bind/named.conf.default-zones:2: zone '.': already exists previous definition: /etc/bind/named.conf.root-hints:2

```

```auto
named[...]: loading configuration: failure
named[...]: exiting (due to fatal error)
systemd[1]: named.service: Failed with result 'exit-code'.

```

## Root cause

On systems upgraded from an older Ubuntu/Debian, the **unowned leftover** `/etc/bind/named.conf.default-zones` still exists on disk:

```auto
$ dpkg -S /etc/bind/named.conf.default-zones /etc/bind/named.conf.root-hints
dpkg-query: no path found matching pattern /etc/bind/named.conf.default-zones
bind9: /etc/bind/named.conf.root-hints

```

`named.conf.default-zones` is not owned by any package (the bind9 package ships `named.conf.root-hints` instead), but nothing deletes the old file during the OS upgrade.

The script’s two Bind edits have asymmetric guards:

```bash
# Edit 1 — only runs if the orphan file is GONE:
if [[! -f /etc/bind/named.conf.default-zones]] && grep -q "include.*named.conf.default-zones" ...

# Edit 2 — runs whenever root-hints exists:
if [[-f /etc/bind/named.conf.root-hints]] && ! grep -q 'include.*named.conf.root-hints' ...

```

On upgraded systems the orphan file still exists → Edit 1 is skipped (the `default-zones` include stays) → Edit 2 adds the `root-hints` include → both define `zone "."` → named refuses to start.

## Suggested fix

Make Edit 1 independent of file existence — remove the include whenever the _line_ is present (and ideally delete the unowned file too):

```bash
if grep -q "include.*named.conf.default-zones" /etc/bind/named.conf 2> /dev/null; then
        echo "[+] Removing the default-zones include from named.conf"
        sed -i "/^include.*named.conf.default-zones/d" /etc/bind/named.conf
        _bind_changed=true
fi

```

Alternatively, guard Edit 2 on Edit 1 having actually run (or on the `default-zones` include being absent), so the two can never coexist.

## Workaround (for anyone hitting this now)

```bash
# comment out or delete the default-zones include in /etc/bind/named.conf,
# then:
sudo named-checkconf
sudo systemctl reset-failed named
sudo systemctl start named

```

Note the `default-zones` include references zone files (`db.local`, `db.127`, …) that don’t exist on upgraded systems anyway, so removing it loses nothing — `named.conf.root-hints` (the package-owned file) provides the root hint zone and is the correct one to keep.

## Environment

- HestiaCP 1.10.5-1+ubuntu26.04
- Ubuntu 26.04 (aarch64), upgraded from 24.04
- bind9 package owns `named.conf.root-hints`; `named.conf.default-zones` is an untracked leftover

---

<div class="post-metadata">

**Author:** ![sahsanu](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/sahsanu/32/9318_2.png) [@sahsanu](https://forum.hestiacp.com/u/sahsanu)\
**Post date:** [October 25, 2026, 10:10am UTC](https://forum.hestiacp.com/t/bug-migrate-conf-to-ubuntu-26-04-sh-bind-section-breaks-named-when-orphaned-named-conf-default-zones-exists-duplicate-zone/22355/2 "2026-10-25T10:10:22Z")

</div>

In my tests, when upgrading from Debian 12 to 13 or Ubuntu 24.04 to 26.04, `named.conf.default-zones` was always removed, which is why I added the check for the file’s existence.

Anyway, I’ve created this PR to always remove the `default-zones` include from `named.conf`.

> <https://github.com/hestiacp/hestiacp/pull/5836>
>
> Remove the \`named.conf.default-zones\` include regardless of file existence in bo…th, Debian 13 and Ubuntu 26.04 migration scripts.
> 
> Forum post: https://forum.hestiacp.com/t/bug-migrate-conf-to-ubuntu-26-04-sh-bind-section-breaks-named-when-orphaned-named-conf-default-zones-exists-duplicate-zone/22355

---

<div class="post-metadata">

**Author:** ![chrmina](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/chrmina/32/8803_2.png) [@chrmina](https://forum.hestiacp.com/u/chrmina)\
**Post date:** [October 25, 2026, 1:18pm UTC](https://forum.hestiacp.com/t/bug-migrate-conf-to-ubuntu-26-04-sh-bind-section-breaks-named-when-orphaned-named-conf-default-zones-exists-duplicate-zone/22355/3 "2026-10-25T13:18:22Z")

</div>

Excellent, thank you!
