There seems to be a problem with the ethernet device on a ThinkPad T450s (and possibly other machines using Intel E1000 ethernet devices), where Network Manager (NM) hangs trying to initialize the device after a suspend/resume cycle. After a resume, NM shows a spinning icon for about 10 seconds trying to get an IP address, and it eventually gives up. Telling NM to try again results in the same failure.
I observed this problem on Linux Mint 19.1 (Tara), using the 4.15.0-91-generic kernel from Ubuntu 18.04, and using two different NAT router/ISP installations.
After some searching, I came across a solution that uses systemd to disable the ethernet device before suspend, and enable it after resume. Unfortunately, there are some typos in the proposed systemd scripts: a superfluous ‘[’ character, and missing spaces surrounding semicolons in the command lines.
Below is the modified solution for the problem. Log in as root to perform all
of these steps, or prefix each command with
Create the file
/etc/systemd/system/network-suspend.service with the following
#/etc/systemd/system/network-suspend.service #sudo systemctl enable network-suspend.service [Unit] Description=Stop network components prior to suspending Before=sleep.target [Service] Type=oneshot ExecStart=/bin/systemctl stop NetworkManager.service ; /bin/ip link set enp0s25 down ; /sbin/modprobe -r e1000e [Install] WantedBy=sleep.target
If you are using a different ethernet device, use the
ifconfig command to determine
the device name for
ip link, and the
lspci -v command to determine the driver name for
Then make the file executable using:
chmod +x /etc/systemd/system/network-suspend.service
Similarly, create the file
/etc/systemd/system/network-resume.service with the following contents:
#/etc/systemd/system/network-resume.service #sudo systemctl enable network-resume.service [Unit] Description=Start network components after resuming After=suspend.target [Service] Type=oneshot ExecStartPre=/bin/sleep 1s ExecStart=/sbin/modprobe e1000e ; /bin/sleep 1s ; /bin/ip link set enp0s25 up ; /bin/systemctl start NetworkManager.service [Install] WantedBy=suspend.target
Make this file executable using:
chmod +x /etc/systemd/system/network-resume.service
Tell systemd to load the new service files using:
Before seeing if these new services work in a suspend/resume cycle, you can test them manually. First, try the suspend service:
systemctl start network-suspend.service systemctl status network-suspend.service
The second command should show any errors that might have occurred.
Similarly, test the resume service using:
systemctl start network-resume.service systemctl status network-resume.service
Now you can test a suspend/resume cycle. Note that after the resume, there is a two second delay
before Network Manager reports that the ethernet device is connected.
This is due to the two sleep commands in
It’s possible that these delays could be reduced further, but two seconds seems