If NetworkManager does not shut down properly the file /var/run/NetworkManager.pid is not removed. Running /etc/init.d/NetworkManager zap doesn't remove the pid file and thus running /etc/init.d/NetworkManager start (or restart) will fail. On removing /var/run/NetworkManager.pid manually, everything works fine again.
see also https://bugs.gentoo.org/show_bug.cgi?id=20530 <- similar bug for postgresql
> Running /etc/init.d/NetworkManager zap doesn't remove the pid file Correct. > thus running /etc/init.d/NetworkManager start (or restart) will fail That should not be the case. If you run "/etc/init.d/NetworkManager zap" and then "/etc/init.d/NetworkManager start", the old pid file is ignored and automatically overwritten. At least that is the behavior with networkmanager-0.9.4.0-r6 and openrc-0.10.5 What version of networkmanager and openrc are you using?
I'm using networkmanager 0.9.4.0-r5 and openrc 0.10.5. This is my shell session showing that the pid file blocked networkmanager startup: leo ~ # /etc/init.d/NetworkManager start * Starting NetworkManager ... * start-stop-daemon: /usr/sbin/NetworkManager is already running [ !! ] * ERROR: NetworkManager failed to start leo ~ # killall NetworkManager NetworkManager: no process found leo ~ # /etc/init.d/NetworkManager zap * Manually resetting NetworkManager to stopped state leo ~ # /etc/init.d/NetworkManager status * status: stopped leo ~ # /etc/init.d/NetworkManager start * Starting NetworkManager ... * start-stop-daemon: /usr/sbin/NetworkManager is already running [ !! ] * ERROR: NetworkManager failed to start leo ~ # rm /var/run/NetworkManager.pid leo ~ # /etc/init.d/NetworkManager start * Caching service dependencies ... [ ok ] * Starting NetworkManager ... [ ok ] Connecting............... 1s * Marking NetworkManager as inactive. It will automatically be marked * as started after a network connection has been established. * WARNING: NetworkManager has started, but is inactive
(In reply to comment #3) As far as I can see, the behavior you observed might happen in one case: if after NetworkManger died, another process was started with the same pid as what is recorded in /var/run/NetworkManager.pid However, this is a weakness that affects all the init.d scripts that use start-stop-daemon, not just networkmanager. Maybe start-stop-daemon's check for already running processes could be made more intelligent in some way? Adding openrc team to the CC list.
Sounds reasonable. Since I deleted the file, I can't provide any more input.
*** This bug has been marked as a duplicate of bug 231854 ***