Can't connect to internet after Suspend and wake up

Hello everyone, I just installed endeavourOS. Was a pleasant experience but yesterday I was using xfce version since it came with the ISO itself (offline). What i found was that when i suspend my computer and try to login again, I was not able to connect the internet (using LAN cable). Then I thought it might be the problem with xfce itself since i mostly used KDE, then i installed KDE and found the same problem on it. The network icon keeps loading until it says "No network found ".
I tried running systemctl status NetworkManager it said the service was active (also tried to restart it but didn’t worked either).

can your return

inxi -Fxxxza

System:
Kernel: 5.7.10-arch1-1 x86_64 bits: 64 compiler: gcc v: 10.1.0
parameters: BOOT_IMAGE=/boot/vmlinuz-linux
root=UUID=93948c5a-1472-4a7a-99e3-b968edf6739f rw quiet
loglevel=3 nowatchdog
Desktop: KDE Plasma 5.19.4 tk: Qt 5.15.0 wm: kwin_x11 dm: SDDM
Distro: EndeavourOS
Machine:
Type: Desktop Mobo: ASUSTeK model: H110M-CS v: Rev X.0x
serial: UEFI [Legacy]: American Megatrends v: 1801
date: 05/17/2016
CPU:
Topology: Dual Core model: Intel Core i3-6098P bits: 64
type: MT MCP arch: Skylake-S family: 6 model-id: 5E (94)
stepping: 3 microcode: D6 L2 cache: 3072 KiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
bogomips: 28808
Speed: 800 MHz min/max: 800/3600 MHz Core speeds (MHz): 1: 800
2: 800 3: 800 4: 800
Vulnerabilities: Type: itlb_multihit
status: KVM: Split huge pages
Type: l1tf mitigation: PTE Inversion; VMX: conditional cache
flushes, SMT vulnerable
Type: mds mitigation: Clear CPU buffers; SMT vulnerable
Type: meltdown mitigation: PTI
Type: spec_store_bypass mitigation: Speculative Store Bypass
disabled via prctl and seccomp
Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user
pointer sanitization
Type: spectre_v2 mitigation: Full generic retpoline, IBPB:
conditional, IBRS_FW, STIBP: conditional, RSB filling
Type: srbds status: Vulnerable: No microcode
Type: tsx_async_abort status: Not affected
Graphics:
Device-1: Intel HD Graphics 510 vendor: ASUSTeK driver: i915
v: kernel bus ID: 00:02.0 chip ID: 8086:1902
Display: x11 server: X.Org 1.20.8 compositor: kwin_x11
driver: intel unloaded: fbdev,modesetting,vesa display ID: :0
screens: 1
Screen-1: 0 s-res: 1366x768 s-dpi: 96
s-size: 361x203mm (14.2x8.0") s-diag: 414mm (16.3")
Monitor-1: DP1 res: 1366x768 hz: 60 dpi: 85
size: 410x230mm (16.1x9.1") diag: 470mm (18.5")
Message: Unable to show advanced data. Required tool glxinfo
missing.
Audio:
Device-1: Intel 100 Series/C230 Series Family HD Audio
vendor: ASUSTeK driver: snd_hda_intel v: kernel bus ID: 00:1f.3
chip ID: 8086:a170
Sound Server: ALSA v: k5.7.10-arch1-1
Network:
Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
vendor: ASUSTeK driver: r8168 v: 8.048.03-NAPI modules: r8169
port: e000 bus ID: 02:00.0 chip ID: 10ec:8168
IF: enp2s0 state: up speed: 100 Mbps duplex: full mac:
Drives:
Local Storage: total: 1.36 TiB used: 8.37 GiB (0.6%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/sda vendor: Western Digital model: WD10EZRZ-00HTKB0
size: 931.51 GiB block size: physical: 4096 B logical: 512 B
speed: 6.0 Gb/s rotation: 5400 rpm serial: rev: 1A01
scheme: MBR
ID-2: /dev/sdb vendor: Seagate model: ST500DM002-1BD142
size: 465.76 GiB block size: physical: 4096 B logical: 512 B
speed: 6.0 Gb/s rotation: 7200 rpm serial: rev: KC45
scheme: MBR
Partition:
ID-1: / raw size: 314.15 GiB size: 308.22 GiB (98.11%)
used: 8.37 GiB (2.7%) fs: ext4 dev: /dev/sdb2
Swap:
Alert: No Swap data was found.
Sensors:
System Temperatures: cpu: 29.8 C mobo: 27.8 C
Fan Speeds (RPM): N/A
Info:
Processes: 161 Uptime: 2m Memory: 7.67 GiB
used: 820.0 MiB (10.4%) Init: systemd v: 245 Compilers:
gcc: 10.1.0 Packages: pacman: 923 lib: 206 Shell: Bash v: 5.0.17
running in: konsole inxi: 3.1.05

this is not simple as you mix UEFI & legacy on boot ,
version bios is not up to date.

it come from drivers r8168/r8169 that do not work in suspend wake up
( if you have these option in bios activate wake on lan )

add this ( from @tbg)
you can create the following service which should reload the r8168 module automatically at startup.

Restart r8168 Service

With a text editor create:

/etc/systemd/system/restart-r8168.service

Service file contents:

#/etc/systemd/system/restart-r8168.service
#sudo systemctl enable restart-r8168.service
#sudo systemctl start restart-r8168.service
#sudo systemctl stop restart-r8168.service
#sudo systemctl disable restart-r8168.service
#systemctl status restart-r8168. service
#sudo systemctl daemon-reload

[Unit]
Description=Restart r8168 Service
WantedBy=multi-user.target 
After=network.target
Wants=network-online.target
StopWhenUnneeded=yes

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/usr/bin/sleep 3
ExecStart=/bin/sh -c 'modprobe -r r8168 && sleep 3 && modprobe r8168'
ExecStop=/usr/bin/systemctl restart NetworkManager.service

[Install]
WantedBy=multi-user.target 

Save the newly created service file, then enable the service:

sudo systemctl enable restart-r8168.service

Then restart your computer to see if your Ethernet connection is now initialized correctly by the service.

If others are using the r8169 module, you will need to substitute it in place of r8168 in the service wherever it appears.

1 Like

welcome

welcome @nyuke

1 Like

I did everything you told me but the problem still persist, what more info can i provide so the problem can be solved?

check for update your bios version

@nyuke
Try unload & then remove r8168 and reboot check that r8169 is loaded. Should work with r8169.

How do i unload, remove r8168 and check r8169 is loaded, I should’ve mentioned this before that it used to work on other linux distros like neon, manjaro etc.

Unload module.

modprobe -r r8168

Then uninstall it.

sudo pacman -R r8168

Reboot and r8169 should automatically load.

1 Like

In my case with ethernet not working on an Asus with a Realtek chip it was enough to “unblacklist” the r8169 module.

sudo nano /usr/lib/modprobe.d/r8168.conf

Just uncomment with # …
#blacklist r8169

Just a shot in the dark, but less “destructive” than Ricklinux’s approach. :wink:

1 Like

@2000 @ricklinux I already went ahead and tried ricklinux’s method but sorry it’s not working either.

Hi @nyuke,

did you tried the inverse ? On my old Linksys there is a Realtek with R8168, but on detection by default it took the R8169, and it wasn’t working. At the end, I installed the R8168 and stop the R8169, and it worked…

I do believe it depends on how the hardware is detected !

@nyuke Can you at least get Ethernet up manually? (modprobe r816…)

If you are using the r8168 or r8169 module/driver and your internet is working fine at startup, but does not work after suspend then you will want to use a suspend service not a startup service as was suggested earlier.

Try this instead:

Suspend issues with the r8168 adapter can often be resolved by simply switching to the r8169 kernel module. It is often better to use the r8169 kernel module rather than the r8168 driver.

You can check which Realtek driver module is loaded with this command:

lsmod | grep r816

If switching drivers does not resolve your suspend issue, then a suspend service may help as a workaround. You can create a service to automatically disable your network components at suspend, and then re-enable them at resume. This usually allows you to suspend properly if your r8168/9 based Ethernet adapter is is causing the problem.


R8168/9 Network Suspend Service


Create the following service file with a text editor:

/etc/systemd/system/network-restart.service

Add the following contents to the file:

#cat /etc/systemd/system/network-restart.service
#systemctl enable network-restart.service
#systemctl start network-restart.service
#systemctl stop network-restart.service
#systemctl disable network-restart.service
#systemctl status network-restart.service

[Unit]
Description=Network Suspend/Resume Service 
Before=sleep.target
StopWhenUnneeded=yes

[Service]
User=root
Type=oneshot
RemainAfterExit=yes
ExecStartPre=-/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli networking off'
ExecStart=/usr/bin/sleep 1
ExecStart=-/usr/bin/systemctl stop NetworkManager
ExecStart=/usr/bin/sleep 1
ExecStart=-/usr/bin/ip link set enp2s0 down
ExecStart=/usr/bin/sleep 1
ExecStart=-/usr/bin/modprobe -r r8169
ExecStop=/usr/bin/sleep 1
ExecStop=-/usr/bin/modprobe r8169
ExecStop=/usr/bin/sleep 2
ExecStop=-/usr/bin/ip link set enp2s0 up
ExecStop=/usr/bin/sleep 2
ExecStop=-/usr/bin/systemctl start NetworkManager
ExecStop=/usr/bin/sleep 1
ExecStop=-/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli networking on'

[Install]
WantedBy=sleep.target

The sleep units in the service may be reduced, (or eliminated) if you do not like the delay it creates. Be aware though, that doing so may reduce the reliability of the service. If you find the service is not working properly for you, then you should try increasing the sleep times. It has been reported that some kernels require adding more sleep time between executing commands to work reliably.

Once you have created and saved the service file, enable the service:

systemctl enable network-restart.service

Then reboot the computer.

Adapt this service to your installation (if different than above). If your adapter’s designation is different than “enp2s0”, you will need to substitute you own adapter’s network ID into the service file.

If you are using the r8168 module you will need to substitute it in place of the r8169 module in the service.

R8169 is usually the recommended driver module for this adapter. You can substitute either module in the above service depending on which driver module you prefer.

You can find your adapter driver/module and network device identification to substitute into the service with the following command:

inxi -nz


5 Likes

What is destructive about removing the the r8168? I have always used the r8168 until I installed the btrfs setup with snapshots and using suspend and hibernation. Then my network wouldn’t connect so I just uninstalled r8168 and am now using r8169. :man_shrugging:

removing the r8168 package worked perfect for me (not so much before rebooting and allowing the boot-up process to select r8169 from the kernel)

earlier versions of EOS did not install the r8168 package
and it seems not to be installed in several other Arch-based distros

perhaps the EOS team can create a Wiki entry advising users with Realtek modules of this issue which has been a problem for some since the r8168 package was introduced to new EOS installations

1 Like

Sorry, I didn’t want to “talk bad” your solution. :pray:

I just meant it in the “it’s easier to re-edit a text file than to reinstall a formerly removed module and load it” way, if the proposed solution shouldn’t work. That’s why I would have tried in that order.

Because this problem seems to be popping up repeatedly on the forum it would be of great help to others if you could just mark @ricklinux 's approach as the solution, if this issue is solved.
Thanks

[EDIT]
Terribly sorry!

Just noticed nyuke was the original poster and not @garybean . Just saw “worked for me” and thought “Bingo, solved!”.