Slow internet speed after waking up from sleep

Hello,
I've been using Manjaro for about 10 days and I noticed something really strange.
Every time the computer wakes up from sleep the internet speed is very low.
Usually I have about 45Mbps download but after waking up from sleep the numbers I get on the speedtest is barely 5Mbps download.

Some info about my distro.

DISTRIB_ID=ManjaroLinux
DISTRIB_RELEASE=19.0.2
DISTRIB_CODENAME=Kyria
DISTRIB_DESCRIPTION="Manjaro Linux"

Kernel: 5.4.23-1-MANJARO

After restarting it's usually fine.
EDIT: I use ethernet not wifi.

1 Like

This seems likely a kernel related issue.

I would suggest installing and testing at least three alternate kernels (both older and newer). Install kernels through Manjaro Settings Manager, and always have at least two kernels installed at all times for safety. Please list which kernels you have tested.

If the regular kernels bring no improvement, test one of the real time kernels.

Just for future reference, before starting any help thread always test at least 3 alternate kernels first. Issues that you may never expect to be related to the kernel, often are.

How to switch kernels:

When you reboot if you do not see the grub boot screen press and hold down the ESC, SHIFT or F8 key. This should show the GRUB boot menu if it doesn't appear. As soon as you see the grub boot screen, press the down arrow. Select the "advanced" menu from the choices and press enter. In the next menu you can select the different kernels you have installed to boot from. Select the regular kernel you wish boot into (not the fallback), and then press enter to complete the kernel change.

If changing kernels brings no improvement then a suspend service may help.

If your adapter's ID is different than “wlp9s0f3u2” you will need to substitute you own adapter’s ID into the service file. If you are using a different driver module you will also need to substitute it in place of “rt2800usb”.

You can find your adapters driver/module and network device identification with the following command:

inxi -n


Please post:

inxi -SMa; hwinfo --netcard --bluetooth | grep -Ei "(hotplug|speed|model|status|cmd|file|detected|driver:)" | grep -v "Config S" && echo "System install date $(head -n1 /var/log/pacman.log | cut -d " " -f1 | cut -c 2-11)" 

Thanks for the reply!
I switched to 5.5.7-1-MANJARO. I'll see how it goes.

Nothing seems to have changed with the new kernel.
I also noticed the problem is only in browsing not in downloading. I use firefox maybe it has something to do with firefox. Although when I download something from Google Drive or other cloud services the speed seems fine.
The browsing in general feels a little slower. I'm sure it doesn't have to do with those pages because after restarting my system it's all good.


You seem to have overlooked this as well:

I suggested testing at least 3 kernels, not simply one kernel. Perhaps when you have followed my initial suggestions I will offer more. For now I will leave others to help, as I have little patience for helping those unwilling (or unable) to follow suggestions correctly.

Good luck resolving your issue.

Yes, you are right, I forgot to post it.

System:    Host: george-pc Kernel: 5.5.7-1-MANJARO x86_64 bits: 64 
           parameters: BOOT_IMAGE=/boot/vmlinuz-5.5-x86_64 root=UUID=b7bec45b-5df7-4c8c-841b-791e6c594e39 rw 
           quiet apparmor=1 security=apparmor udev.log_priority=3 
           Desktop: KDE Plasma 5.17.5 Distro: Manjaro Linux 
Machine:   Type: Desktop Mobo: ASUSTeK model: PRIME B360-PLUS v: Rev 1.xx serial: <root required> 
           UEFI: American Megatrends v: 0504 date: 03/06/2018 
  Model: "Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller"
  Driver: "r8169"
  Device File: enp6s0
  Link detected: yes
    Driver Status: r8169 is active
    Driver Activation Cmd: "modprobe r8169"
System install date 2020-03-02

My network adapter is:

Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169 
           IF: enp6s0 state: up speed: 100 Mbps duplex: full mac: 4c:ed:fb:41:13:61

I'm gonna try a real time kernel as well.

I don't really know much about that so I have to do little steps at a time to ensure I won't break anything.
I'll post an update for every thing I try.

1 Like

You can create a service to automatically disable your network components at suspend, and re-enable them at resume:

Network Restart Suspend Service

Create the following file with a root capable text editor:

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

Add the following contents to the file:

#/etc/systemd/system/network-restart.service
#sudo systemctl enable network-restart.service
#sudo systemctl start network-restart.service
#sudo systemctl stop network-restart.service
#sudo 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 enp6s0 down
ExecStart=/usr/bin/sleep 1
ExecStart=-/usr/bin/modprobe -r r8169
ExecStop=/usr/bin/sleep 2
ExecStop=-/usr/bin/modprobe r8169
ExecStop=/usr/bin/sleep 2
ExecStop=-/usr/bin/ip link set enp6s0 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 you, then you should try increasing the sleep times. It has been reported that some kernels require more time between executing commands to work reliably.

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

sudo systemctl enable network-restart.service

Then reboot the computer.


For others wishing to adapt this service to their installation (if different than above).

If your adapter's designation is different than enp6s0 you will need to substitute you own adapter’s ID into the service file.

If you are using a different driver module you will also need to substitute it in place of “r8168” or “r8169” in the service file.

If the service does not work for you, you can disable the service with:

sudo systemctl disable --now network-restart.service
2 Likes

This is very helpful! Thank you very much!!
I'll need some time to try and test it.

Thank you again for the fast reply!

1 Like

The best way to be sure you don't irreparably mess up your system with bad configuration changes is to install timeshift. Timeshift can roll back your system to an earlier working state. Anyone new to Manjaro should install this utility to make sure changes or a bad update don't bork your system.

You will be a lot less nervous making configuration changes if you know you have your system configuration backed up.

2 Likes

Does timeshift also work for grub config changes?

Yes, it will backup all configuration files in /root by default. Although I'm not sure if it backs up files if you use a separate /boot partition.

1 Like

I wasn't aware of that feature. I'm gonna look at it too.
Thanks!

2 Likes

This issue happens to me too. Only after using sleep.

enp39s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 00:d7:62:7c:21:95 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    5020039497 4161742  0       12018   0       1001    
    TX: bytes  packets  errors  dropped carrier collsns 
    950176903  2901564  0       0       0       0

LSB Version:    n/a
Distributor ID: ManjaroLinux
Description:    Manjaro Linux
Release:        19.0
Codename:       Kyria

5.5.6-1-MANJARO #1 SMP Mon Feb 24 09:24:51 UTC 2020 x86_64 GNU/Linux

It worked fine for a day or two but today when I got home and opened my computer the network interface it's inactive and ethernet doesn't work. I restarted it bug nothing seems to work.

Any ideas?

EDIT: I restarted the service manually and it did the trick.

sudo systemctl restart network-restart.service
1 Like

If you have intermittent failures with the suspend service it sometimes helps to increase the seconds of time in the sleep units. It is a bit of a balancing act to get it to work reliably, but not take an excessive amount of time to restart your connection.

1 Like

I thought about that. I'll look at it tomorrow if it does the same.

Thank you very much for your help!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by