[Solved] LM20.3 systemctl hibernate: failed to hibernate system via logind: Access denied

Questions about hardware, drivers and peripherals
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
yoru
Level 1
Level 1
Posts: 3
Joined: Tue Jan 25, 2022 11:38 pm

[Solved] LM20.3 systemctl hibernate: failed to hibernate system via logind: Access denied

Post by yoru »

I setup hibernate on my machine and use `systemctl hibernate` to hibernate, but a password prompt is shown and if i don't input my password, I will be greeted with this error:

Code: Select all

Failed to hibernate system via logind: Access denied
Failed to start hibernate.target: Access denied
See system logs and 'systemctl status hibernate.target' for details.
If i use `sudo systemctl hibernate` or input my password, my machine hibernate successfully.

So how I can use `systemctl hibernate` without the need to use sudo or enter my password?


System info:

Code: Select all

System:    Kernel: 5.13.0-27-generic x86_64 bits: 64 compiler: N/A Desktop: i3 4.17.1 dm: LightDM Distro: Linux Mint 20.3 Una
           base: Ubuntu 20.04 focal
Machine:   Type: Laptop System: Acer product: Aspire A515-54 v: V1.24 serial: <filter>
           Mobo: CML model: Doc_WC v: V1.24 serial: <filter> UEFI: Insyde v: 1.24 date: 07/07/2021
Battery:   ID-1: BAT1 charge: 18.8 Wh condition: 35.1/47.8 Wh (73%) volts: 11.0/11.2 model: LGC AP18C8K serial: <filter>
           status: Discharging
           Device-1: hidpp_battery_0 model: Logitech MX Anywhere 3 serial: <filter> charge: 60% status: Discharging
CPU:       Topology: Quad Core model: Intel Core i5-10210U bits: 64 type: MT MCP arch: Kaby Lake rev: C L2 cache: 6144 KiB
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 33599
           Speed: 1502 MHz min/max: 800/4200 MHz Core speeds (MHz): 1: 1004 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 800
Graphics:  Device-1: Intel UHD Graphics vendor: Acer Incorporated ALI driver: i915 v: kernel bus ID: 00:02.0
           chip ID: 8086:9b41
           Display: x11 server: X.Org 1.20.13 driver: modesetting unloaded: fbdev,vesa compositor: picom
           resolution: 1920x1080~60Hz
           OpenGL: renderer: Mesa Intel UHD Graphics (CML GT2) v: 4.6 Mesa 21.0.3 direct render: Yes
Audio:     Device-1: Intel vendor: Acer Incorporated ALI driver: snd_hda_intel v: kernel bus ID: 00:1f.3 chip ID: 8086:02c8
           Sound Server: ALSA v: k5.13.0-27-generic
Network:   Device-1: Intel Wireless-AC 9462 driver: iwlwifi v: kernel port: 4000 bus ID: 00:14.3 chip ID: 8086:02f0
           IF: wlp0s20f3 state: up mac: <filter>
           Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Acer Incorporated ALI driver: r8169
           v: kernel port: 3000 bus ID: 01:00.0 chip ID: 10ec:8168
           IF: enp1s0 state: down mac: <filter>
           IF-ID-1: vmnet1 state: unknown speed: N/A duplex: N/A mac: <filter>
           IF-ID-2: vmnet8 state: unknown speed: N/A duplex: N/A mac: <filter>
           IF-ID-3: wg-mullvad state: unknown speed: N/A duplex: N/A mac: N/A
Drives:    Local Storage: total: 2.29 TiB used: 1.70 TiB (74.5%)
           ID-1: /dev/nvme0n1 vendor: Western Digital model: PC SN520 SDAPNUW-512G-1014 size: 476.94 GiB speed: 15.8 Gb/s
           lanes: 2 serial: <filter>
           ID-2: /dev/sda vendor: Samsung model: SSD 860 QVO 2TB size: 1.82 TiB speed: 6.0 Gb/s serial: <filter>
Partition: ID-1: / size: 235.23 GiB used: 67.28 GiB (28.6%) fs: ext4 dev: /dev/nvme0n1p7
           ID-2: swap-1 size: 16.00 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/nvme0n1p6
Sensors:   System Temperatures: cpu: 43.0 C mobo: N/A
           Fan Speeds (RPM): N/A
Repos:     No active apt repos in: /etc/apt/sources.list
           Active apt repos in: /etc/apt/sources.list.d/brave-browser-release.list
           1: deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main
           Active apt repos in: /etc/apt/sources.list.d/google-chrome.list
           1: deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main
           Active apt repos in: /etc/apt/sources.list.d/official-dbgsym-repositories.list
           1: deb http://ddebs.ubuntu.com focal main restricted universe multiverse
           2: deb http://ddebs.ubuntu.com focal-updates main restricted universe multiverse
           Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list
           1: deb http://packages.linuxmint.com una main upstream import backport
           2: deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse
           3: deb http://archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse
           4: deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
           5: deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
           6: deb http://archive.canonical.com/ubuntu/ focal partner
           Active apt repos in: /etc/apt/sources.list.d/official-source-repositories.list
           1: deb-src http://packages.linuxmint.com una main upstream import backport
           2: deb-src http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse
           3: deb-src http://archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse
           4: deb-src http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
           5: deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
           6: deb-src http://archive.canonical.com/ubuntu/ focal partner
           Active apt repos in: /etc/apt/sources.list.d/sublime-text.list
           1: deb https://download.sublimetext.com/ apt/stable/
           Active apt repos in: /etc/apt/sources.list.d/teamviewer.list
           1: deb https://linux.teamviewer.com/deb stable main
Info:      Processes: 323 Uptime: 32m Memory: 15.45 GiB used: 2.17 GiB (14.0%) Init: systemd v: 245 runlevel: 5 Compilers:
           gcc: 9.3.0 alt: 9 Shell: bash v: 5.0.17 running in: alacritty inxi: 3.0.38
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
t42
Level 11
Level 11
Posts: 3742
Joined: Mon Jan 20, 2014 6:48 pm

Re: LM20.3 systemctl hibernate: failed to hibernate system via logind: Access denied

Post by t42 »

You need to edit /etc/sudoers and put there something like %LimitedAdmins ALL=NOPASSWD: your_command
-=t42=-
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: LM20.3 systemctl hibernate: failed to hibernate system via logind: Access denied

Post by smurphos »

Missing a Polkit rule?

viewtopic.php?f=42&t=284100#5
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
yoru
Level 1
Level 1
Posts: 3
Joined: Tue Jan 25, 2022 11:38 pm

Re: LM20.3 systemctl hibernate: failed to hibernate system via logind: Access denied

Post by yoru »

I want to use the command without sudo, so no sudoer here. And i think polkit rule is a good place to start, but how to do it?
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: LM20.3 systemctl hibernate: failed to hibernate system via logind: Access denied

Post by smurphos »

yoru wrote: Fri Jan 28, 2022 11:17 pm I want to use the command without sudo, so no sudoer here. And i think polkit rule is a good place to start, but how to do it?
Instructions are in the link - the polkit rule allows any user to invoke hibernation - also has the effect that a hibernation button appears on the shutdown GUI.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
yoru
Level 1
Level 1
Posts: 3
Joined: Tue Jan 25, 2022 11:38 pm

Re: LM20.3 systemctl hibernate: failed to hibernate system via logind: Access denied

Post by yoru »

Sorry, didn't see the link before. Tried to add polkit rule according to the link and it works.
Locked

Return to “Hardware Support”