[lang]

Present Perfect

Personal
Projects
Packages
Patches
Presents
Linux

Picture Gallery
Present Perfect

NetworkManager for server-type machines?

Filed under: General — Thomas @ 22:47

2010-04-07
22:47

Fedora comes with NetworkManager enabled out of the box. AFAICT it starts the network as part of a service script in init.d, then later on after logging in it reconnects as a user. At least, that's what it looks like to me.

The problem is, I just came home, and for some reason the media server was down. The media server also has the primary of my new DRBD setup, and bringing the machine back up didn't bring back the DRBD sync.

Digging deeper into /var/log/messages, it turned out the network wasn't active when drbd got started, and so it failed to connect to the peer.

Obviously, if this machine reboots I want drbd to Just Work.

NetworkManager's init script is S27, drbd is S70, I would have expected the network to be up by the time drbd kicks in. It looks like this wasn't the case. And I can foresee situations where NetworkManager re-connecting after my (automatic) user login not helping either if anything in the background is trying to connect to the network.

What should I be doing instead on a machine like this ? Remove NetworkManager entirely ? Is that even still possible today ? How do you set it up?

14 Comments »

  1. I think the better solution would be to fix NetworkManager. I mean: you can set up a connection to be available system-wide, and you can set it to auto-connect if it is available, too. If both conditions are met, NetworkManager *should* connect *before* a user logs in; the daemon is up, and it can read the config. That’s what I’d expect, also because things like unattended-upgrades on Ubuntu or others expect the network to be up and running. It’s also a mess if you want simply to fix something on console (not logging via gdm, say you screwed your xorg.conf or you seek for an upgraded xserver-xorg-core package), and your only connection is via a wi-fi network you don’t remind the 128-bit hex password by heart (but networkmanager does).

    I had a look at some bug reports around at b.g.o, and some comment suggested it did work like that at some point in time. However, I’ve lost track of when, and why it has changed.

    Comment by Matteo Settenvini — 2010-04-07 @ 23:06

  2. Just disable NetworkManager service and start the network service, Fedora NetworkManager has a plugin to save the same files the old network service uses for system manager network devices “Available to all users option)

    Comment by Robert Marcano — 2010-04-07 @ 23:10

  3. disable NetworkManager in chkconfig, and enable network:

    $ /sbin/chkconfig NetworkManager off
    $ /sbin/chkconfig network on

    then configure networking in /etc/sysconfig/network, /etc/sysconfig/network-scripts/ifcfg-, and reboot.

    NetworkManager is not worth the hassle on a server box, especially one with an essentially static configuration.

    Comment by Michael Frank — 2010-04-07 @ 23:12

  4. On desktop machines that need a permanent connection (for kerberos auth) I normally turn NM off completely. I’ve not looked into removing it.

    Disable NetworkManager, enable network (warning, the machine goes offline doing this: don’t do it remotely)

    chkconfig NetworkManager off
    service NetworkManager stop

    chkconfig network on
    service network start

    Then use

    setup

    and input your IP/netmask/gateway settings, and your DNS settings.

    Finally, open

    /etc/sysconfig/network-scripts/ifcfg-eth0 (or whatever)

    and remove “PEERDNS” and “NM_CONTROLLED” if you have them (or set them to “no”). You could do the same with system-config-network IIRC via GUI.

    You should now be able to do a network restart, or even a reboot, and the machine will not use NM at all.

    Comment by Renato Ramonda — 2010-04-07 @ 23:15

  5. NetworkManager brings the network up asynchronously, so you can’t guarantee that it’ll have completed if you’re just using traditional init scripts. Try starting drbd from a dispatcher script in /etc/NetworkManager/dispatcher.d – that’ll start it when the network comes up.

    Comment by Matthew Garrett — 2010-04-07 @ 23:16

  6. NM recognises two types of connection – system, and user. System connections, it should be able to bring up on boot, since no user info is needed.

    Once logged in, the NM UI has a dialog for editing connections. You might need to go into that, select the relevant connection, and check an option that’s called something like “make this connection available for all users”.

    If that fails, try the NM mailing list – I’ve always found them pretty helpful…

    Comment by Simon — 2010-04-07 @ 23:22

  7. I thought the NM on boot was planned for the Fedora 13 release. At least it never worked for me so far.

    Up until Fedora 12 I just used the normal network scripts. They work the same as always. Just chkconfig disable NM and enable network and make sure that all the ifcfg are in place.

    But as Simon said: it should work in NM, maybe you have to try a newer version.

    Comment by Christof — 2010-04-07 @ 23:30

  8. […] Thomas: first, you can use NM on simple servers, or you can revert to the ‘network’ service.  But there shouldn’t be anything preventing you from using NM on a server.  We’ve tried hard to expand NM’s capabilities in that direction while still retaining the ease-of-use everyone is accustomed to. […]

    Pingback by NetworkManager on Server-Type Machines (or, why our initscripts suck) « Dan Williams’ blog — 2010-04-08 @ 00:06

  9. NM system (i.e on-boot) connections have been working for a while now, so Fedora should have a working version…

    Comment by Simon — 2010-04-08 @ 00:09

  10. By default, regardless of connection type, NetworkManager will not wait for the network to fully come up before considering the service “started”. This is a change from the old traditional “network” script. Usually this is OK, but in scenarios where your service will give up if there isn’t network immediately, you’ll need to modify your network scripts so that NetworkManager will delay completion of it’s “startup” until the network is fully up.

    NETWORKWAIT=true should be set in /etc/sysconfig/network to get this delay.

    Comment by Jesse Keating — 2010-04-08 @ 00:16

  11. I prefer not to use NM on headless systems (or server systems in general). On F12, you can have a system with no NetworkManager-* packages installed; even NetworkManager-glib can be avoided if you don’t pull in PackageKit. Just be sure to manually enable the ‘network’ service and make sure your ifcfg-* scripts are good.

    Comment by Aron — 2010-04-08 @ 00:56

  12. Oh, and I see Dan Williams has posted a reply on his blog…

    http://blogs.gnome.org/dcbw/2010/04/07/networkmanager-on-server-type-machines-or-why-our-initscripts-suck/

    Comment by Simon — 2010-04-08 @ 01:18

  13. Wow, I did look at the answer … and this is so complicated ! I don’t understand why we are again reinventing the wheel ! Dropping a dispatcher file in /etc/NetworkManager/dispatcher.d … Yet Another File/Layer to create …

    LSB daemon spec do support this from start by using service dependencies mecanism. Under this is the way things are handled :
    – network-up do provide $network. This service allow to wait for an network connection which is up
    – network dependent services just require $network

    So in drdb service init file, there’s just the need to ensure that you have the following :
    Required-Start : $network

    http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html

    Even the $network is defined in the LSB spec :
    http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/facilname.html

    Comment by FACORAT Fabrice — 2010-04-08 @ 07:48

  14. I have had similar problems with Debian computers with a wired connections. The network works fine, but the network manager doesn’t discover it. Stuff like this should work out of the box without forcing me to edit some text file.

    At least the gnome gui could provide me with a gconf option saying “Whatever happens, pretend that I have a working network”. Epiphany allows me to do this, but I would like the decission to be gnome-wide.

    Comment by Bob — 2010-04-08 @ 08:30

RSS feed for comments on this post. TrackBack URL

Leave a comment

picture