This is a revised version of the r8168 suspend service that I originally wrote. It requires no external scripts, and only a single service file is required for suspend and resume operations.
Suspend issues with the r8168 adapter can often be resolved by simply switching to the r8169 kernel driver.
It is generally better to use the r8169 kernel driver rather than the r8168 driver.
You can easily switch to the r8169 kernel driver with this command:
sudo mhwd -r pci network-r8168
Reboot after the driver uninstall is complete.
The r8169 kernel driver should be automatically loaded after you reboot. If after switching to the r8169 driver you are still experiencing suspend issues you can create a service to hopefully resolve problems related to your adapter.
You can check which Realtek driver is loaded with this command:
lsmod | grep r816
How to create a service to automatically disable your network components at suspend, and re-enable them at resume:
Network Restart Service
Create the following file with a root capable text editor:
Add the following contents to the file:
#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
Description=Network Suspend/Resume Service
ExecStartPre=-/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli networking off'
ExecStart=-/usr/bin/systemctl stop NetworkManager
ExecStart=-/usr/bin/ip link set enp2s0 down
ExecStart=-/usr/bin/modprobe -r r8169
ExecStop=-/usr/bin/ip link set enp2s0 up
ExecStop=-/usr/bin/systemctl start NetworkManager
ExecStop=-/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli networking on'
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.
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 “enp2s0” 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.
R8169 is the currently the recommended driver for this adapter. The r8168 driver should generally be uninstalled through Manjaro Settings Manger or the terminal command given above. I would highly suggest switching to the r8169 kernel module rather than using the r8168 driver. You can substitute "r8168" or "r8169" in the above service file depending on which driver you are using.
You can find your adapter driver/module and device ID to substitute in the service with the following command:
Alternate steps to ensure the r8169 driver is loaded:
Follow the instructions below to remove the r8168 driver.
Uninstall the linuxXXX-r8168 driver:
Open Manjaro Settings Manager -> Hardware configuration -> Network controller
Right click on the RTL8111/8168/8411 ethernet device and select “Remove”.
After the uninstall process has finished, restart.
After you restart, the r8169 kernel module should now be automatically loaded.
You can check which Realtek driver is now loaded with this command:
lsmod | grep r816
Only r8169 should be present in the output, (r8168 should not appear there)
If the r8169 kernel module is not loaded automatically when you reboot (after uninstalling r8168) then do this:
Open any file located in
/etc/modprobe.d and ensure there is no reference to r8169.
Any file that contains the line:
Save the edited conf file with root permissions, and then reboot
Alternately, you may delete the conf file entirely, (if it only contains the entry "blacklist r8169").
/etc/modprobe.d contains a file named
r8169_blacklist.conf then you can delete it with this command:
sudo rm /etc/modprobe.d/r8169_blacklist.conf
Be very careful, you do not make any errors when using the "rm" command with sudo privileges.
Reboot after making any changes to files in