Stop hibernation on a Linux laptops to make it a server (SUSE Leap 16 version)
The best camera is the one that you have with you when you want to take a photo, and the best server is the one that you have already…
Stop hibernation on a Linux laptops to make it a server (SUSE Leap 16 version)
The best camera is the one that you have with you when you want to take a photo, and the best server is the one that you have already bought.
Actually, laptops are optimized for power consumption, so if you are not looking for amazing performance, you can use an old one and run VM and containers on it.
The only problem is that laptops have a screen attached, and they usually get into hibernation or plainly switch off when you close it (to avoid wasting energy).
Fortunately for us, there is an easy way of stopping this from happening when you are using Linux.
Closing the lead will trigger systemd and by default it will hibernate the system. Let’s modify that behaviour in a few seconds:
chargio@leap:> more /usr/lib/systemd/logind.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file (or a copy of it placed in
# /etc/ if the original file is shipped in /usr/), or by creating "drop-ins" in
# the /etc/systemd/logind.conf.d/ directory. The latter is generally
# recommended. Defaults can be restored by simply deleting the main
# configuration file and all drop-ins located in /etc/.
#
# Use 'systemd-analyze cat-config systemd/logind.conf' to display the full config.
#
# See logind.conf(5) for details.
[Login]
...
#HandleLidSwitch=suspend
#HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore
...
The file has many other lines, but let’s focus on those that are relevant:
- It is part of the [Login] configuration for systemd-logind
- It has different options when you are using if with battery, external power, or docked.
We need to uncomment those lines and put those in your configuration, let’s do it properly. We can’t just modify the file in place, because it will be overwritten with any package update.
a) We could copy the full file to /etc/systemd/logind.conf, and make sure that any change on the file is always synchronized. But then we will have to make sure that every other option has been accounted for.
b) We can create a file under /etc/systemd/logind.conf.d/ that only includes the changes we want. Easier to maintain, and if you want to update another server, you just need to copy that file, independent of any other option in the file. Let’s do that.
chargio@leap:~> sudo vim /etc/systemd/logind.conf.d/logind_no_power.conf
[Login]
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
chargio@leap:~>
Write and restart the service (or reboot to be safe)
chargio@leap:~> sudo systemctl restart systemd-logind.service
Done. You can now safely close the lid and connect using SSH or Cockpit to get remote access.
You can learn this and many other things about Linux and SUSE Linux in my new book SUSE Linux Enterprise Server 16 Official Administration Guide: https://www.packtpub.com/en-us/product/suse-linux-enterprise-server-16-official-administration-guide-9781806021598
The book is also available in Amazon (ebook and paper):
메타데이터
- post_id
- fbd60ecb4066
- slug
- stop-hibernation-on-a-linux-laptops-to-make-it-a-server-suse-leap-16-version-fbd60ecb4066
- url
- https://medium.com/@chargio/stop-hibernation-on-a-linux-laptops-to-make-it-a-server-suse-leap-16-version-fbd60ecb4066
- canonical_url
- https://medium.com/@chargio/stop-hibernation-on-a-linux-laptops-to-make-it-a-server-suse-leap-16-version-fbd60ecb4066
- author_url
- https://medium.com/@chargio
- status
- ok
- fetched_at
- 2026-06-13 07:35:29