Restarting all the network in Ubuntu after hibernating

57,005

Solution 1

You can build yourself a bash script and add these things. I think the thing you want to do for the others is maybe reload the modules, if your not able to find those adapters.

You can look for the adapters like this ip link show if your sure you've covered all adapters then try to reload modules.

You will have to

1) search to see what modules your loading with this command sudo lsmod

2) reload them using the command sudo rmmod yourMod

3) sudo modprobe yourMod to restart it.

4) restart your network adapters sudo service restart network or sudo systemctl restart network, or service network-manager restart.

There is probably a way you can add the script to a feature that launches the script out of hibernate. that would be cool, however, before you did that, you might just want to reinstall your network system completely to see if you can fix that first, which is something that you might have to bear, so that the problems go away.

Also if the problem just started happening recently, you may want to just hang out for another kernel release update, (or try downgrading temporarily), no matter which your using now, before moving any further on this, unless you know that it is an ongoing issue for sure which has already plagued multiple kernel updates already...

Hope that helps :-)

Solution 2

Maybe this workaround of mine could help you.

First, execute this command:

sudo vim /etc/rc.local

Then, the content should look similar to this:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

#Sleeping a little might be necessary to let it catch up the boot. 
#However, for me, this sleep was a useless overhead.
#sleep 3 
service network-manager restart

exit 0
Share:
57,005

Related videos on Youtube

Quora Feans
Author by

Quora Feans

Updated on September 18, 2022

Comments

  • Quora Feans
    Quora Feans over 1 year

    When my Ubuntu 14.04 machine awakes from hibernation, sometimes the network is disable and enabling it does not make it work again. Running

    sudo service network-manager restart
    

    alone does not solve the problem. But

    sudo ifconfig wlan0 down && sudo ifconfig wlan0 up
    

    tend to solve the problem for a wlan connection.

    However, it fails to start a PPP connection through 3G or GPRS unless I re-boot. Re-starting the smartphone used as a modem does not help here.

    How can I re-start all network modules without re-booting?

    More information:

    The machine is connected through a USB cable to the smartphone. I am using the network-manager and the nm-applet to start the connection.

    It's a persistent problem, in earlier versions it was already a problem.

    I won't enter on the reason why the network gets disabled after hibernation. I believe there's information somewhere about how to deal with this bug though. However, it was not a big issue for me.

    sudo lsmod | grep ppp
    ppp_deflate            12950  0 
    ppp_async              17413  1 
    crc_ccitt              12707  1 ppp_async
    
    sudo lsmod | grep usb
    usb_serial_simple      17386  2 
    usbserial              45141  6 usb_serial_simple
    usb_storage            66545  1 uas
    
    • Brian Thomas
      Brian Thomas almost 9 years
      Can you list any network adapter output from the command lsmod above in the OP?
    • Gilles 'SO- stop being evil'
      Gilles 'SO- stop being evil' almost 9 years
      How does the Ubuntu machine connect to the smartphone? USB? Wifi? How is the PPP connection started?
  • Quora Feans
    Quora Feans almost 9 years
    ip link show output is 18: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 3 link/ppp What should I do with this information?
  • Brian Thomas
    Brian Thomas almost 9 years
    I think this might help manpages.ubuntu.com/manpages/hardy/man8/pppd.8.html it looks like you might have a point to point daemon running. and im trying to figure out how one would go about restarting a daemon. is that systemctl restart pppd or something of that sort? does ubuntu even use systemd yet? Ok maybe its service restart pppd or whatever the daemon is called. you might need to do that then restart your net adapter again after.