GoAdmio

named

Restart BIND, or with no action reinstall BIND and rebuild the DNS zone of every hosted domain

On this page: Overview · Quick start · Syntax · Actions · Output · Examples · Troubleshooting · Details · See also


Overview

/go/named manages BIND, the DNS server that GoAdmio uses when this server is the nameserver for your domains. It has two modes:

If you are not root, the command runs itself again through sudo.

[!WARNING] Only the word restart is recognized. Any other first argument, including a typo such as restrat or a word like status, runs the full reinstall and zone rebuild.

[!WARNING] The reinstall removes BIND before installing it again, so DNS for domains served by this server stops until the install finishes. If the install fails, for example because the server cannot reach the package repository, BIND stays removed. The reinstall also deletes and rebuilds each domain's saved zone data. See Zone data.


Quick start

# Restart BIND
/go/named restart

Syntax

/go/named restart     # restart BIND only
/go/named             # reinstall BIND and rebuild every zone

Actions

Action What it does
restart Reloads the service definitions and restarts BIND. Requires a nameserver setup.
(anything else, or no argument) Removes and reinstalls BIND, enables and restarts it, then rebuilds the zone of every hosted account.

The service is called named on AlmaLinux, Rocky, CentOS, Red Hat, and Fedora, and bind9 on Debian and Ubuntu. The command picks the right one.


Output

Message Meaning
Please Setup a Nameserver. restart was used, but the file /etc/nameservers does not exist. Nothing was restarted.
Package manager output The reinstall prints the normal output of dnf or apt-get.

Exit codes

Situation Exit code
restart, whether it worked or not Always 1
Reinstall The status of the last step

Do not rely on the exit code of restart. Every call is also appended to /var/log/go/named.log.


Examples

# Restart BIND
/go/named restart
# Back up the zone data first, then reinstall BIND and rebuild all zones
cp /var/lib/sqlite/zone.db /root/zone.db.bak
/go/named
# Check BIND afterwards (use "named" instead of "bind9" on AlmaLinux, Rocky, CentOS, Red Hat, and Fedora)
systemctl status bind9
dig @127.0.0.1 example.com

Troubleshooting

Symptom Likely cause Fix
Please Setup a Nameserver. /etc/nameservers does not exist. Set up the nameservers with nameservers, then run again.
restart returns exit code 1 It always does. Check the service with systemctl status.
The full reinstall ran when you meant to restart The first argument was not exactly restart. Use restart.
Domains stopped resolving BIND is stopped, being installed, or its install failed. Check systemctl status bind9 (or named), and run /go/named again once the server can reach the package repository.
BIND is missing after the command The install step failed after the removal. Install it by hand (dnf install bind bind-utils, or apt-get install bind9), then run /go/named.
Custom DNS records are gone The saved zone data was deleted and rebuilt. Restore your backup of /var/lib/sqlite/zone.db, then rebuild with zone.
Changes you made to BIND's own configuration are gone On RHEL-family systems, removing the package can move a modified /etc/named.conf aside as named.conf.rpmsave. Compare the two files and merge your changes back.
Nothing changed for domains that use Cloudflare DNS Their DNS is not served by this server's BIND. Use cloudflare or dns for those.

Details

Zone data

After BIND is installed, the command goes through every folder in /home that has a www folder. For each one it:

  1. deletes that domain's rows from the Zone table in /var/lib/sqlite/zone.db
  2. runs zone for the domain, which creates the zone file again and registers it with BIND

Records that were stored only in the Zone table are therefore lost unless zone creates them again. Check the zone page, and back up zone.db first. The rebuild takes longer the more accounts the server has.

Reinstall steps by system

System Package steps
AlmaLinux, Rocky, CentOS, Red Hat, Fedora dnf remove bind bind-utils, dnf install bind bind-utils, enable and restart named
Debian, Ubuntu apt-get remove bind9, apt-get install bind9, enable and restart bind9

The reinstall does not check for /etc/nameservers, so it installs BIND even on a server that has no nameserver setup.

What it does

flowchart TD
    A["named [action]"] --> B{"Action is restart?"}
    B -- "Yes" --> C{"/etc/nameservers exists?"}
    C -- "No" --> X["Print message, exit 1"]
    C -- "Yes" --> D["Restart BIND, exit 1"]
    B -- "No" --> E["Remove BIND"]
    E --> F["Install BIND, enable, restart"]
    F --> G["For each hosted domain"]
    G --> H["Delete its zone data, run zone"]
  1. If not running as root, runs itself again with sudo.
  2. Appends the command line to /var/log/go/named.log.
  3. Reads the operating system from /usr/local/goadmio/linux/os.db.
  4. With restart: checks that /etc/nameservers exists, reloads the service definitions, restarts named or bind9, and exits with status 1.
  5. Otherwise: removes the BIND packages, installs them again, enables the service, and restarts it.
  6. For every folder in /home that contains www: deletes the domain from the Zone table in /var/lib/sqlite/zone.db, then runs /go/zone <domain>.

See also

Command Description
zone Create, update, or delete a DNS zone file and register it with BIND
nameservers Change the nameservers for a GoAdmio server
dns Add one or all hosted domains to Cloudflare and set up their DNS zone
resolver Change the DNS resolver in GoAdmio
reversedns Check reverse DNS (rDNS) in GoAdmio
mx Add an MX record to a domain through Cloudflare