Re: NetworkManager status during startup
- From: Ignaz Forster <ignaz forster muenchen de>
- To: Dan Williams <dcbw redhat com>
- Cc: networkmanager-list gnome org
- Subject: Re: NetworkManager status during startup
- Date: Wed, 12 Jun 2013 18:37:46 +0200
Am 11.06.2013 19:20, schrieb Dan Williams:
On Mon, 2013-06-10 at 18:31 +0200, Ignaz Forster wrote:
Hello,
during startup we have a few scripts that have to know if the system is
online or not. Therefore we wanted to use "nm-online -x" to detect the
state, however this fails quite unexpectedly: it seems NetworkManager
needs some time between returning and actually listening to requests. In
the meantime it will report the system as being offline.
Can you explain a bit more what you mean here? Do you mean that if you
run NetworkManager, and shortly thereafter, nm-online, that nm-online
will exit before a network connection has started?
Yes, basically that's the problem, but only when using the option '-x'.
Example: We have an init script that configures a client based on the
network state (offline / online). Because we want to avoid waiting for
the nm-online timeout in the offline case we are using the option -x.
However that doesn't work as expected: When NetworkManager forks and
returns to the command line the D-Bus interface is not necessarily
available yet, causing nm-online to report the system as being offline.
As an alternative I tried using the D-Bus interface instead
(dbus-send --system --dest=org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager org.freedesktop.NetworkManager.state).
In this case the value seems to be returned immediately after the D-Bus
interface initialization before NetworkManager even tried to configure a
connection. As a result also in this case the system is always reported
being offline.
In both cases NetworkManager didn't try to configure the connection yet,
but it seems we cannot see that. While it's technically correct that the
system is currently still offline, an answer like "I don't know" or
(preferably) waiting until NetworkManager knows would be more useful.
Stopping NetworkManager and calling
NetworkManager; nmcli dev
has the same effect and will result in the message "Error:
NetworkManager is not running."
Is this behavior intentional and / or are there any other ways to get
the current state without polling manually?
We could update nm-online with a new option to wait for NM to connect to
D-Bus (it would get the NameOwnerChanged signal from dbus), which would
be fairly trivial.
That makes sense, but I think that would only solve the first problem
when the D-Bus interface isn't registered yet, but not that the D-Bus
interface seems to immediately reports the system as offline instead of
connecting (though I'm not really familiar with D-Bus yet).
Thanks a lot,
Ignaz
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]