Ubuntu – Why doesn’t network-manager start at boot


I think this started happening a couple of months ago when I upgraded from 10.04 to 12.04.

Whenever I reboot, network-manager does not start. I have to manually run sudo start network-manager, and then everything works fine.

Things I have already tried (rebooting after each attempted fix):

  • Verified that all of the /etc/rc*.d/*network-manager links exist the way they should.
  • Since network-manager's upstart config file mentions local-filesystems, and my fstab had a reference to a USB HDD that is not connected, I commented that line out of the fstab.
  • sudo dpkg-reconfigure network-manager and then sudo apt-get install --reinstall network-manager
  • Looked in syslog for hints, didn't see anything that jumped out.

I don't think I've modified /etc/init/network-manager.conf, but here it is for reference:

# network-manager - network connection manager
# The Network Manager daemon manages the system's network connections,
# automatically switching between the best available.

description "network connection manager"

start on (local-filesystems
      and started dbus
      and static-network-up)
stop on stopping dbus

expect fork

    # set $LANG so that messages appearing on the GUI will be translated. See LP: 875017
    if [ -r /etc/default/locale ]; then
        . /etc/default/locale

    exec NetworkManager
end script

Best Answer

The 'start on' section lets you know which events need to be emitted before upstart will start network-manager.

In this case it's:

  • local-filesystems
  • dbus
  • static-network-up

Odds are the first two have already been emitted if you have booted to a desktop.

static-network-up is emitted by the /etc/network/if-up.d/upstart script, crucially, the event will not be emitted unless every interface configured as 'auto' in /etc/network/interfaces is up.

In my case I had a left over entry for eth0 in /etc/network/interfaces which was configured to use DHCP, but since there was no ethernet plugged into eth0 DHCP could never succeed.

You can tell upstart to emit events and can use this to check if it is the static-network-up event that's missing.

  • Reboot your computer and don't start network-manager
  • man initctl (you need to run the emit command with sudo so it's no harm to run man initctl to verify commands posted on the internet first)
  • sudo initctl emit static-network-up (you might need to Ctrl+C this after a while)
  • initctl status network-manager (to check if it started)

If this solves your problem check /etc/network/interfaces, comment out everything other than:

auto lo
iface lo inet loopback

Then reboot and hopefully network-manager will start as expected.

Related Question