This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Do not disable internet connection when computer is locked

Tags: None
(comma "," separated)
dualkem
Registered Member
Posts
4
Karma
0
Hello! I am running Kubuntu 20.04 on my notebook, which I've turned into a laptop/server machine. I want to have the notebook locked when I'm closing the lid, so disabling the lock screen is not an option, since I want the server to be secure. However, my problem is that KDE shuts down the Ethernet connection (wired) when I close the lid and the computer locks. I suspect that NetworkManager has something to do with this. If you could help me keep both the lock screen and the internet connection, I would be very grateful. Thank you in advance!
dualkem
Registered Member
Posts
4
Karma
0
I've solved it! So basically, KDE was not the cause of this. It was systemd. For the certain someone that will search for this in the future, here's how I did it:#
So, in order to disable the systemd part of acting on the lid-closed action, you need to modify some values in /etc/systemd/logind.conf:
#HandleLidSwitch=suspend
#HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore
Uncomment them by removing the # in front of the lines, and set the "suspend" values to "ignore". In the end, this is how they should look like:
------ Rest of logind.conf --------
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
------ Rest of logind.conf ---------
This will cause systemd to stay out, but you can still tell KDE what to do, since it will function independently of systemd's actions. So, in my case, I told KDE to lock the screen.
This was it. Thank you!
User avatar
claydoh
Registered Member
Posts
1170
Karma
9
OS
The power options in System Settings do not work for these options? I have always used this do do set the options you are using.


claydoh, proud to be a member of KDE forums since 2008-Oct, and KDE user since 2001
dualkem
Registered Member
Posts
4
Karma
0
claydoh wrote:The power options in System Settings do not work for these options? I have always used this do do set the options you are using.


They do work, but systemd tries to be smart and does some additional (in my case, unwanted things). I tried setting all Lid Closed actions to "Lock Screen" in KDE, and they do work, however, there's more to it.
In a nutshell, when I close the lid two things happen in my system: KDE (based on the System Settings) locks the Desktop Environment, which is exactly what I want it to do, but the problem is that systemd also notices that the lid has been closed, and proceeds to suspend some additional services (like networking). After all, in a normal PC, if you close the lid of the laptop, you don't need internet anymore. However, in my case, having no internet is bad news for Apache, Postfix, etc., that's why I have to explicitly tell systemd to mind its own business and let KDE do its thing.
User avatar
claydoh
Registered Member
Posts
1170
Karma
9
OS
Ahh, perhaps it is device specific as well, as my networking never shut off in this case, or rather the wifi stayed on, the settings only account for this type of connection, and not a wired one.

In any matter, this is probably not specific to KDE or plasma, if Systemd is the problem here.


claydoh, proud to be a member of KDE forums since 2008-Oct, and KDE user since 2001
knapps
Registered Member
Posts
6
Karma
0
From the anticipated future user to OP: thank you for posting this as well as the clear explanation of what's going on! Same issue on KDE neon.


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Google [Bot], Sogou [Bot]