I can assure you that “shutdown now -r” is not how you restart networking. That will restart you entire machine, which would lead to that fatal error message you’re seeing. As for the first method you mention that is hanging – are you sure the settings you have assigned networking are valid? Why are you restarting the network?
why? I am dealing with servers with several NIC’s and dozens of virtual IP’s
I realize restarting the client isn’t the ideal solution, but tried it to see if it would work. The interfaces file is fine, as all interfaces come up on reboot just fine.
Debian networking is somewhat complicated. The networking init script and networking upstart jobs don’t do what most expect. Those scripts and their underlying utilities only configure what they know about from the interfaces file. If you remove something, or assign an IP to another interface, it won’t deconfigure the previous configuration, it will only apply the newly provided configurations.
Example:
10.10.10.10 on eth0
Edit /etc/network/interfaces and remove 10.10.10.10 from eth0 and assign to eth1
Restart networking
The result is that you now have 10.10.10.10 on eth0 and eth1, because they don’t fully deconfigure the interface before applying the configuration of the interfaces file.
And it is not exactly straight forward to get it to completely deconfigure all interfaces and then reconfigure on start up.
Your other options are to use the ip command to do all of your work after modifying /etc/network/interfaces, but that could be complicated, without knowing exactly what changed in the interfaces file.
ansible -s -K -m service -a “name=networking state=restarted” testmachines , works for me as long as the ip im using to access the box has not changed (wheezy and pangolin).
Strangely enough, this is basically what I tried before attempting to put it into my playbook. I just tried again and waited about five minutes before determining that the interfaces were never going to come up. From the machine, I can ifup eth0 (the control interface) and ansible continues along happily. However, it doesn’t seem to bring the interfaces back up directly from ansible.