Отключаем действия по закрытия крышки в Ubuntu Server | Zhbert’s Home
Zhbert's Home
Домашняя страничка Zhbert'а

Отключаем действия по закрытия крышки в Ubuntu Server

СТАТЬИ / LINUX / ОТКЛЮЧАЕМ ДЕЙСТВИЯ ПО ЗАКРЫТИЯ КРЫШКИ В UBUNTU SERVER

Если нужно сделать так, что ноутбук с серверной версией Ubuntu не переходил в сон при закрытии крышки, то нужно в файле /etc/systemd/logind.conf раскомментировать строку HandleLidSwitch=ignore, заменив значение параметра со switch на ignore.

Должно получиться так:

#  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 by creating "drop-ins" in
# the logind.conf.d/ subdirectory. The latter is generally recommended.
# Defaults can be restored by simply deleting this file and all drop-ins.
#
# Use 'systemd-analyze cat-config systemd/logind.conf' to display the full config.
#
# See logind.conf(5) for details.

[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#UserStopDelaySec=10
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
HandleLidSwitch=ignore
#HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore
#HandleRebootKey=reboot
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#RebootKeyIgnoreInhibited=no
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RuntimeDirectoryInodesMax=400k
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192

И затем перезапустить сервис:

sudo service systemd-logind restart