3

I know that there are related questions with people asking, having trouble restarting their network in 14.04. However I would like to know if anyone has a more direct answer as to why we can't restart the networking services using the service command.

Or why service networking restart has now been replaced with the manual ifdown/ifup command?

Ex. ifdown eth0 && ifup eth0

muru
  • 197,895
  • 55
  • 485
  • 740
Spirit
  • 135
  • 2
  • 2
  • 8
  • Try sudo /etc/init.d/networking restart and if you are using desktop then please note that networking is not the default program to manage/configure your network, use network-manager instead. – heemayl Dec 13 '14 at 19:56
  • @heemayl that command is a no-op if Upstart is the init (which it is on Ubuntu). – muru Dec 13 '14 at 20:29
  • Right you are but ubuntu still supports sysV to some extent for compatibility issues..isn't that right? – heemayl Dec 13 '14 at 20:31
  • @heemayl it does, but specifically /etc/init.d/networking restart does not do anything if init is Upstart. (You can look through the script. It does exit 0 if init is Upstart.) – muru Dec 13 '14 at 20:56

1 Answers1

4

networking is simply not meant to be restarted or stopped on Ubuntu. The functionality simply isn't supported (and can't be supported as Jorge Castro notes). There are a lot of other services which depend on it. The ifup/ifdown command didn't replace service networking restart, since it has always been available. Bryan Gonzalez does a good job of explaining it:

Upstart is meant to be a complete replacement for Sysvinit. In the interest of backwards compatibility, the Upstart devs made some allowances so that people/packages still using sysvinit-style init scripts could continue to do so. The /etc/init.d/networking init script is written for sysvinit in such a way that calling it uses sysvinit methods and breaks dbus which is written for Upstart.

The solution here is to have the maintainer of the networking init script fix/rewrite it so that it is Upstart compatible. This may mean that the networking init script will lose compatibility with sysvinit, but they need to get over it. Sysvinit is deprecated/obsolete and too much effort is being wasted into maintaining it when the future is Upstart.

And later on:

The problem is that we have a method to perform this task that is tried and tested for many years.

And then:

This was a left-over deprecated functionality that though 'everyone knows no to use it' will cause damage if used. As you eloquently put it, this functionality no longer has any practical use, therefore it needed to be pruned.

There was a major bug which simply caused most of the GUI stack to go down, which has since been fixed.

To summarize:

  • If you're on a GUI, then you simple have no business touching networking, since network-manager handles the interfaces once they have been brought up. (And even then you don't need to restart it.)
  • If you're on CLI, the ifup/ifdown commands already provided the functionality.
muru
  • 197,895
  • 55
  • 485
  • 740
  • I found ifdown/ifup does not add routes back that were deleted the way 'service networking restart' would. And, network-manager is usually found only on GUI desktops, not headless servers. Also, according to many folks, Upstart is what is going to be obsoleted, as it's foothold in the Debian community may be slipping. – Andrew Feb 06 '15 at 22:43