Upgrading DNClient Server
This guide describes how to upgrade an existing DNClient Server installation. Which steps apply depends on how you installed it.
Linux package installations
If you installed dnclient from a package, upgrade it the same way you upgrade anything else on the system. On APT and RPM, the package restarts the service for you.
- APT
- RPM
- Arch (AUR)
sudo apt-get update
sudo apt-get install --only-upgrade dnclient
dnclient -version # check your updated version!
sudo dnf upgrade dnclient
dnclient -version # check your updated version!
Rebuild the package with your AUR helper, which pulls the latest version. pacman does not restart services, so restart DNClient yourself, including any named instances:
yay -S dnclient
sudo systemctl try-restart 'dnclient.service' 'dnclient@*.service'
dnclient -version # check your updated version!
Standalone binary installations
For binary installations on Linux and macOS, download the updated DNClient version from https://admin.defined.net/downloads/, then:
sudo dnclient stop
sudo dnclient uninstall
cp ./dnclient $LOCATION_WHERE_YOU_INSTALLED_DNCLIENT/dnclient
chmod +x $LOCATION_WHERE_YOU_INSTALLED_DNCLIENT/dnclient
sudo dnclient install
sudo dnclient start
dnclient -version # check your updated version!
Windows
Run the installer MSI file and run the install step against the same directory you originally installed DNClient in. This will overwrite the previous installation and upgrade to the new one.
# check your updated version!
& 'C:\Program Files\Defined Networking\DNClient\dnclient.exe' -version
Moving from the standalone binary to a package
On Linux, you can switch a standalone binary installation to the package so that future upgrades come through your package manager. Your enrollment state lives in /var/lib/defined and is left in place, so the host stays enrolled and does not need a new enrollment code.
The standalone dnclient install writes its service unit to /etc/systemd/system/dnclient.service. The package ships its unit under /lib/systemd/system (/usr/lib/systemd/system on RPM and Arch), and a unit in /etc takes precedence. If you install the package without first removing the standalone unit, the old unit shadows the package's and your package upgrades stop affecting the running service.
Remove the standalone service and its binary before installing the package. dnclient uninstall removes only the unit, and a leftover binary in /usr/local/bin still comes ahead of the package's /usr/bin/dnclient on the default PATH. If you run named instances, stop and uninstall each of those with -name as well, and enable the package's dnclient@<name>.service in their place afterward.
sudo dnclient stop
sudo dnclient uninstall
sudo rm $(command -v dnclient)
Then follow the package install steps. Skip the enrollment step, since the host is already enrolled.
Moving Linux state to /var/lib/defined
DNClient 0.9.4 moved the Linux state directory from /etc/defined to /var/lib/defined. This migration is optional: a host that enrolled before 0.9.4 keeps working from /etc/defined, because DNClient falls back to the old directory when the new one holds no enrolled networks. However, it will log a warning until the migration is performed.
To move the state and clear the warning, stop DNClient and move the files. The move relocates every instance's state at once, so stop all named instances too, not just the one that logged the warning. Named instances run as dnclient@<name> on a package installation and dnclient.<name> on a standalone one.
sudo systemctl stop dnclient
sudo mkdir -p /var/lib/defined && sudo mv /etc/defined/* /var/lib/defined/ && sudo rmdir /etc/defined
For a package installation, that's the whole migration. Start the new service again with sudo systemctl start dnclient and you're done.
For standalone binary installation, re-create the service unit before starting it. An older dnclient install pinned -config /etc/defined into the unit, so moving the files without rewriting it would strand the service on the now-empty directory. dnclient install refuses to write over an existing unit, so uninstall first:
sudo dnclient uninstall
sudo dnclient install
sudo dnclient start
Repeat this for each named instance (ls -l /var/lib/defined), passing -name to every command. DNClient's startup warning lists the exact commands for the instances it finds.