After pgrading to 23.11 Adguard Home will not start and I can't change the Nameservers on the box

I have a Nixos server that among other things runs Adguard Home, just DNS, no DHCP. I also have it setup with it nameservers being 127.0.0.1. Below is what I think are the relevant part of the config:

  # Enable networking.
  networking.hostName = "auir";
  networking.nameservers = [ "127.0.0.1" ];


 # Enable Adguard Home and set bassic settigns
  services.adguardhome = {
    enable = true;
    settings = {
      bind_host = "127.0.0.1";
      bind_port = 3000;
      dns = {
        bind_hosts = [ "127.0.0.1" "192.168.50.20" ];
        upstream_dns = [ "64.59.135.135" "64.59.128.112" ];
        all_servers = true;
        bootstrap_dns = [ "64.59.135.135" "64.59.128.112" ];
        rewrites = [
          {
            domain = "*.mydomain.com";
            answer = "192.168.50.20";
          }
          {
            domain = "mydomain.com";
            answer = "192.168.50.20";
          }
       ];
      };
    };
  };

I am in the process of upgrade it from 23.05 to 23.11 and running into some issues. I used the following step to take the upgrade:

sudo nix-channel --add https://channels.nixos.org/nixos-23.11 nixos
sudo nixos-rebuild boot --upgrade
sudo shutdown -r now

Everything seem to work correctly, however after the upgrade Adguard Home will not start:

sudo systemctl status adguardhome.service
● adguardhome.service - AdGuard Home: Network-level blocker
     Loaded: loaded (/etc/systemd/system/adguardhome.service; enabled; preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Thu 2023-11-30 15:31:38 MST; 2s ago
    Process: 110266 ExecStartPre=/nix/store/fw97wkhd53cl2phgw5h27qc0i3yj92ss-unit-script-adguardhome-pre-start/bin/adguardhome-pre-start (code=exited, status=0/SUCCESS)
    Process: 110270 ExecStart=/nix/store/idf1g0533i94jwzy6k0l7d85fkz6j61s-adguardhome-0.107.36/bin/adguardhome --no-check-update --pidfile /run/AdGuardHome/AdGuardHome.pid --work-dir /var/lib/AdGuardHome/ --config /var/lib/AdGuardHome/AdGuardHome.yaml (code=exited, stat>
   Main PID: 110270 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
        CPU: 92ms

Nov 30 15:31:38 auir systemd[1]: adguardhome.service: Main process exited, code=exited, status=1/FAILURE
Nov 30 15:31:38 auir systemd[1]: adguardhome.service: Failed with result 'exit-code'.
Nov 30 15:31:38 auir systemd[1]: adguardhome.service: Triggering OnFailure= dependencies.

I am not sure why it will not start, but one thing that is limiting my troubleshooting, I now don’t have DNS on this machine. I have tried changing my /etc/nixos/configuration.nix to uses a different nameserver, but when I do a sudo nixos-rebuild switch I get Couldn’t resolve host name errors.

How would I change my nameserver in the live system, so I can get sudo nixos-rebuild switch to work? Also, if anyone has any idea why Adguard Home is not working, please share.

Thank you

It has taken me some time to get back to this, but I think I got it solved.

First, I edited /etc/resolv.conf changing the nameserver to something different (1.1.1.1) and then restart network-interfaces.target. This got DNS working, and I was able to do a sudo nixos-rebuild --upgrade switch with an updated configuration.nix that specified a different nameserver.

As for why Adguard Home was not after the upgrade, I am not sure what the issue was. I was able to get it working again by:

  1. Disabling AdGuard in my config (services.adguardhome.enable = false),
  2. Doing an sudo nixos-rebuild --upgrade switch,
  3. Deleting the AdGuard files (sudo rm -r /var/lib/private/AdGuardHome),
  4. Enabling AdGuard in my config (services.adguardhome.enable = true),
  5. Doing an sudo nixos-rebuild --upgrade switch.

Cheers