Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 431180

Summary: net-misc/networkmanager - /etc/init.d/NetworkManager zap should remove pid file
Product: Gentoo Linux Reporter: Ole Langbehn <neurolabs.de>
Component: Current packagesAssignee: Robert Piasek (RETIRED) <dagger>
Status: RESOLVED DUPLICATE    
Severity: normal CC: nirbheek, openrc, qiaomuf, tetromino
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Ole Langbehn 2012-08-13 07:47:22 UTC
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.
Comment 1 Ole Langbehn 2012-08-13 07:50:04 UTC
see also https://bugs.gentoo.org/show_bug.cgi?id=20530 <- similar bug for postgresql
Comment 2 Alexandre Rostovtsev (RETIRED) gentoo-dev 2012-08-13 17:37:55 UTC
> 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?
Comment 3 Ole Langbehn 2012-08-14 07:20:03 UTC
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
Comment 4 Alexandre Rostovtsev (RETIRED) gentoo-dev 2012-08-14 14:46:21 UTC
(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.
Comment 5 Ole Langbehn 2012-08-14 17:38:41 UTC
Sounds reasonable. Since I deleted the file, I can't provide any more input.
Comment 6 SpanKY gentoo-dev 2012-08-16 17:49:29 UTC

*** This bug has been marked as a duplicate of bug 231854 ***