Saturday, September 22, 2007

Getting Networking on Fedora 7 Working after Suspend/Resume

After recently updating my Fedora 7 installation, I was pleasantly surprised to find that suspend/resume now works on my ThinkPad T60. However, there was one problem: after resuming out of suspend, NetworkManager wouldn't see any of my network devices and thus couldn't connect to any network.

To fix this, I hacked my system to stop NetworkManager upon suspend and then start NetworkManger on resume. You can do this by editing the file

on x86_64 machines)

Edit the section that reads:

#RedHat/Fedora and SUSE support pm-utils
elif [ -f "/etc/redhat-release" ] || [ -f "/etc/fedora-release" ] \
|| [ -f "/etc/SuSE-release" ] ; then
# TODO: fix pm-suspend to take a --wakeup-alarm argument
if [ $seconds_to_sleep != "0" ] ; then
# TODO: fixup pm-suspend to define erroc code (see alarm above) and throw
# the appropriate exception
if [ -x "/usr/sbin/pm-suspend" ] ; then
#stop network manager
service NetworkManager stop
/usr/sbin/pm-suspend $QUIRKS
# TODO: add support

by adding the red commands. This stops NetworkManager at suspend.

Then, at the bottom of the file, edit the text:

#Refresh devices as a resume can do funny things
for type in button battery ac_adapter
devices=`hal-find-by-capability --capability $type`
for device in $devices
dbus-send --system --print-reply --dest=org.freedesktop.Hal \
$device org.freedesktop.Hal.Device.Rescan

#start NetworkManager
service NetworkManager start

exit $RET

by adding the text in red.

Now, when you suspend and resume Fedora 7, networking should work!