Fun with suspending, systemd, and sessions

Forum rules
We don't support installations in VirtualBox, VMWare, qemu or others. We ignore posts about WINE, PlayOnLinux, Steam and Skype. We don't support btrfs, lvm, UEFI, side-by-side installations with GPT or dualboot with anything newer than Windows XP.
Google your problem first. Check the Wiki. Read the existing threads. It's okay to "hijack" an existing thread, yes! If your problem is not yet covered, open a new thread. To get the quickest possible help, mention the exact release codename in your post (uname -a is a good idea, too). Due to the lack of crystal balls, attach the output of lspci -nnk if you encounter hardware problems.
MrCyborgBear
Virgin
Posts: 8
Joined: Tue Nov 05, 2013 9:52 pm

Fun with suspending, systemd, and sessions

Unread post by MrCyborgBear » Sat Nov 30, 2013 6:00 am

I'm on Arrogance right now, and everything is going fairly smoothly, other than the grayed out suspend/hibernate buttons in the logout screen and the xfce power manager.

Naively, I set out to fix this tonight, and I've just gotten stuck. Here's what I've done so far, all for the goal of being able to run systemctl suspend without needing sudo and possibly getting those buttons working:

1) Disabled consolekit per this thread: http://linuxbbq.org/bbs/viewtopic.php?f ... consolekit after reading this page on the Arch wiki https://wiki.archlinux.org/index.php/ConsoleKit (also removed ck-session-launch from xinitrc)
At this point, the buttons are still grayed out

2) I run the loginctl at the bottom of the wiki page, and discover my user is not active. I did fix this by changing the contents of /etc/X11/xinit/xserverrc to the fix in this bug report, https://bugs.archlinux.org/task/32206

Code: Select all

#!/bin/bash

if [[ -z $XDG_VTNR ]]; then
exec /usr/bin/X -nolisten tcp "$@"
else
exec /usr/bin/X -nolisten tcp "$@" vt$XDG_VTNR
fi
And, what do you know, my user is active after a reboot! I celebrated my small victory, the buttons are still grayed out at this point though, but i figured at least i could suspend without needing sudo. But I was wrong.
Unfortunately, i get this message after running "systemctl suspend"

Code: Select all

ian@gillian:~$ systemctl suspend
Failed to issue method call: Access denied
Failed to issue method call: Access denied


So after checking around, I haven't found any solution to this. It isn't a big deal, i can always just create a rule in the sudoers file to get around having to enter my password, but I really want to know why this isn't working.

On that wiki page, it said starting with polkit .107-4, systemd-logind would be required instead of consolekit, but the version in the debian repos is only .105-4. Does it still need consolekit for some reason? Is there something else I'm missing? Also, if anyone had a fix for the buttons, it would be much appreciated :)

User avatar
wuxmedia
Grasshopper
Posts: 6454
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: Fun with suspending, systemd, and sessions

Unread post by wuxmedia » Sat Nov 30, 2013 10:43 am

Well you have been having fun.
If you want to suspend by CLI, install;
pm-tools or pm-utils (can't remember)
if you want your icons and suspend on lid down, install a display manager.
"Seek, and Ye shall find"
"Github | Chooons | Site"

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Fun with suspending, systemd, and sessions

Unread post by machinebacon » Sat Nov 30, 2013 11:24 am

This sounds quite good so far, congratulations. About the systemctl without root permissions, take a look at visudo (sudo visudo) and you find that I have already added the /sbin/reboot and /sbin/poweroff commands to NOPASSWD. You might add the /sbin/sysctl there, if not already existing.

I am not quite sure what exactly is needed to get this to run, but polkit can be manipulated with the files in
/usr/share/polkit-1/actions/org.freedesktop.upower.policy
/usr/share/polkit-1/actions/org.freedesktop.upower.qos.policy


Check there if you find these lines: <allow_active>yes</allow_active>


Save and reboot, and upower should then handle the suspend/hibernation (which is always a bit of a PITA in Linux). Of course, for hibernation, make sure you have sufficient swap space (I would suggest around 2, better 4GB)
..gnutella..

User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: Fun with suspending, systemd, and sessions

Unread post by DebianJoe » Sat Nov 30, 2013 9:44 pm

If you have a legitimate single-user session (and nobody else is logged in via another tty) validated through polkit, I thought that systemctl allowed non-root use of suspend.

Interesting.
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

MrCyborgBear
Virgin
Posts: 8
Joined: Tue Nov 05, 2013 9:52 pm

Re: Fun with suspending, systemd, and sessions

Unread post by MrCyborgBear » Sat Nov 30, 2013 10:35 pm

@wuxmedia: I'm definitely going with pm-utils if I can't get my session working properly. Also, I'd use a display manager, but that would be too easy :)

@machinebacon: The allow_active lines are set to yes, so I don't understand why I can't suspend, even though my session is listed as active

@DebianJoe:

here is the output from loginctl list-sessions:

Code: Select all

ian@gillian:~$ loginctl list-sessions
   SESSION        UID USER             SEAT            
        c1       1000 ian              seat0           

1 sessions listed.
and then here's the result from loginctl:

Code: Select all

ian@gillian:~$ loginctl show-session c1 
Id=c1
Timestamp=Sat 2013-11-30 07:37:14 EST
TimestampMonotonic=51252279
DefaultControlGroup=systemd:/user/1000.user/c1.session
VTNr=1
TTY=/dev/tty1
Remote=no
Service=login
Leader=1167
Audit=0
Type=tty
Class=user
Active=yes
State=active
KillProcesses=no
IdleHint=yes
IdleSinceHint=1385815032340482
IdleSinceHintMonotonic=49313085
Name=ian


So as far as I can tell, I'm the only user logged in, and my state is active, but polkit isn't accepting that for some reason and wont allow me to use systemctl suspend/poweroff/reboot/hibernate/etc. Also, policykit-1 does depend on consolekit, so maybe i still need that for some reason (the package isn't removed, it just isn't loaded)? I guess I'll install arrogance in a VM and try and get suspend working with consolekit, and if that works I'll use consolekit for now.

User avatar
wuxmedia
Grasshopper
Posts: 6454
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: Fun with suspending, systemd, and sessions

Unread post by wuxmedia » Sat Nov 30, 2013 11:10 pm

RE: DM's - yeah, I went with easy 8)
kudos for doing it another way!
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: Fun with suspending, systemd, and sessions

Unread post by DebianJoe » Sat Nov 30, 2013 11:42 pm

Hmmm, I've got the same issue with BBQTiny if I attempt systemctl-suspend as a user which is something I've not attempted previously. It does work with ck-session being activated, although it still prompts for user password, which IMHO is bloat since I don't use graphical buttons..and if I'm going to enter a password, it might as well be root's. If you are using a single-user system, I think that the visudo hack is still the best route for efficiency's sake.

I'm interested in how this works out, more from an observational standpoint than anything. Perhaps the transition to systemd isn't flawless in Debian yet, as hard as that might be to believe.... ;)
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Fun with suspending, systemd, and sessions

Unread post by machinebacon » Sun Dec 01, 2013 3:23 am

Yes, [it] is especially ridiculous if we consider the fact that a 'suspend at close lid' works, and it would even work if a guest in my apartment would close the lid for fun.
..gnutella..

MrCyborgBear
Virgin
Posts: 8
Joined: Tue Nov 05, 2013 9:52 pm

Re: Fun with suspending, systemd, and sessions

Unread post by MrCyborgBear » Sun Dec 01, 2013 6:09 pm

Alright, I found this interesting bug report from someone running fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1012650

They've fixed it on their end, and I haven't found a similar bug anywhere from debian, so it might be the fault of systemd and consolekit. It's beyond me to fix, and I don't really want to put any more time into it for now, considering I can suspend through the console. Oh well, I gave it a good run. Should I mark this as resolved or something else?

User avatar
wuxmedia
Grasshopper
Posts: 6454
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: Fun with suspending, systemd, and sessions

Unread post by wuxmedia » Sun Dec 01, 2013 6:20 pm

[Pending] ??

as you wish, cool with me to leave it open.
"Seek, and Ye shall find"
"Github | Chooons | Site"

Post Reply