# named restart failure



## TheFoxz (Jul 23, 2022)

I tried to restart dns and I have this problem:
`named not running? (check /var/run/named/pid).
named already running?  (pid=7219).`


As you can see, I can't get it start.
Anybody knows how to fix this ??? Had the same problem?
Thanks


----------



## zirias@ (Jul 23, 2022)

Try issuing `service named stop` and a second later `service named start` manually. I've seen services fail a "restart" before, probably because of some race condition with the init script when the service takes its time to shut down in response to a `SIGTERM`.

If this doesn't help and you get a message about a running instance with pid like above, use ps(1) to verify this is _indeed_ an instance of the service in question, then send it a `SIGTERM` yourself (`kill <pid>`).

Wait a few seconds, check whether it exited, if not, force-kill it with `kill -9 <pid>`. (9 is `SIGKILL`, a signal that isn't even delivered to the process, it's just forcefully stopped...)


----------



## TheFoxz (Jul 23, 2022)

I tried with `service named stop` an there was no result but i found `rncd reload` and problem solved.


----------



## ralphbsz (Jul 23, 2022)

Well, "problem solved" may be an exaggeration. You may have "task accomplished", but problem still present.

I suspect that what you really wanted to do is to reload the configuration files, and that gets done with "rndc reload". But you still have a lingering problem: for some (unknown) reason, stopping and starting the current named server is not working. That might be a one-time confusion which goes away after the next reboot, or it might be a systemic problem that will come back to bite you. On my system, I would still debug the underlying reason it went wrong. A good starting point would be the steps Zirias suggested to kill the currently running instance, then verify that "service named start" and "service named stop" work a few times in a row.


----------



## mer (Jul 23, 2022)

Most of the time "service restart x" does "service stop x && sleep 1 && service start x".  Conveinent?  Sure.  But I've always preferred to "service stop x" && manually make sure it stopped correctly && "service start x".   Basically "just another me too on what Zirias and ralphbsz are saying"


----------



## SirDice (Jul 26, 2022)

It may have lost track of the PID file, that sometimes happens, especially after updates. Just `service named stop`, then verify with ps(1) all named processes are indeed stopped. Kill the processes that might be left. Then start the service again, `service named start`.

You can get in a similar situation if you start the service; `service named start`, then remove that /var/run/named/pid file. The rc(8) script simply checks this file to see if it's running or not. If the PID file isn't there it's assumed the service isn't running (but it could very well still be running). 

Some services write their own PID file and some services are started through daemon(8) which creates/writes the PID file for that service.


----------

