How to Enable Network Connectivity in Ubuntu Recovery Mode When Upgrade Fails


2 views

After a failed Ubuntu upgrade (especially between major versions like Hardy to Intrepid), recovery mode often becomes the only accessible environment. The key symptom is seeing only the loopback interface (lo) without your primary network interface (eth0 or equivalent) in ifconfig output.

First check if the interface exists but is down:

ifconfig -a

If you see eth0 (or your interface name) in the output but without an IP address, try:

ifconfig eth0 up
dhclient eth0

When standard DHCP fails, you might need to manually configure networking:

ifconfig eth0 192.168.1.100 netmask 255.255.255.0
route add default gw 192.168.1.1
echo "nameserver 8.8.8.8" > /etc/resolv.conf

Examine network service status and logs:

service networking status
journalctl -u networking.service

Once you regain network access, these commands can help complete the interrupted upgrade:

apt-get update
apt-get install -f
dpkg --configure -a
apt-get dist-upgrade

Check and modify these critical files if needed:

/etc/network/interfaces
/etc/resolv.conf
/etc/hosts

For wireless interfaces in recovery mode, additional steps like loading firmware might be required:

modprobe -r ath9k
modprobe ath9k

When booting into Ubuntu's recovery mode, you'll notice the system loads minimal services by default for troubleshooting purposes. This includes disabling network interfaces, which explains why ifconfig only shows the loopback interface (lo) but not your Ethernet (eth0 or similar).

The most straightforward method is to manually bring up the interface:

ifconfig eth0 up
dhclient eth0

For newer Ubuntu versions using netplan:

netplan apply

If NetworkManager is installed (common in desktop versions), you can try:

service network-manager start
nmcli dev connect eth0

Check connection status with:

nmcli device status

To ensure networking stays enabled during recovery operations, edit the recovery menu entry:

nano /etc/default/grub

Add net.ifnames=0 to GRUB_CMDLINE_LINUX, then update grub:

update-grub

After enabling networking, verify with:

ping -c 4 google.com
curl ifconfig.me
ip addr show