Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Xfce no suspend, hybernate, restart, .... as a user [Solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
skorefish
Apprentice
Apprentice


Joined: 21 Jun 2015
Posts: 277

PostPosted: Sat Dec 16, 2017 10:49 pm    Post subject: Xfce no suspend, hybernate, restart, .... as a user [Solved] Reply with quote

hello,

When i login to xfce as a user the functions suspend, hybernate are no longer visible, and restart shutdown is greyed out.
This works as root so i think it has something to do with permissions.
I login manualy by typing startxfce4 in user mode

I want to give more information, but i have no clue where to start..

help appreciated


Last edited by skorefish on Mon Dec 18, 2017 8:14 pm; edited 1 time in total
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7051
Location: almost Mile High in the USA

PostPosted: Sun Dec 17, 2017 7:08 am    Post subject: Reply with quote

Has it ever worked on your current installation?

I will have to assume you're using openrc - so, do you have either USE=consolekit or using elogind? You'll need to use one or the other. Knowing which you're using will lead to next steps...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
skorefish
Apprentice
Apprentice


Joined: 21 Jun 2015
Posts: 277

PostPosted: Sun Dec 17, 2017 7:39 am    Post subject: Reply with quote

Yes openrc + consolekit.

ok i found a solution, i don't know if this is the standard way...

vi /etc/polkit-1/rules.d/00-check.rules
Code:
polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.consolekit.system.restart" ||
        action.id == "org.freedesktop.consolekit.system.stop" ||
        action.id == "org.freedesktop.consolekit.system.suspend" ||
        action.id == "org.freedesktop.consolekit.system.hibernate" )
    {
        return polkit.Result.YES;
    }
});
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7051
Location: almost Mile High in the USA

PostPosted: Sun Dec 17, 2017 8:43 am    Post subject: Reply with quote

Did you get a consolekit session (check with ck-list-sessions)? Were you using ck-launch-session?

Just want to make sure you got a session since you're logging in manually.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
C5ace
Apprentice
Apprentice


Joined: 23 Dec 2013
Posts: 266
Location: Brisbane, Australia

PostPosted: Sun Dec 17, 2017 9:51 am    Post subject: Reply with quote

I use SLIM as Display Manager. SWAP must be larger than RAM. I.e. If you have 8GB RAM, your SWAP partition must be say 8.8GB in sise.

Part of my installation script:

# Install X
emerge xorg-server
rc-update add xdm default
env-update && source /etc/profile
echo XSESSION="Xfce4" > /etc/env.d/90xsession

# Install Xfce
emerge xfce-base/xfce4-meta
emerge x11-terms/xfce4-terminal
emerge app-editor/leafpad
emerge app-portage/porthole
env-update && source /etc/profile
export PS1="(USB_P64) $PS1"
# /etc/init.d/dbus start
rc-update add dbus default
rc-update add xdm default

emerge x11-misc/slim

# Editing /etc/conf.d/xdm
# nano -wc /etc/conf.d/xdm
# DISPLAYMANAGER="slim"
echo "CHECKVT=7" > /etc/conf.d/xdm
echo "DISPLAYMANAGER=\"slim\"" >> /etc/conf.d/xdm
rc-update add xdm default

Good luck.
Back to top
View user's profile Send private message
skorefish
Apprentice
Apprentice


Joined: 21 Jun 2015
Posts: 277

PostPosted: Sun Dec 17, 2017 10:15 pm    Post subject: Reply with quote

Code:
Session1:
   unix-user = '1000'
   realname = '(null)'
   seat = 'Seat1'
   session-type = 'unspecified'
   session-class = 'user'
   session-state = 'online'
   active = FALSE
   x11-display = ''
   x11-display-device = ''
   display-device = '/dev/tty1'
   remote-host-name = ''
   is-local = TRUE
   on-since = '2017-12-17T00:30:54.480432Z'
   login-session-id = '3'
   XDG_RUNTIME_DIR = '/var/run/user/1000'
   VTNr = '1'


@C5ace : thanks for the tip, but on this machine i don't want to install a display manager
Back to top
View user's profile Send private message
C5ace
Apprentice
Apprentice


Joined: 23 Dec 2013
Posts: 266
Location: Brisbane, Australia

PostPosted: Mon Dec 18, 2017 12:21 am    Post subject: Reply with quote

Quote:

@C5ace : thanks for the tip, but on this machine i don't want to install a display manager


Try as I said and verify that "Suspend", etc works when in Xfce. When everything it works, change
in /etc/conf.d/xdm: DISPLAYMANAGER="slim" back to "xdm" and test again.

I don't know if slim must be installed for "Suspend" to work.

If OK, run "emerge --unmerge slim" and test again.
Then "emerge --depclean" and "revdep-rebuild" to clean up.

If "Suspend" does not work, re-install slim.

Are using a Desktop or Laptop?
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7051
Location: almost Mile High in the USA

PostPosted: Mon Dec 18, 2017 2:00 am    Post subject: Reply with quote

C5ace, shutdown/reboot/hibernate buttons should work even without a display manager. The key is that consolekit is setup properly, and the display manager isn't needed to set up a consolekit session.

skorefish, though hacking in that polkit rule will work -- the default install when you installed consolekit/polkit it should work that way out of the box and there should not be a need to override the default behavior.

The risk of the rule you wrote is that a remote user can get a session through vnc and shut down your computer - a security hole!

Not sure why your session active = FALSE... that seems a bit weird.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
ct85711
Veteran
Veteran


Joined: 27 Sep 2005
Posts: 1692

PostPosted: Mon Dec 18, 2017 5:13 am    Post subject: Reply with quote

Well, the active=false is indicating that when he logged in, it didn't go through consolekit. I performed a couple tests on my end; and logged in through the virtual terminal 1 (not through slim), I got the same results for the ck-list-sessions, this also includes if you start X11 from command shell (i.e. startx). The results are similar when you login remotely in that active=false. The only time I got active=true is when I logged in directly through slim. Another indicator he logged in through the virtual terminal, is that x11-display = '' and VTNr = '1'.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7051
Location: almost Mile High in the USA

PostPosted: Mon Dec 18, 2017 6:05 am    Post subject: Reply with quote

Actually I think active=false means that you're not the "active" display manager session, though I'm not sure what it should do when you don't have a display manager set up.

---

Ok, I think I sort of found out what's going on.

The power-manager program needs to be under the same consolekit session to allow shutdowns.

Now on my machine I tried disabling the display manager (though my login does get a consolekit session):
(as root) /etc/init.d/xdm stop
Now when I login as a normal user, I still get a session with active=TRUE and display-device=/dev/tty1 .

When I try "startxfce4" - xfce4 starts but I do not get halt/suspend buttons and the shutdown/reboot buttons are grayed.

However if I "startxfce4 --with-ck-session" -- then it works.

Problem is that when X starts, the terminal changes, and that new terminal tty7 does not have consolekit privileges. The new consolekit session started with --with-ck-session solves the problem.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
skorefish
Apprentice
Apprentice


Joined: 21 Jun 2015
Posts: 277

PostPosted: Mon Dec 18, 2017 8:55 am    Post subject: Reply with quote

Quote:
However if I "startxfce4 --with-ck-session" -- then it works.


do you mean "startxfce4 --with-ck-launch" ?
now i get
Code:
Session1:
   unix-user = '1000'
   realname = '(null)'
   seat = 'Seat1'
   session-type = 'unspecified'
   session-class = 'user'
   session-state = 'online'
   active = FALSE
   x11-display = ''
   x11-display-device = ''
   display-device = '/dev/tty1'
   remote-host-name = ''
   is-local = TRUE
   on-since = '2017-12-17T00:30:54.480432Z'
   login-session-id = '3'
   XDG_RUNTIME_DIR = '/var/run/user/1000'
   VTNr = '1'
Session2:
   unix-user = '1000'
   realname = '(null)'
   seat = 'Seat1'
   session-type = 'unspecified'
   session-class = 'user'
   session-state = 'active'
   active = TRUE
   x11-display = ':0'
   x11-display-device = '/dev/tty7'
   display-device = '/dev/tty1'
   remote-host-name = ''
   is-local = TRUE
   on-since = '2017-12-18T08:42:43.567832Z'
   login-session-id = '3'
   XDG_RUNTIME_DIR = '/var/run/user/1000'
   VTNr = '7'
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7051
Location: almost Mile High in the USA

PostPosted: Mon Dec 18, 2017 10:02 am    Post subject: Reply with quote

Does it work now, without your hack?
It allowed my machine's power management buttons to work when starting X11 without the display manger (lightdm) started. Without the flag, it did not allow power management.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
skorefish
Apprentice
Apprentice


Joined: 21 Jun 2015
Posts: 277

PostPosted: Mon Dec 18, 2017 8:12 pm    Post subject: Reply with quote

Quote:
Does it work now, without your hack?

Yes !!! i removed the hack and it still works... Thnx :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum