jakeday / linux-surface

Linux Kernel for Surface Devices
2.59k stars 243 forks source link

error in /lib/systemd/system-sleep/sleep #559

Open lstandish opened 5 years ago

lstandish commented 5 years ago

EDIT: The report below is incorrect. I am leaving it here for reference. See my second edit below.

In /lib/systemd/system-sleep/sleep, after reloading the wifi modules, NetworkManager needs to be restarted. The current version of /lib/systemd/system-sleep/sleep tries to do that with "systemctl restart NetworkManager.service". For this to work, it should be "systemctl restart NetworkManager". After I made this change, my Surface Laptop 1 reconnects properly to wifi after suspend and hibernate. (This is too trivial to warrant a pull request.)
Thanks very much for this project! With your patched kernels and config files, I got my Surface working perfectly (except cameras).

EDIT 2: "systemctl restart NetworkManager.service" actually works, but erratically. This led to my belief that it should be "systemctl restart NetworkManager" (both forms work).

I believe recovery of the wifi connection is erratic because "systemctl restart NetworkManager.service" is executed before the modules have fully loaded. I introduced a 1 second sleep (sleep 1) in the script, right before Network Manager is restarted, and I have not seen it fail to restart again.

desimpson commented 5 years ago

Thanks very much for this project! With you patched kernels and config files, I got my Surface working perfectly (except cameras).

@lstandish What configs did you apply to get suspend working? I'm on an SL2.

e: Also which other config files helped in general? I must've missed a few posts.

lstandish commented 5 years ago

The "configs" are applied "automatically" by running this project's setup.sh file. A config file related to suspend is the one I edited, /lib/systemd/system-sleep/sleep, which unloads the wifi modules before sleep or hibernate, and reloads them afterwards (and restarts Network Manager).

See my edits to my original post. My original report was wrong. The commands to stop and restart Network Manager were correct in the original "sleep" file, but restarting of Network Manager was erratic. It would occasionally fail. I believe I discovered a simple fix (see the post).

I have a Surface Laptop 1 (2017), and both suspend and hibernate work flawlessly, as far as I can tell. (I just got it working yesterday.) I'm not sure how much battery charge is normal for suspend to lose overnight. Last night I left it suspended and it lost about 5% of charge. I'm using the latest version 5 kernel.

My first impressions is that this is the nicest Linux laptop I have ever had the pleasure to use. It's just blazing fast and EVERYTHING works except the camera(s). (I haven't tested mic)

lstandish commented 5 years ago

As a followup to my post, after adding the one-second delay before restarting Network Manager upon recovery from suspend or hibernate, I have not seen the wifi fail to come up.