2

How do I restart ethernet after waking my Ubuntu 20.04 computer from sleep mode?

If I reboot, ethernet works fine, but I want to get ethernet working without rebooting.

"sudo service network-manager restart" doesn't restart ethernet. I get something saying there's a configuration error.

Thanks.

From sudo lshw -C network:

  *-network DISABLED        
       description: Ethernet interface
       product: QCA8171 Gigabit Ethernet
       vendor: Qualcomm Atheros

From sudo lspci:

08:00.0 Ethernet controller: Qualcomm Atheros QCA8171 Gigabit Ethernet (rev 10)

From sudo /etc/init.d/network-manager status:

Aug 13 20:34:28 IdeaPad NetworkManager[640]: <info>  [1628908468.8532] device (enp8s0): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'managed')
  • Are there any messages in /var/log/syslog that point to an issue with the ethernet device? Could you also [edit] your question to include the output of sudo lshw -C network and sudo lspci? This will contain specific information about the network device, making it easier to offer a specific solution – matigo Aug 13 '21 at 23:38
  • Go to the WiFi settings panel, observe if it's enabled at the top of the window. Locate, if you have one, a network enable/disable physical switch on the front/side of your computer, and may sure it's in the enabled position. Locate, if you have one, the Function key used to enable/disable the network. Confirm it's enabled. Use rfkill list and confirm nothing is disabled. – heynnema Aug 14 '21 at 21:15
  • Hi heynnemma, Thank you. Wifi works fine after waking the computer from sleep, but it's the wired lan that only works after rebooting and is not working after waking from sleep. I want the wired lan to work after waking from sleep. It used to work fine after waking from sleep until the last update & upgrade. – Kevin Berry Aug 14 '21 at 22:04
  • Have you tried ifup eth0? Change eth0 with your ethernet interface, you can find the interface name by executing the command ifconfig – CrazyTux Aug 15 '21 at 17:45
  • Yes, I installed ifupdown, added a reference for "iface enp8s0 auto dhcp" into the interfaces file, and tried sudo ifup enp8s0, but eth0 never activated. The ethernet icon appeared with some kind of disabled appearance, but there was no ethernet connectivity. I don't understand why the ethernet driver works on boot, but won't wake. – Kevin Berry Aug 15 '21 at 19:51

2 Answers2

1

First determine the module that controls your ethernet.
lspci -vvnn | grep -A 9 -i ethernet
An example might be...
Kernel driver in use: tg3
Kernel modules: tg3
Then use modprobe to turn tg3 or whatever yours is off and on again.
sudo modprobe -r tg3
sudo modprobe tg3

  • This worked perfectly. In my case: sudo modprobe -r alx, then sudo modprobe alx. I am just in awe of people who can get right to the issue like you did. Thank you very very very much!!! (And thanks to everyone else offering assistance too!) – Kevin Berry Aug 16 '21 at 17:16
1

With network manager installed, you should use nmcli command line utility to maintain your network:

Show connections:

nmcli c show

Show devices:

nmcli d show

Restart networking:

nmcli networking off
nmcli networking on
thomas
  • 879
  • Thank you for the suggestion. This does turn networking on and off, but I think the problem for me was my kernel ethernet driver was not getting restarted even with the network restarting. The answer above restarted the driver, and then my ethernet worked instantly again. Thank you very much for helping. I really appreciate it. – Kevin Berry Aug 16 '21 at 17:19
  • And I did finally see the usefullness of nmcli due to your suggestion here. Thanks!!! – Kevin Berry Aug 16 '21 at 17:24
  • This is what actually worked for me. Thank you so much – Moyo Freeman Jul 05 '23 at 06:10