It's time for another fix, this time for wired / wireless network not working after resume from suspend. In Ubuntu, sometimes when resuming from sleep, the wired network doesn't work and I keep getting "disconnected" notifications. I've read that some users are having similar issue with the wireless connection but for me, it's always the Ethernet connection.
So here's a fix that has worked for me, under Ubuntu 12.10 (but it probably works with other Ubuntu versions as well as other Linux distributions).
Get the wired / wireless network to work after resume from suspend in Ubuntu
1. To fix the Ethernet / WiFi network not working after resume from suspend, firstly, you must find out the kernel module used by your network hardware. The article where I've found this fix suggests using the following command:
and then trying to figure out which module is the one used by your network interface. But that's not so easy to do, so here's an easier way. Firstly, install "lshw", a tool to list your computer hardware - in Ubuntu, install it using the following command:
sudo apt-get install lshw
Then, to list the network interfaces, use the following command:
sudo lshw -C network
The command output should look more or less like this:
*-network description: Wireless interface product: Centrino Wireless-N 1030 vendor: Intel Corporation physical id: 0 bus info: pci@0000:03:00.0 logical name: wlan0 version: 34 serial: 4c:85:93:2d:34:61 width: 64 bits clock: 33MHz capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless configuration: broadcast=yes driver=iwlwifi driverversion=3.5.0-22-generic firmware=126.96.36.199 latency=0 link=no multicast=yes wireless=IEEE 802.11bgn resources: irq:51 memory:f3b00000-f3b01fff *-network description: Ethernet interface product: RTL8111/8168B PCI Express Gigabit Ethernet controller vendor: Realtek Semiconductor Co., Ltd. physical id: 0 bus info: pci@0000:0a:00.0 logical name: eth0 version: 06 serial: 00:e0:3c:64:00:08 size: 100Mbit/s capacity: 1Gbit/s width: 64 bits clock: 33MHz capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl_nic/rtl8168e-2.fw ip=192.168.0.130 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s resources: irq:53 ioport:2000(size=256) memory:f3004000-f3004fff memory:f3000000-f3003fff
Depending on the network interface you're having problems with after resuming from suspend, look under "description: Wireless interface" (for WiFi obviously) or "description: Ethernet interface" (for wired network) and under "configuration" you should see the kernel module used by that interface, as "driver=", as you can see in the above example output (in bold). In my case, it's "r8169" (for RTL8111/8168B PCI Express Gigabit Ethernet controller).
2. The next step is to edit the /etc/pm/config.d/unload_modules file as root with a text editor:
gksu gedit /etc/pm/config.d/unload_modules
(the file may not exist in which case, an empty file will come up - that's ok)
And inside this file, paste the following line:
replacing "MODULE_NAME_FOUND_UNDER_STEP_1" with the Kernel module name for your network interface found under step 1, "r8169" in my case.
Then, save the file and that's it. Now even if the wireless / wired network wasn't working, if you set your computer to suspend, after resume the network should work.
Note: tested on Ubuntu 12.10 64bit with a Dell XPS 17 L702X with Ethernet not working after resume from suspend. Not tested with Wireless because it always works after resume from suspend for me.