Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Problem

Ubuntu 9.10 Desktop Edition (and possibly previous versions as well, I haven't tested them) has no network connections after boot until at least 1 user logs in. This means any services that require networking (e.g. openssh-server) are not available until someone logs in locally either via gdm, kdm, or a TTY.

Background

Ubuntu 9.10 Desktop Edition uses the NetworkManager service to take commands from the nm-applet in Gnome (or its equivalent in KDE). As I understand it, while NetworkManager is running at boot, it is not issued any commands to connect until you login for the first time because nm-applet isn't running until you login and your Gnome session starts (or similar for KDE). I'm not sure what prompts NetworkManager to connect to the network when you login via a TTY.

There are several relevant variables involved in starting up the network connections including:

  • Wired vs Wireless (and the resulting drivers, SSID, passwords, and priorities)
  • Static vs DHCP
  • Multiple interfaces

Constraints

  • Support Ubuntu 9.10 Karmic Koala (bonus points for additional supported versions)
  • Support wired eth0 interface
  • Receive an IP address via DHCP
  • Receive DNS information via DHCP (obviously the DHCP server must provide this information)
  • Enable networking at the proper time (e.g. some time after file systems are loaded but before network services like ssh start)
  • Switching distros or versions (e.g. to Server Edition) is not an acceptable solution
  • Switching to a Static IP configuration is not an acceptable solution

Question

  • How to start networking on a wired interface before logon in Ubuntu Desktop Edition?

See-Also

References

share|improve this question
    
Nice post. Very thorough... Thanks. –  nicorellius Apr 2 '10 at 17:01
add comment

2 Answers

up vote 9 down vote accepted

To have your network interface automatically configured via DHCP on boot, add the following lines to /etc/network/interfaces:

auto eth0
iface eth0 inet dhcp

This should bring your interface up even without NetworkManager running. You can even remove the package network-manager, if you will.

share|improve this answer
    
Ahh, that was just a typo when I made the question, but that is what I have tried. That said, doing /etc/init.d/networking restart gives: "* Reconfiguring network interfaces..." but the interface is not brought up, much less get an IP. Doing a reboot does not bring up the interface either with these settings. –  Burly Apr 2 '10 at 15:00
    
I suppose the: auth eth0 instead of: auto eth0 in your post is still a typo you've done only in the post, right? –  goedson Apr 6 '10 at 11:13
    
I've just did a fresh install of Ubuntu 9.10, edited /etc/network/interfaces as noted above, and issuing sudo /etc/init.d/networking restart did get eth0 up and configured via DHCP. –  goedson Apr 6 '10 at 11:45
    
Oh my, Mega-fail! :facepalm: I didn't have the original typo you mentioned, but I DO have the 'auth' instead of 'auto' on the first line. I believe you have to modify your answer in order for me to change my vote because it's been too long (wth?). I've removed the "What I've Tried" section from the question to avoid confusion since I typo'd hard. Perhaps add something like: "Add the following into /etc/network/interfaces to prevent NetworkManager from managing the interface and bring it up via dhcp" I have to check and see if this fix will bring it up at boot with NM installed... –  Burly Apr 6 '10 at 18:40
    
I've changed the answer so it's clear what is the solution. –  goedson Apr 7 '10 at 11:02
show 1 more comment

Debian/Ubuntu has it's own program to manage servers at boot-time.

Try update-rc.d STARTUP-SCRIPT defaults

Search for the specific script for eth0, and enable it with this.

You could always make you're own script, place it in init.d and running the previous command will make it load at boot time.

or just put those commands(ifconfig up, dhcpcd) in /etc/rc.local (this file get's read everytime at boot-time)

share|improve this answer
    
I've used update-rc.d before but the problem is locating the STARTUP-SCRIPT specific for eth0. At least in Ubuntu 9.10 DE, there is none. There is just the /etc/init.d/networking script, which really is just calling an upstart job (/lib/init/update-job networking start is what it calls specifically). As noted above, calling /etc/init.d/networking start, /lib/init/update-job networking start, and/or service networking start/restart do not bring up the interface much less get an IP. I could write my own script, but I was hoping for a more elegant solution. –  Burly Apr 5 '10 at 17:34
    
Putting dhclient eth0 in rc.local may be my only option. I need to try this to see if it even works. The problem with putting it here is that other startup services can't really depend on it (like ssh) because rc.local isn't executed until after all system services have been started. –  Burly Apr 5 '10 at 17:35
1  
WORKAROUND: Adding dhclient eth0 to /etc/rc.local does properly bring up the eth0 interface on startup and get an IP via DHCP. At least for me, SSH is also available before anyone logs in locally now since openssh-server is set to start at runlevels 234. I don't know if All network enabled services will work successfully having the interface brought up in rc.local (e.g. ntpdate) however, because rc.local is run after system services. –  Burly Apr 5 '10 at 18:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.