Making peace with Network Manager

Painless they say, automatically they say.  This is what the NetworkManager manual page describes the daemon.  I’d like to say annoying and intrusive and I know there are a lot of people out there that feel the same.  The program is used to set-up network connections and provides a system tray thingy for Gnome and for simple set-ups its great.

Sure, I got NetworkManager running on my laptop and we’re all friends over there.  It just works, it just works for my local network, wireless network and even 3G and VPNs work just like they should.  This is the environment where it was designed for and it shows.

What about on the server where I login using gdm?  We’ve had nothing but a world of pain there.  It used to be bad enough when it fiddled with /etc/resolv.conf meaning DNS stopped working everytime i logged out.  Every “stop playing around with my settings and leave me alone” option fails to do just that.  It got so bad I had to use chattr to make the file immutable; so if you are tearing your hair out, then chattr +i /etc/resolv.conf is your friend.

The latest version of NetworkManager takes this insanity to a new level.  Now not content with messing around with my resolver files, it reconfigures my statically assigned IP address to a dynamic DNS one AND removes it when I logout. No doubt if it let it, it would muck around with resolver files too.  Again, by default on a laptop this is fine.  The problem is the ‘would you leave me alone’ options fail to work, or mean stupid things happen like pidgin doesnt think there is a network so never logs in.

So I resorted to reading more about this intrusive program and was there a way of stopping it doing what it was doing.  The directory /etc/NetworkManager/system-connections looked promising as they were connections available at boot time and across all users.  But then there is the funky format and wow, nothing saying what you might need versus what if you have missing makes the thing fail.

What’s not obvious is that if you edit your network connections and then select ‘available to all users’ then your settings go into that system-connections directory and that for the moment appears to be working.  It means I have my network settings configured in two places which means all sorts of fun if I change them and forget about the other.

This isn’t an ideal situation and network manager should start to behave properly and read the ifupdown stuff and use it but not muck around with settings if it is told to.  There are options that imply they do this but they don’t work.  Despite the title, I don’t think peace has broken out between me and Network Manager but rather an uneasy truce; I’m sure that program is just sitting there thinking of what other settings it could play with when my back is turned.

Enhanced by Zemanta

Comments

14 responses to “Making peace with Network Manager”

  1. There is no peace to be made with NetworkManager; it needs to be nuked from orbit.

  2. if you set managed=true in /etc/NetworkManager/NetworkManager.conf network manager will add your settings from /etc/network/interfaces and stop overwriting /etc/resolv.conf

  3. you’re faulting network manager when you’re using local gdm on a server? maybe the server task should sidestep all the local X stuff instead?

  4. Uninstall NetworkManager on your server. I had some server/workstations just like your setup, and upgraded them to squeeze, and NetworkManager got pulled in and took over the networking, causing the problems you describe. Uninstalling NetworkManager was the easy solution. I really wish NetworkManager hadn’t been pulled in in the first place. Debian probably needs to make NetworkManager be part of the laptop task, and not make it a dependency of the gnome metapackages. That would solve the problem nicely.

  5. but on a server, where your network configuration is static – why would you need a network manager instead of a static setup?

    with respect to “annoying and intrusive” I’d say I’m one of those who feel the same but instead of flaming against nm lets find some solutions:

    indeed we (pyneo.org) had the same issues with nm and /etc/resolv.conf. it is just too simple to break nm when something unforseen/unusual happens, resulting into the system being left with a messed up /etc/resolv.conf.

    to solve this /etc/resolv.conf issue we also used chattr +i but with a resolv.conf that points to 127.0.0.1 using a resolvconf/dhcpd5/dnsmasq setup. read more about it here: http://pyneo.org/documentation/network/

    another interesting bit I found recently is connman. there is a lot of flame going on between nm and connman with respect to nm fails and bloat and connmans NIH syndrome but after two weeks of using it on a tablet with constantly changing usb-ethernet, wlan, gprs, bluetooth, vpnc network connections I got some very positive impressions of how it manages to handle all these changes without breaking the configuration or messing up settings (as i was used to from nm). indeed, as the dhcpd5 setup it uses its own local nameserver and leaves /etc/resolv.conf at 127.0.0.1

  6. From the network-manager package description:
    “It is intended only for the desktop use-case, and is not intended for
    usage on servers.”
    You obviously have not read this description, but only the man page, where this is not stated clearly.

  7. Jesus Christ Avatar
    Jesus Christ

    Have you posted a bug report on that?

  8. I don’t understand why you have Network Manager installed on a server and still expect it to work differently from on your laptop. As you said yourself:


    Sure, I got NetworkManager running on my laptop and we’re all friends over there. It just works, it just works for my local network, wireless network and even 3G and VPNs work just like they should. This is the environment where it was designed for and it shows.

  9. The latest version of NetworkManager works quite well. By default on Ubuntu, connections are system-wide which means once you’ve conncected once, your computer will automatically connect to the network at startup even if you don’t bother logging into gdm right away and it won’t rudely disconnect if you don’t log in right away. Previously, I had tried connecting wirelessly from the command line but I couldn’t ever figure out the correct syntax so this is a big improvement.

    If system connections aren’t default for you, just make sure the “Available to all users” box is checked.

  10. Thanks for all the interesting comments. It seems not everyone loves network manager either.

    The computer could be describe as either a server with desktop software or a desktop with server software, real servers probably don’t run GUIs but what I’ve got is far from rare.

    The network-manager gets pulled in by one of the Gnome packages. Previously you couldn’t remove it without a whole lot of other things going too. That looks like it has been fixed.

    The config lines around the managed etc, do not work. I thought that would solve the problems I was having but they still leave the system in a broken state. Either things still get overwriten or other programs (pidgin for example) believe there is no network and go no further. i even tried it the other way (false versus true) to see if that helped.

    It really needs a ‘readonly’ or, if you prefer a ‘dont frig with my network interfaces’ option.

  11. Michael Goetze Avatar
    Michael Goetze

    Even if network-manager gets installed due to dependencies, that doesn’t mean you need to actually run it!

    As for resolv.conf, n-m should play nicely with the resolvconf package, so just install that and put all your essential configuration in /etc/resolvconf/resolv.conf.d/head or something like that.

  12. So, what you’re saying is that two different network connection managers (ifupdown and NM) don’t cope with each other very well. And the solution you propose is… more interaction between the two! Yay for more obscure bugs.

    Guess what: NM can read the ifupdown configuration, with managed=true. But there are good reasons why this isn’t the default; try it for a few days and you will understand.

    The solution to such issues is not to mix together two incomplete implementations of a network stack. It is to pick one of them and to get it to work correctly, then ditch the other.
    Said otherwise: disable all your interfaces in ifupdown except for lo, configure them with NM only, enjoy.

  13. Chris Knadle Avatar
    Chris Knadle

    I lived with NetworkManager for a while, and even on a laptop I did NOT enjoy it. The problem I repeatedly had was that it broke on upgrades on Debian Unstable — and the problem is that when NetworkManager breaks, it isn’t easy to figure out how to fix it. I also never found a command line interface for NetworkManager, and came to the conclusion that the tool had a design that was too complicated for my liking.

    So I searched for another tool via ‘apt-cache search’ and found ‘wicd’. It’s client-server, so there are several front-ends available — a GTK one, a Qt one, and an ncurses one. And I have to say, it’s really nice to be able to easily set up wireless networking from the command line when you want. And so far, it hasn’t broken even once on upgrades in Debian Unstable, either, and I’ve been using it for at least two years. Using it has not only been a relief, it’s been a pleasure.

    Now all of that said, I agree that running NetworkManager on a server is not something I’d want to try — but I can understand how it could be frustrating having to fight with the system to keep the package off. I suggest removing NetworkManager and using ‘equivs’ to make a fake package that sets the Debian control file such that it shows it “Breaks” NetworkManager, so that you can avoid it being installed again when you go to do upgrades.

    1. @Chris Knadle:

      “I also never found a command line interface for NetworkManager”

      How hard did you look?

      See:
      http://vidner.net/martin/software/cnetworkmanager

Leave a Reply

Your email address will not be published. Required fields are marked *