Internet connection doesn't work after suspend

Sorry if I misled anyone, I just noticed the title said restart and not suspend so I fixed that. I see someone is replying as I'm typing this, but I have to go to sleep now so I probably won't be able to reply back for a while.

if you want to see which drivers are installed
mhwd -li

but since your laptop is intel/nvidia optimus, if you chose free(open source) drivers then you will have video-linux installed and that would use the nouveau drivers. if you installed with nonfree(proprietary) then you will have "video-hybrid-intel-nvidia-bumblebee" installed. if you wanted to use the video-nvidia you would need to use optimus-manager or prime.
if your current setup works, use it.

after suspend/wake, try this:
sudo systemctl restart NetworkManager

and see if your able to connect. if not, there are other threads that you may not see as exactly the same but would most likely fix your issue, sometimes a small delay before network manager tries to connect is all you need.

Actually yes, I tried a few simple solutions like that and there's no change afterwards. I also tried stopping my wifi manually before the suspend and resuming it afterwards to no avail.
By the way, I'm not sure if this is related, but sometimes my laptop is unable to shutdown or restart immediately. Sometimes it instead starts doing the "a stop job is running for session 2 of user ...." for 90 seconds. I tried editing

/etc/systemd/system.conf

to at least reduce the time when it happens by changing some values to this

DefaultTimeoutStartSec=10s
DefaultTimeoutStopSec=10s

but it didn't change the 90 seconds.

post ouput from:
systemctl status NetworkManager
journalctl -b0 -p4
cat /var/log/Xorg.0.log | grep -E "(EE)|\(WW)|\error|\failed|\Time"
systemctl --failed --all (if any failed, which ones?)
after you post those, possibly try this: leave a few seconds between entering in each command separately.
sudo systemctl stop NetworkManager
sudo ip link set wlp3s0 down
sudo modprobe -r iwlwifi
sudo modprobe iwlwifi
sudo ip link set wlp3s0 up
sudo systemctl restart NetworkManager

Here they are in order - status:

● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/NetworkManager.service.d
           └─NetworkManager-ovs.conf
   Active: active (running) since Thu 2019-02-07 07:34:37 EET; 2min 49s ago
     Docs: man:NetworkManager(8)
 Main PID: 624 (NetworkManager)
    Tasks: 3 (limit: 4915)
   Memory: 20.3M
   CGroup: /system.slice/NetworkManager.service
           └─624 /usr/bin/NetworkManager --no-daemon

фев 07 07:36:12 Kiko-LTL NetworkManager[624]: <info>  [1549517772.3453] keyfile: add connection /var/run/NetworkManager/system-connections/tun0.nmconnection (32fdab32-75bb-4b7a-beba-87e034c63911,"tun0")
фев 07 07:36:12 Kiko-LTL NetworkManager[624]: <info>  [1549517772.3467] device (tun0): state change: unavailable -> disconnected (reason 'connection-assumed', sys-iface-state: 'external')
фев 07 07:36:12 Kiko-LTL NetworkManager[624]: <info>  [1549517772.3484] device (tun0): Activation: starting connection 'tun0' (32fdab32-75bb-4b7a-beba-87e034c63911)
фев 07 07:36:12 Kiko-LTL NetworkManager[624]: <info>  [1549517772.3566] device (tun0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'external')
фев 07 07:36:12 Kiko-LTL NetworkManager[624]: <info>  [1549517772.3576] device (tun0): state change: prepare -> config (reason 'none', sys-iface-state: 'external')
фев 07 07:36:12 Kiko-LTL NetworkManager[624]: <info>  [1549517772.3580] device (tun0): state change: config -> ip-config (reason 'none', sys-iface-state: 'external')
фев 07 07:36:12 Kiko-LTL NetworkManager[624]: <info>  [1549517772.3585] device (tun0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'external')
фев 07 07:36:12 Kiko-LTL NetworkManager[624]: <info>  [1549517772.3596] device (tun0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'external')
фев 07 07:36:12 Kiko-LTL NetworkManager[624]: <info>  [1549517772.3600] device (tun0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'external')
фев 07 07:36:12 Kiko-LTL NetworkManager[624]: <info>  [1549517772.4444] device (tun0): Activation: successful, device activated.

journalctl:

-- Logs begin at Fri 2019-02-01 21:48:35 EET, end at Thu 2019-02-07 07:37:41 EET. --
фев 07 07:34:20 Kiko-LTL kernel: ENERGY_PERF_BIAS: Set to 'normal', was 'performance'
фев 07 07:34:20 Kiko-LTL kernel: ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)
фев 07 07:34:20 Kiko-LTL kernel: blkcg_policy_register: BLKCG_MAX_POLS too small
фев 07 07:34:20 Kiko-LTL kernel: i8042: PNP: PS/2 appears to have AUX port disabled, if this is incorrect please boot with i8042.nopnp
фев 07 07:34:20 Kiko-LTL kernel: usb: port power management may be unreliable
фев 07 07:34:32 Kiko-LTL kernel: wmi_bus wmi_bus-PNP0C14:00: WQ data block query control method not found
фев 07 07:34:32 Kiko-LTL kernel: wmi_bus wmi_bus-PNP0C14:00: WQ data block query control method not found
фев 07 07:34:32 Kiko-LTL kernel: wmi_bus wmi_bus-PNP0C14:00: WQ data block query control method not found
фев 07 07:34:32 Kiko-LTL kernel: wmi_bus wmi_bus-PNP0C14:00: WQ data block query control method not found
фев 07 07:34:32 Kiko-LTL kernel: i2c_hid i2c-SYNA7DB5:01: i2c-SYNA7DB5:01 supply vdd not found, using dummy regulator
фев 07 07:34:32 Kiko-LTL kernel: i2c_hid i2c-SYNA7DB5:01: i2c-SYNA7DB5:01 supply vddl not found, using dummy regulator
фев 07 07:34:32 Kiko-LTL kernel: r8168: loading out-of-tree module taints kernel.
фев 07 07:34:32 Kiko-LTL kernel: r8168 0000:02:00.1: can't disable ASPM; OS doesn't have ASPM control
фев 07 07:34:32 Kiko-LTL kernel: r8168  Copyright (C) 2017  Realtek NIC software team <nicfae@realtek.com> 
                                     This program comes with ABSOLUTELY NO WARRANTY; for details, please see <http://www.gnu.org/licenses/>. 
                                     This is free software, and you are welcome to redistribute it under certain conditions; see <http://www.gnu.org/licenses/>. 
фев 07 07:34:32 Kiko-LTL kernel: kauditd_printk_skb: 1 callbacks suppressed
фев 07 07:34:32 Kiko-LTL kernel: thermal thermal_zone3: failed to read out thermal zone (-61)
фев 07 07:34:32 Kiko-LTL kernel: [Firmware Bug]: ACPI(PXSX) defines _DOD but not _DOS
фев 07 07:34:32 Kiko-LTL kernel: dell_smbios: Unable to run on non-Dell system
фев 07 07:34:32 Kiko-LTL kernel: snd_hda_codec_realtek hdaudioC0D0: Failed to find dell wmi symbol dell_micmute_led_set
фев 07 07:34:32 Kiko-LTL kernel: uvcvideo 1-7:1.0: Entity type for entity Extension 4 was not initialized!
фев 07 07:34:32 Kiko-LTL kernel: uvcvideo 1-7:1.0: Entity type for entity Processing 2 was not initialized!
фев 07 07:34:32 Kiko-LTL kernel: uvcvideo 1-7:1.0: Entity type for entity Camera 1 was not initialized!
фев 07 07:34:26 Kiko-LTL systemd-udevd[356]: Process '/usr/bin/set-wireless-regdom' failed with exit code 1.
фев 07 07:34:28 Kiko-LTL systemd-udevd[354]: Process '/usr/bin/tlp auto' failed with exit code 4.
фев 07 07:34:30 Kiko-LTL systemd-udevd[347]: Process '/usr/bin/alsactl restore 0' failed with exit code 99.
фев 07 07:34:34 Kiko-LTL kernel: ACPI Warning: \_SB.PCI0.RP01.PXSX._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20181003/nsarguments-66)
фев 07 07:34:38 Kiko-LTL kernel: kauditd_printk_skb: 12 callbacks suppressed
фев 07 07:34:48 Kiko-LTL sddm-greeter[843]: QObject: Cannot create children for a parent that is in a different thread.
                                               (Parent is QGuiApplication(0x7fff33666fc0), parent's thread is QThread(0x559407ec3eb0), current thread is QThread(0x559407f36ac0)
фев 07 07:34:48 Kiko-LTL sddm-greeter[843]: QObject: Cannot create children for a parent that is in a different thread.
                                               (Parent is QGuiApplication(0x7fff33666fc0), parent's thread is QThread(0x559407ec3eb0), current thread is QThread(0x559407f36ac0)
фев 07 07:34:48 Kiko-LTL sddm-greeter[843]: QObject: Cannot create children for a parent that is in a different thread.
                                               (Parent is QGuiApplication(0x7fff33666fc0), parent's thread is QThread(0x559407ec3eb0), current thread is QThread(0x559407f36ac0)
фев 07 07:34:48 Kiko-LTL sddm-greeter[843]: QObject::installEventFilter(): Cannot filter events for objects in a different thread.
фев 07 07:34:48 Kiko-LTL sddm-greeter[843]: QObject: Cannot create children for a parent that is in a different thread.
                                               (Parent is QGuiApplication(0x7fff33666fc0), parent's thread is QThread(0x559407ec3eb0), current thread is QThread(0x559407f36ac0)
фев 07 07:34:49 Kiko-LTL sddm-greeter[843]: QObject: Cannot create children for a parent that is in a different thread.
                                               (Parent is QGuiApplication(0x7fff33666fc0), parent's thread is QThread(0x559407ec3eb0), current thread is QThread(0x559407f36ac0)
фев 07 07:34:49 Kiko-LTL sddm-greeter[843]: QObject::installEventFilter(): Cannot filter events for objects in a different thread.
фев 07 07:34:52 Kiko-LTL sddm-greeter[843]: file:///usr/share/sddm/themes/breath/components/VirtualKeyboard.qml:22:1: Type InputPanel unavailable
фев 07 07:34:52 Kiko-LTL sddm-greeter[843]: qrc:/QtQuick/VirtualKeyboard/content/InputPanel.qml:125:5: Type Keyboard unavailable
фев 07 07:34:52 Kiko-LTL sddm-greeter[843]: qrc:/QtQuick/VirtualKeyboard/content/components/Keyboard.qml:36:1: module "QtQuick.VirtualKeyboard.Plugins" is not installed
фев 07 07:34:54 Kiko-LTL sddm-greeter[843]: QDBusConnection: name 'org.freedesktop.UDisks2' had owner '' but we thought it was ':1.45'
фев 07 07:35:07 Kiko-LTL klauncher[955]: Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
фев 07 07:35:11 Kiko-LTL kdeinit5[961]: kscreen.kded: PowerDevil SuspendSession action not available!
фев 07 07:35:12 Kiko-LTL ksmserver[998]: Qt: Session management error: networkIdsList argument is NULL
фев 07 07:35:17 Kiko-LTL org_kde_powerdevil[1064]: powerdevil: Handle button events action could not check for screen configuration
фев 07 07:35:28 Kiko-LTL kwin_x11[1001]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 1008, resource id: 39845896, major code: 3 (GetWindowAttributes), minor code: 0
фев 07 07:35:28 Kiko-LTL kwin_x11[1001]: qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 1009, resource id: 39845896, major code: 14 (GetGeometry), minor code: 0
фев 07 07:35:29 Kiko-LTL kwin_x11[1001]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 1036, resource id: 44040197, major code: 18 (ChangeProperty), minor code: 0
фев 07 07:35:35 Kiko-LTL kwin_x11[1001]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 2744, resource id: 2097186, major code: 18 (ChangeProperty), minor code: 0
фев 07 07:35:37 Kiko-LTL plasmashell[1007]: Trying to use rootObject before initialization is completed, whilst using setInitializationDelayed. Forcing completion
фев 07 07:35:38 Kiko-LTL plasmashell[1007]: Empty filename passed to function
фев 07 07:35:38 Kiko-LTL plasmashell[1007]: Empty filename passed to function
фев 07 07:35:38 Kiko-LTL plasmashell[1007]: trying to show an empty dialog
фев 07 07:35:38 Kiko-LTL plasmashell[1007]: file:///usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/main.qml:61:5: Unable to assign [undefined] to int
фев 07 07:35:38 Kiko-LTL plasmashell[1007]: file:///usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/main.qml:52:5: Unable to assign [undefined] to int
фев 07 07:35:38 Kiko-LTL plasmashell[1007]: file:///usr/share/plasma/packages/org.kde.desktoptoolbox/contents/ui/ToolBoxRoot.qml:101:5: QML ToolBoxButton: Found duplicate state name: topleft
фев 07 07:35:39 Kiko-LTL plasmashell[1007]: kf5.kpackage: No metadata file in the package, expected it at: "/home/kiko/.local/share/wallpapers/"
фев 07 07:35:39 Kiko-LTL plasmashell[1007]: kf5.kpackage: No metadata file in the package, expected it at: "/home/kiko/.local/share/wallpapers/"
фев 07 07:35:39 Kiko-LTL plasmashell[1007]: kf5.kpackage: No metadata file in the package, expected it at: "/home/kiko/.local/share/wallpapers/"
фев 07 07:35:39 Kiko-LTL plasmashell[1007]: trying to show an empty dialog
фев 07 07:35:42 Kiko-LTL baloo_file[1003]: QObject::connect(Solid::StorageAccess, Baloo::StorageDevices): invalid null parameter
фев 07 07:35:44 Kiko-LTL baloo_file[1003]: QObject::connect(Solid::StorageAccess, Baloo::StorageDevices): invalid null parameter
фев 07 07:35:44 Kiko-LTL baloo_file[1003]: QObject::connect(Solid::StorageAccess, Baloo::StorageDevices): invalid null parameter
фев 07 07:35:44 Kiko-LTL baloo_file[1003]: QObject::connect(Solid::StorageAccess, Baloo::StorageDevices): invalid null parameter
фев 07 07:35:45 Kiko-LTL plasmashell[1007]: Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
фев 07 07:35:45 Kiko-LTL kwin_x11[1001]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 3616, resource id: 54525957, major code: 18 (ChangeProperty), minor code: 0
фев 07 07:35:46 Kiko-LTL plasmashell[1007]: trying to show an empty dialog
фев 07 07:35:46 Kiko-LTL plasmashell[1007]: Trying to use rootObject before initialization is completed, whilst using setInitializationDelayed. Forcing completion
фев 07 07:35:47 Kiko-LTL plasmashell[1007]: Both point size and pixel size set. Using pixel size.
фев 07 07:35:47 Kiko-LTL plasmashell[1007]: Both point size and pixel size set. Using pixel size.
фев 07 07:35:47 Kiko-LTL plasmashell[1007]: Both point size and pixel size set. Using pixel size.
фев 07 07:35:47 Kiko-LTL plasmashell[1007]: trying to show an empty dialog
фев 07 07:35:47 Kiko-LTL plasmashell[1007]: trying to show an empty dialog
фев 07 07:35:51 Kiko-LTL plasmashell[1007]: Trying to use rootObject before initialization is completed, whilst using setInitializationDelayed. Forcing completion
фев 07 07:35:52 Kiko-LTL plasmashell[1007]: Both point size and pixel size set. Using pixel size.
фев 07 07:35:54 Kiko-LTL plasmashell[1007]: trying to show an empty dialog
фев 07 07:35:54 Kiko-LTL plasmashell[1007]: KAStatsFavoritesModel::setFavorites is ignored
фев 07 07:35:54 Kiko-LTL plasmashell[1007]: trying to show an empty dialog
фев 07 07:35:55 Kiko-LTL kernel: kauditd_printk_skb: 61 callbacks suppressed
фев 07 07:36:01 Kiko-LTL plasmashell[1007]: kf5.kio.core: We got some errors while running testparm "Load smb config files from /etc/samba/smb.conf\nError loading services.\n"
фев 07 07:36:05 Kiko-LTL plasmashell[1007]: kf5.kio.core: We got some errors while running 'net usershare info'
фев 07 07:36:05 Kiko-LTL plasmashell[1007]: kf5.kio.core: "Can't load /etc/samba/smb.conf - run testparm to debug it\n"
фев 07 07:36:05 Kiko-LTL plasmashell[1007]: file:///usr/share/plasma/plasmoids/org.kde.plasma.notifications/contents/ui/NotificationDelegate.qml:113: ReferenceError: appIcon is not defined
фев 07 07:36:06 Kiko-LTL plasmashell[1007]: file:///home/kiko/.local/share/plasma/plasmoids/org.kde.simpleMonitor/contents/ui/main.qml:114: Error: Cannot assign [undefined] to QString
фев 07 07:36:06 Kiko-LTL kdeinit5[1579]: Qt: Session management error: networkIdsList argument is NULL
фев 07 07:36:08 Kiko-LTL plasmashell[1007]: QQuickItem::stackAfter: Cannot stack StatusNotifierItem_QMLTYPE_294(0x55f7e5b717d0, parent=0x55f7e4846210, geometry=0,0 0x0) after StatusNotifierItem_QMLTYPE_294(0x55f7e50e1ff0), which must be a sibling
фев 07 07:36:12 Kiko-LTL baloo_file[1003]: QObject::connect(Solid::StorageAccess, Baloo::StorageDevices): invalid null parameter
фев 07 07:36:36 Kiko-LTL kwin_x11[1001]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 6678, resource id: 31457684, major code: 18 (ChangeProperty), minor code: 0
фев 07 07:36:36 Kiko-LTL kwin_x11[1001]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 6683, resource id: 31457685, major code: 18 (ChangeProperty), minor code: 0
фев 07 07:37:28 Kiko-LTL baloo_file_extractor[2363]: QCoreApplication::arguments: Please instantiate the QApplication object first
фев 07 07:37:28 Kiko-LTL baloo_file_extractor[2363]: QCoreApplication::applicationDirPath: Please instantiate the QApplication object first
фев 07 07:37:28 Kiko-LTL baloo_file_extractor[2363]: This process needs a QCoreApplication instance in order to use KCrash
фев 07 07:37:36 Kiko-LTL baloo_file_extractor[2385]: QCoreApplication::arguments: Please instantiate the QApplication object first
фев 07 07:37:36 Kiko-LTL baloo_file_extractor[2385]: QCoreApplication::applicationDirPath: Please instantiate the QApplication object first
фев 07 07:37:36 Kiko-LTL baloo_file_extractor[2385]: This process needs a QCoreApplication instance in order to use KCrash
фев 07 07:37:41 Kiko-LTL baloo_file_extractor[2404]: QCoreApplication::arguments: Please instantiate the QApplication object first
фев 07 07:37:41 Kiko-LTL baloo_file_extractor[2404]: QCoreApplication::applicationDirPath: Please instantiate the QApplication object first
фев 07 07:37:41 Kiko-LTL baloo_file_extractor[2404]: This process needs a QCoreApplication instance in order to use KCrash

Xorg.log:

[    26.089] Current Operating System: Linux Kiko-LTL 4.20.3-1-MANJARO #1 SMP PREEMPT Fri Jan 18 17:23:21 UTC 2019 x86_64
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[    26.089] (==) Log file: "/var/log/Xorg.0.log", Time: Thu Feb  7 07:34:39 2019
[    26.472] (WW) The directory "/usr/share/fonts/OTF" does not exist.
[    26.472] (WW) The directory "/usr/share/fonts/Type1" does not exist.
[    26.539] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/100dpi".
[    26.540] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/75dpi".
[    26.540] (WW) Ignoring unrecognized extension "Composite"
[    26.566] (WW) Open ACPI failed (/var/run/acpid.socket) (No such file or directory)
[    26.980] (II) Initializing extension MIT-SCREEN-SAVER

systemctl failed:

0 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.

I will try what you said too as soon as I can and reply back

The delay on shutdown may be from network shares (if you have any). Your problem can probably be easily fixed with a systemd service. @dglt knows how to write those. The only thing I might mention is you can't just rmmod the iwlwifi driver on it's own. You need to remove the associated module(s) first.

See here:

You should open a separate thread for any GPU issues.

1 Like

I was just about to say that the script he gave me doesn't seem to work, which may be because the command sudo modprobe -r iwlwifi produces a fatal error because iwlwifi is still in use.
And as for my GPU, I actually haven't used it enough to even know if there is an issue, I just got concerned since inxi showed that my nvidia gpu didn't have a driver and I also couldn't install nvidia x server settings because they conflicted with the kernel or something, but if it really is a problem I'll try asking about it separately

Yes, that is because you need to remove the associated module(s) first. The commands are on the link I posted. You must of course substitute your specs.

Would this be the result?

nmcli networking off

sudo systemctl stop NetworkManager

sudo ip link set wlp3s0 down

sudo lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs sudo rmmod

sudo modprobe iwlwifi

sudo ip link set wlp3s0 up

sudo systemctl start NetworkManager

nmcli networking on

Just wanna make sure before I try anything. I only don't know what to replace iwldvm with, if anything.

Yes that is correct. No further changes required.

Hey that actually completely worked, now I just need to figure out how to set it to automatically execute after resume. But if it is actually this simple, why hasn't the source of problem itself been fixed yet by the Manjaro team?

EDIT: except that I don't know how to accomplish the automation. Looking at some previous threads seems to say that I need to create a .service file in /etc/systemd/system/, and I need to specify the absolute path to each command and then the command arguments? Is that right? Do I for example have to specify ExecStart=/usr/bin/nmcli networking off and so on for every command?

Well I tried making a test script based on my limited understanding. Would this work?

#/etc/systemd/system/network-resume.service
#sudo systemctl enable network-resume.service
[[Unit]
Description=Fix network after suspend
After=suspend.target

[Service]
Type=oneshot
ExecStartPre=/bin/sleep 5s
ExecStart=/bin/nmcli networking off; systemctl stop NetworkManager; ip link set wlp3s0 down; lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs sudo rmmod; sleep 3s; modprobe iwlwifi; ip link set wlp3s0 up; systemctl start 
NetworkManager; nmcli networking on

[Install]
WantedBy=suspend.target

That is an excellent first attempt at a systemd unit. You may find that you have to split the commands into two different scripts. One half is executed prior to suspend, and the remainder is executed at resume.

it may work the way you have it now because your issue seems like a minor problem compared to most suspend issues.

Good work.

Currently I'm in class so I'm not completely sure if the problem is on my side or the ■■■■■■ wifi, but I don't think I have to do anything prior to suspending, since when I was entering the commands manually I didn't do anything before suspending and it worked. I also wrote another script that also seems to work that I execute with the sh command over here

nmcli networking off
sleep 1s
sudo systemctl stop NetworkManager
sleep 1s
sudo ip link set wlp3s0 down
sleep 1s
sudo lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs sudo rmmod
sleep 3s
sudo modprobe iwlwifi
sleep 1s
sudo ip link set wlp3s0 up
sleep 2s
sudo systemctl start NetworkManager
sleep 1s
nmcli networking on 

and it seems to work, so now I just have to convert it to a systemd service script?
Edit: I only wish sleep commands could go down to milliseconds.

P.S. can I have multiple ExecStart in the .service file?

That's great that if it works, but you may find sometimes it doesn't without shutting the components down prior to suspending. If it works all the time that way then that's great. If it acts up now and then you know what to do (if it is bothering you).

Yes with the "oneshot" option you can have multiple ExecStart lines.

You can mostly get rid of the sleep commands without issues. On some peoples systems it causes problems (so I always add them in just in case).

The most important sleep command is the one between unloading and loading the module.

Well in the end I created this file here

sudo nano /etc/systemd/system/network-resume.service 

There I pasted this

#/etc/systemd/system/network-resume.service
#sudo systemctl enable network-resume.service
[[Unit]
Description=Fix network after suspend
After=suspend.target

[Service]
Type=oneshot
ExecStartPre=/bin/sleep 3s
ExecStart=/bin/nmcli networking off; sleep 1s; systemctl stop NetworkManager; sleep 1s; ip link set wlp3s0 down; sleep 1s; lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs rmmod; sleep 3s
ExecStart=/bin/modprobe iwlwifi; sleep 1s; ip link set wlp3s0 up; sleep 2s; systemctl start NetworkManager; sleep 1s; nmcli networking on 

[Install]
WantedBy=suspend.target

Afterwards I executed

sudo chown root:root /etc/systemd/system/network-resume.service
sudo chmod +x /etc/systemd/system/network-resume.service
sudo systemctl enable network-resume.service

And now I guess we wait to see if the problem is gone for good.

1 Like

Actually, I don't know if I made a mistake anywhere, but that script doesn't appear to actually execute on resume. Instead I manually executed my own script with sh, but even then the internet connection isn't restored until roughly 30 seconds to a minute after the script is executed, sometimes even longer. It's really not consistent at all. Now that I'm home I know the problem isn't coming from the wifi itself. On my first attempt it only started working 30 seconds after manually executing the script cause the automatic one didn't work, but then I suspended it again and now on my 2nd attempt I've already ran the script twice to no avail.

Actually belay that, I think I've discovered the source of the interference. It turns out the automatic script was working fine, but my VPN wasn't restarting its connection upon resume. So basically, if I suspended and resumed my laptop with my VPN disabled, it would work fine, but if I did so with my VPN enabled, I'd have to manually restart its connection. Hold on I'm gonna test one more thing.

Forum kindly sponsored by