Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
need to restart elogind on switching users
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
spyuser
n00b
n00b


Joined: 17 May 2020
Posts: 4
Location: earth/milkyway

PostPosted: Sun May 17, 2020 1:50 pm    Post subject: need to restart elogind on switching users Reply with quote

Hi,

i have a little problem with elogind, slim & fluxbox.
when i log out and log in again, i cannot change or restart my network-connection with nm-applet or shutdown, reboot and so on.

if I try it manually:
Code:

user@spybox/~: loginctl reboot
==== AUTHENTICATING FOR org.freedesktop.login1.reboot ====
Authentication is required for rebooting the system.
Authenticating as: root
Password:


It only works with every odd login (1st, 3rd, 5th ...), but with even logins I am not privileged the change networkingsettings etc.

But it also works if I restart elogind
Code:
rc-service elogind restart
before logging in again.
I use OpenRC, fluxbox, elogind and lim. it looks like i forgot some settings after switching from console-kit to elogind :?:

thx
Back to top
View user's profile Send private message
Fitzcarraldo
Veteran
Veteran


Joined: 30 Aug 2008
Posts: 1873
Location: United Kingdom

PostPosted: Sun May 17, 2020 4:08 pm    Post subject: Reply with quote

My guess is that your problem is something to do with Polkit authorisations.

Code:
meshedgedx ~ # grep "org.freedesktop.login1.reboot" /usr/share/polkit-1/actions/*
/usr/share/polkit-1/actions/org.freedesktop.login1.policy:        <action id="org.freedesktop.login1.reboot">
/usr/share/polkit-1/actions/org.freedesktop.login1.policy:        <action id="org.freedesktop.login1.reboot-multiple-sessions">
/usr/share/polkit-1/actions/org.freedesktop.login1.policy:                <annotate key="org.freedesktop.policykit.imply">org.freedesktop.login1.reboot</annotate>
/usr/share/polkit-1/actions/org.freedesktop.login1.policy:        <action id="org.freedesktop.login1.reboot-ignore-inhibit">
/usr/share/polkit-1/actions/org.freedesktop.login1.policy:                <annotate key="org.freedesktop.policykit.imply">org.freedesktop.login1.reboot</annotate>
/usr/share/polkit-1/actions/org.freedesktop.login1.policy:                <annotate key="org.freedesktop.policykit.imply">org.freedesktop.login1.reboot</annotate>
/usr/share/polkit-1/actions/org.freedesktop.login1.policy:                <annotate key="org.freedesktop.policykit.imply">org.freedesktop.login1.reboot</annotate>
/usr/share/polkit-1/actions/org.freedesktop.login1.policy:                <annotate key="org.freedesktop.policykit.imply">org.freedesktop.login1.reboot</annotate>
/usr/share/polkit-1/actions/org.freedesktop.login1.policy:                <annotate key="org.freedesktop.policykit.imply">org.freedesktop.login1.reboot</annotate>


At the end of /usr/share/polkit-1/actions/org.freedesktop.login1.policy I have:

Code:
meshedgedx ~ # tail -n 20 /usr/share/polkit-1/actions/org.freedesktop.login1.policy
                        <allow_any>auth_admin_keep</allow_any>
                        <allow_inactive>auth_admin_keep</allow_inactive>
                        <allow_active>auth_admin_keep</allow_active>
                </defaults>
        </action>


        <!-- 1 /// Aditional action for elogind to reload its configuration -->
        <action id="org.freedesktop.login1.reload-config">
                <description gettext-domain="elogind">Reload the elogind configuration</description>
                <message gettext-domain="elogind">Authentication is required to reload the elogind configuration.</message>
                <defaults>
                        <allow_any>auth_admin_keep</allow_any>
                        <allow_inactive>auth_admin_keep</allow_inactive>
                        <allow_active>auth_admin_keep</allow_active>
                </defaults>
        </action>
        <!-- // 1 -->

</policyconfig>

As you can see, there are some additional lines inserted for elogind. I assume either the elogind or polkit Gentoo ebuilds added those lines. Does your installation have those lines in that file?

If yes, you could add rules in /etc/polkit-1/rules.d/ to enable your installation to shutdown, reboot and so on. For example, one of my installations has:

Code:
meshedgedx ~ # ls /etc/polkit-1/rules.d/
10-backlight.rules  10-suspend.rules  50-default.rules

Code:
meshedgedx ~ # cat /etc/polkit-1/rules.d/50-default.rules
/* -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- */

// DO NOT EDIT THIS FILE, it will be overwritten on update
//
// Default rules for polkit
//
// See the polkit(8) man page for more information
// about configuring polkit.

polkit.addAdminRule(function(action, subject) {
    return ["unix-user:0"];
});

Code:
meshedgedx ~ # cat /etc/polkit-1/rules.d/10-suspend.rules
polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.upower.suspend") {
        return polkit.Result.YES;
    }
});


So, if you cannot find the root cause of your problem, perhaps you could add a rule such as /etc/polkit-1/rules.d/60-reboot.rules for reboot:

Code:
polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.login1.reboot") {
        return polkit.Result.YES;
    }
});

and so on.
_________________
Clevo W230SS: amd64 nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64 xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC eudev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
spyuser
n00b
n00b


Joined: 17 May 2020
Posts: 4
Location: earth/milkyway

PostPosted: Sat Jul 04, 2020 10:21 am    Post subject: Reply with quote

thanks for your answer - but i was "offline" for some days ...

Quote:

As you can see, there are some additional lines inserted for elogind. I assume either the elogind or polkit Gentoo ebuilds added those lines. Does your installation have those lines in that file?


yes, my /usr/share/polkit-1/actions/org.freedesktop.login1.policy looks exactly like yours.



After all, I created a little script. It log out on every even login automatically. It's ok, because gentoo with fluxbox is very fast.
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