[SOLVED]After suspend mode wired connecttion does not work

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
User avatar
Sir Charles
Level 7
Level 7
Posts: 1895
Joined: Thu Jan 04, 2018 1:00 pm

Re: After suspend mode wired connecttion does not work

Post by Sir Charles »

I am sorry that wasn't the appropriate command. I guess I am getting out of my depth here :wink:
I suppose that's one of the ironies of life, doing the wrong thing at the right moment -C.C.

djnesic
Level 1
Level 1
Posts: 41
Joined: Fri Dec 16, 2016 2:05 pm
Location: Belgrade, Serbia

Re: After suspend mode wired connecttion does not work

Post by djnesic »

Thanks anyway, Marziano.

User avatar
Sir Charles
Level 7
Level 7
Posts: 1895
Joined: Thu Jan 04, 2018 1:00 pm

Re: After suspend mode wired connecttion does not work

Post by Sir Charles »

You are welcome! I am sure you will get assistance from the experts on this forum to get your wired connection going.

Cheers
I suppose that's one of the ironies of life, doing the wrong thing at the right moment -C.C.

djnesic
Level 1
Level 1
Posts: 41
Joined: Fri Dec 16, 2016 2:05 pm
Location: Belgrade, Serbia

Re: After suspend mode wired connecttion does not work

Post by djnesic »

I am sure too. Cheers!

User avatar
thx-1138
Level 8
Level 8
Posts: 2101
Joined: Fri Mar 10, 2017 12:15 pm
Location: Athens, Greece

Re: After suspend mode wired connecttion does not work

Post by thx-1138 »

...i can only further offer the following idea right out of my mind: lspci -k | grep Ethernet -A2
This will return you something like:
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
Subsystem: Lenovo RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
Kernel driver in use: r8169
Kernel modules: r8169
In my case, the driver in use is r8169, in your system it might differ. So, after resuming from suspend: sudo rmmod r8169 && sudo modprobe r8169 && sudo systemctl restart network-manager.service
Replace r8169 with the name of your driver of course (this will remove the driver, re-insert it & further restart the service as well...)

djnesic
Level 1
Level 1
Posts: 41
Joined: Fri Dec 16, 2016 2:05 pm
Location: Belgrade, Serbia

Re: After suspend mode wired connecttion does not work

Post by djnesic »

thx-1138 wrote:
Sun Jul 08, 2018 7:42 am
...i can only further offer the following idea right out of my mind: lspci -k | grep Ethernet -A2
This will return you something like:
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
Subsystem: Lenovo RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
Kernel driver in use: r8169
Kernel modules: r8169
In my case, the driver in use is r8169, in your system it might differ. So, after resuming from suspend: sudo rmmod r8169 && sudo modprobe r8169 && sudo systemctl restart network-manager.service
Replace r8169 with the name of your driver of course (this will remove the driver, re-insert it & further restart the service as well...)
Let`s try

Code: Select all

djnesic@djnesic-P31-DS3L:~$ lspci -k | grep Ethernet -A2
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 01)
	Subsystem: Gigabyte Technology Co., Ltd Onboard Ethernet
	Kernel driver in use: r8169
	Kernel modules: r8169

djnesic
Level 1
Level 1
Posts: 41
Joined: Fri Dec 16, 2016 2:05 pm
Location: Belgrade, Serbia

Re: After suspend mode wired connecttion does not work

Post by djnesic »

That`s it. It works. Thank you thx-1138.
Just one more question. Can it be automated or I have to apply every time after back from suspend?

User avatar
thx-1138
Level 8
Level 8
Posts: 2101
Joined: Fri Mar 10, 2017 12:15 pm
Location: Athens, Greece

Re: After suspend mode wired connecttion does not work

Post by thx-1138 »

...absolutely great. I'm not really familiar with systemd's internals (read: barely understand it's basics), but i'd try:
make a simple text file, let's call it ethernet-reenable.sh (or whatever you wish).
Put the following contents there, and save it afterwards.
#!/bin/sh
sudo rmmod r8169 && sudo modprobe r8169 && sudo systemctl restart network-manager.service

Right-click on it, Properties, Permissions, "Allow Executing File As Program".

Then tweak Marziano's service, so that it points to that script:
xed admin:///etc/systemd/system/network-resume.service
[Unit]
Description=Local system network resume actions
After=suspend.target

[Service]
Type=oneshot
ExecStart=/home/djnesic/ethernet-reenable.sh

[Install]
WantedBy=suspend.target
That is, assuming you saved the ethernet-reenable.sh under /home/djnesic/
Finally, sudo systemctl deamon-reload for the changes to take effect (or reboot)...

I think this should be it more or less...(i repeat, my knowledge of systemd is rather elementary...
so if i've missed a step, hopefully someone else can chime in)...

djnesic
Level 1
Level 1
Posts: 41
Joined: Fri Dec 16, 2016 2:05 pm
Location: Belgrade, Serbia

Re: After suspend mode wired connecttion does not work

Post by djnesic »

Everything works just right. Thanks both of you, Marziano and thx-1138. You have blown away this. Best wishes.

User avatar
Sir Charles
Level 7
Level 7
Posts: 1895
Joined: Thu Jan 04, 2018 1:00 pm

Re: After suspend mode wired connecttion does not work

Post by Sir Charles »

That's great!
Thank you and thx-1138!
Learning is one of the biggest joys in my life. This was a joyous day!

Cheers
:D
I suppose that's one of the ironies of life, doing the wrong thing at the right moment -C.C.

User avatar
thx-1138
Level 8
Level 8
Posts: 2101
Joined: Fri Mar 10, 2017 12:15 pm
Location: Athens, Greece

Re: After suspend mode wired connecttion does not work

Post by thx-1138 »

Marziano wrote:
Sun Jul 08, 2018 9:18 am
That's great!
Thank you and thx-1138!
Learning is one of the biggest joys in my life. This was a joyous day!

Cheers
:D
...to be honest, it's exactly the fact that you proposed a systemd service in the first place what attracted my attention in the thread
(ie. you obviously have my thanks as well): really glad we managed to provide a workaround :)
I keep saying to myself that i should study properly how systemd does this or that, but keep postponing it for later...and later...and... :roll: :mrgreen:

User avatar
Sir Charles
Level 7
Level 7
Posts: 1895
Joined: Thu Jan 04, 2018 1:00 pm

Re: After suspend mode wired connecttion does not work

Post by Sir Charles »

thx-1138 wrote:
Sun Jul 08, 2018 10:09 am
really glad we managed to provide a workaround :)
Same here, great sense of satisfaction !
Cheers
:D
I suppose that's one of the ironies of life, doing the wrong thing at the right moment -C.C.

laszlopalya
Level 1
Level 1
Posts: 1
Joined: Thu Jul 12, 2018 3:51 pm

Re: [SOLVED]After suspend mode wired connecttion does not work

Post by laszlopalya »

The following is not a solution but a work around.
I had the same problem and tried all the solutions found on the web.
Finally I reinstalled LM 19 without network connection. After that I deselected the following packages fro updates:
kernel 4.15.0.23.25
netplan.io
networkd-dispatcher.
On of these caused it...

Now everything works fine.

Regards

djnesic
Level 1
Level 1
Posts: 41
Joined: Fri Dec 16, 2016 2:05 pm
Location: Belgrade, Serbia

Re: [SOLVED]After suspend mode wired connecttion does not work

Post by djnesic »

As a newbie I follow the rule "do not fix it if it's not broken" . I am grateful to Marziano and thx-1138 because they have solved my problem. Thank you laszlopalya for more ideas. I do not ask for help immediately, I search forum and if I can not find solution then I ask for help. For example, today I found solution for my problem (some things about update and python3...I do not know), and I do not know is it the best solution, but it is work for me. Although I'm not online I follow this forum every day. The point is... it works, does it the best solution...it is not important :) . Please, forgive me on my english.

kylerickards
Level 4
Level 4
Posts: 248
Joined: Sun Oct 18, 2009 9:39 am

Re: After suspend mode wired connecttion does not work

Post by kylerickards »

thx-1138 wrote:
Sun Jul 08, 2018 8:37 am
...absolutely great. I'm not really familiar with systemd's internals (read: barely understand it's basics), but i'd try:
make a simple text file, let's call it ethernet-reenable.sh (or whatever you wish).
Put the following contents there, and save it afterwards.
#!/bin/sh
sudo rmmod r8169 && sudo modprobe r8169 && sudo systemctl restart network-manager.service

Right-click on it, Properties, Permissions, "Allow Executing File As Program".

Then tweak Marziano's service, so that it points to that script:
xed admin:///etc/systemd/system/network-resume.service
[Unit]
Description=Local system network resume actions
After=suspend.target

[Service]
Type=oneshot
ExecStart=/home/djnesic/ethernet-reenable.sh

[Install]
WantedBy=suspend.target
That is, assuming you saved the ethernet-reenable.sh under /home/djnesic/
Finally, sudo systemctl deamon-reload for the changes to take effect (or reboot)...

I think this should be it more or less...(i repeat, my knowledge of systemd is rather elementary...
so if i've missed a step, hopefully someone else can chime in)...
Hi all

I have had the same problem and the command works on restarting the service. But I am having trouble understanding how to create and run that script? Could anyone help please?

Kyle

gm10
Level 20
Level 20
Posts: 10999
Joined: Thu Jun 21, 2018 5:11 pm

Re: After suspend mode wired connecttion does not work

Post by gm10 »

kylerickards wrote:
Wed Aug 29, 2018 11:23 am
I have had the same problem and the command works on restarting the service. But I am having trouble understanding how to create and run that script? Could anyone help please?
Copy & paste the following into a terminal window (paste it as a whole):

Code: Select all

sudo tee /lib/systemd/system-sleep/reset_network_driver <<'EOB'
#!/bin/sh
case "$1" in
    pre)
        modprobe -r r8169
        ;;
    post)
        modprobe r8169
        ;;
esac
EOB
Then run

Code: Select all

sudo chmod +x /lib/systemd/system-sleep/reset_network_driver
This sets up everything for you. It's not exactly the same thing that they proposed, but it's the better way of doing it.

It's only a problem with the 4.15 kernels by the way, you won't need this with more recent kernels.
Last edited by gm10 on Sat Sep 08, 2018 7:56 am, edited 2 times in total.

kylerickards
Level 4
Level 4
Posts: 248
Joined: Sun Oct 18, 2009 9:39 am

Re: [SOLVED]After suspend mode wired connecttion does not work

Post by kylerickards »

Thank you!

kylerickards
Level 4
Level 4
Posts: 248
Joined: Sun Oct 18, 2009 9:39 am

Re: After suspend mode wired connecttion does not work

Post by kylerickards »

gm10 wrote:
Wed Aug 29, 2018 11:33 am
kylerickards wrote:
Wed Aug 29, 2018 11:23 am
I have had the same problem and the command works on restarting the service. But I am having trouble understanding how to create and run that script? Could anyone help please?
Copy & paste the following into a terminal window (paste it as a whole):

Code: Select all

sudo tee /lib/systemd/system-sleep/reset_network_driver <<'EOB'
case "$1" in
    pre)
        modprobe -r r8169
        ;;
    post)
        modprobe r8169
        ;;
esac
EOB
sudo chmod +x /lib/systemd/system-sleep/reset_network_driver
This sets up everything for you. It's not exactly the same thing that they proposed, but it's the better way of doing it.

It's only a problem with the 4.15 kernels by the way, you won't need this with more recent kernels.
Hi

I tried that and it didn't work for me? :(

gm10
Level 20
Level 20
Posts: 10999
Joined: Thu Jun 21, 2018 5:11 pm

Re: After suspend mode wired connecttion does not work

Post by gm10 »

kylerickards wrote:
Wed Sep 05, 2018 4:20 am
I tried that and it didn't work for me? :(
Run the last line again, I should have put that separately:

Code: Select all

sudo chmod +x /lib/systemd/system-sleep/reset_network_driver

kylerickards
Level 4
Level 4
Posts: 248
Joined: Sun Oct 18, 2009 9:39 am

Re: [SOLVED]After suspend mode wired connecttion does not work

Post by kylerickards »

Hi

I tried again and I have the same problem still so I don't know what's causing it :(

Post Reply

Return to “Newbie Questions”