<div>Hi folks,<br></div><div><br></div><div>i've installed Unbound from source in another folder, set the unbound.conf and try to start it.<br></div><div>But the start failed with "cannot open pidfile /test/unbound/unbound.pid : Permission denied".<br></div><div><br></div><div>The error only comes when i try to start unbound with "sudo systemctl start unbound".<br></div><div>If i cd to "/test/unbound" and start with "sudo sbin/unbound -d -vvvv", then all works.<br></div><div><br></div><div>The installation folder is owned by the user "test_unbound" and the content of unbound.conf is:<br></div><div>=========================================<br></div><div>server:<br></div><div>    auto-trust-anchor-file: "/test/unbound/root.key"<br></div><div>    chroot: "/test/unbound"<br></div><div>    directory: "/test/unbound"<br></div><div>    username: "test_unbound"<br></div><div>    logfile: "/test/unbound/log.log"<br></div><div>    pidfile: "/test/unbound/unbound.pid"<br></div><div>=========================================<br></div><div><br></div><div><br></div><div>And the unbound.service:<br></div><div>=========================================<br></div><div>[Unit]<br></div><div>Description=Unbound DNS Resolver<br></div><div>After=network-online.target<br></div><div>Before=nss-lookup.target<br></div><div>Wants=network-online.target nss-lookup.target<br></div><div><br></div><div>[Install]<br></div><div>WantedBy=multi-user.target<br></div><div><br></div><div>[Service]<br></div><div>ExecReload=+/bin/kill -HUP $MAINPID<br></div><div>ExecStartPre=+/test/unbound/sbin/unbound-anchor -a "/test/unbound/root.key" -c "/test/unbound/icannbundle.pem"<br></div><div>ExecStart=/test/unbound/sbin/unbound -d -vvvv<br></div><div><br></div><div>Type=notify<br></div><div>NotifyAccess=main<br></div><div>CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_SYS_RESOURCE CAP_NET_RAW<br></div><div><br></div><div>MemoryDenyWriteExecute=true<br></div><div><br></div><div>NoNewPrivileges=true<br></div><div>PrivateDevices=true<br></div><div>PrivateTmp=true<br></div><div>ProtectHome=true<br></div><div>ProtectClock=true<br></div><div>ProtectControlGroups=true<br></div><div>ProtectKernelLogs=true<br></div><div>ProtectKernelModules=true<br></div><div>ProtectKernelTunables=true<br></div><div>ProtectProc=invisible<br></div><div>ProtectSystem=strict<br></div><div><br></div><div>RuntimeDirectory=unbound<br></div><div>ConfigurationDirectory=unbound<br></div><div>StateDirectory=unbound<br></div><div><br></div><div>RestrictAdressFamilies=AF_INET AF_INET6 AF_NETLINK AF_UNIX<br></div><div>RestrictRealtime=true<br></div><div>SystemCallArchitectures=native<br></div><div>SystemCallFilter=~@clock @cpu-emulation @debug @keyring @module @mount @obsolete @resources<br></div><div>RestrictNamespaces=yes<br></div><div>LockPersonality=yes<br></div><div>RestrictSUIDSGID=yes<br></div><div>ReadWritePaths=/test/unbound /test/unbound<br></div><div><br></div><div>TemporaryFileSystem=/test/unbound/dev:ro<br></div><div>TemporaryFileSystem=/test/unbound/run:ro<br></div><div>BindReadOnlyPaths=-/run/systemd/notify:/test/unbound/run/systemd/notify<br></div><div>BindReadOnlyPaths=-/dev/urandom:/test/unbound/dev/urandom<br></div><div>BindPaths=-/dev/log:/test/unbound/dev/log<br></div><div>=========================================<br></div><div><br></div><div>My System:<br></div><div>Ubuntu 21.04<br></div><div>Unbound 1.14.0<br></div><div><br></div><div>Can anyone please tell me, where is the problem? THANKS!<br></div>