Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
XFCE4 + lightdm + systemd - Can't shutdown from inside XFCE
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
wpettersson
n00b
n00b


Joined: 04 Jun 2014
Posts: 16

PostPosted: Thu Oct 23, 2014 10:49 pm    Post subject: XFCE4 + lightdm + systemd - Can't shutdown from inside XFCE Reply with quote

So I migrated to systemd a few months ago (~6 I think). Before then, I was running XFCE4 and lightdm and I could shutdown, restart or hibernate from within XFCE4. However, when I migrated to systemd the shutdown, restart and hibernate options were greyed out. However, I can always shutdown/restart/hibernate from the lightdm-greeter. At first I thought it was a bug with lightdm, so I let it slide for a while, but I think now that it's just a misconfiguration from me.

If I ask DBUS whether I can shutdown, I get an error which I think is unusual.
Code:
$ gdbus call --system --dest org.freedesktop.login1 --object-path /org/freedesktop/login1 --method org.freedesktop.login1.Manager.CanPowerOff     
Error: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Permission denied


I haven't changed any files in /etc/dbus-1/ and have posted /etc/dbus-1/system.conf and /etc/dbus-1/system.d/org.freedesktop.login1.conf below. I don't know how to debug this access denied error though. I've checked syslog, and it does show messages about dbus reloading configuration but it doesn't print anything when I send the message via dbus.

/etc/dbus1-system.conf
Code:
<!-- This configuration file controls the systemwide message bus.
     Add a system-local.conf and edit that rather than changing this
     file directly. -->

<!-- Note that there are any number of ways you can hose yourself
     security-wise by screwing up this file; in particular, you
     probably don't want to listen on any more addresses, add any more
     auth mechanisms, run as a different user, etc. -->

<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>

  <!-- Our well-known bus type, do not change this -->
  <type>system</type>

  <!-- Run as special user -->
  <user>messagebus</user>

  <!-- Fork into daemon mode -->
  <fork/>

  <!-- We use system service launching using a helper -->
  <standard_system_servicedirs/>

  <!-- This is a setuid helper that is used to launch system services -->
  <servicehelper>/usr/libexec/dbus-daemon-launch-helper</servicehelper>

  <!-- Write a pid file -->
  <pidfile>/var/run/dbus.pid</pidfile>

  <!-- Enable logging to syslog -->
  <syslog/>

  <!-- Only allow socket-credentials-based authentication -->
  <auth>EXTERNAL</auth>

  <!-- Only listen on a local socket. (abstract=/path/to/socket
       means use abstract namespace, don't really create filesystem
       file; only Linux supports this. Use path=/whatever on other
       systems.) -->
  <listen>unix:path=/var/run/dbus/system_bus_socket</listen>

  <policy context="default">
    <!-- All users can connect to system bus -->
    <allow user="*"/>

    <!-- Holes must be punched in service configuration files for
         name ownership and sending method calls -->
    <deny own="*"/>
    <deny send_type="method_call"/>

    <!-- Signals and reply messages (method returns, errors) are allowed
         by default -->
    <allow send_type="signal"/>
    <allow send_requested_reply="true" send_type="method_return"/>
    <allow send_requested_reply="true" send_type="error"/>

    <!-- All messages may be received by default -->
    <allow receive_type="method_call"/>
    <allow receive_type="method_return"/>
    <allow receive_type="error"/>
    <allow receive_type="signal"/>

    <!-- Allow anyone to talk to the message bus -->
    <allow send_destination="org.freedesktop.DBus"/>
    <!-- But disallow some specific bus services -->
    <deny send_destination="org.freedesktop.DBus"
          send_interface="org.freedesktop.DBus"
          send_member="UpdateActivationEnvironment"/>
  </policy>

  <!-- Config files are placed here that among other things, punch
       holes in the above policy for specific services. -->
  <includedir>system.d</includedir>

  <!-- This is included last so local configuration can override what's
       in this standard file -->
  <include ignore_missing="yes">system-local.conf</include>

  <include if_selinux_enabled="yes" selinux_root_relative="yes">contexts/dbus_contexts</include>

</busconfig>



/etc/dbus-1/system.d/org.freedesktop.login1.conf
Code:
<?xml version="1.0"?> <!--*-nxml-*-->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
        "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">

<!--
  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.
-->

<busconfig>

        <policy user="root">
                <allow own="org.freedesktop.login1"/>
                <allow send_destination="org.freedesktop.login1"/>
                <allow receive_sender="org.freedesktop.login1"/>
        </policy>

        <policy context="default">
                <deny send_destination="org.freedesktop.login1"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.DBus.Introspectable"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.DBus.Peer"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.DBus.Properties"
                       send_member="Get"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.DBus.Properties"
                       send_member="GetAll"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="GetSession"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="GetSessionByPID"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="GetUser"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="GetUserByPID"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="GetSeat"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="ListSessions"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="ListUsers"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="ListSeats"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="ListInhibitors"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="Inhibit"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="SetUserLinger"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="ActivateSession"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="ActivateSessionOnSeat"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="PowerOff"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="Reboot"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="Suspend"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="Hibernate"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="HybridSleep"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="CanPowerOff"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="CanReboot"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="CanSuspend"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="CanHibernate"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="CanHybridSleep"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="AttachDevice"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Manager"
                       send_member="FlushDevices"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Seat"
                       send_member="ActivateSession"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Seat"
                       send_member="SwitchTo"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Seat"
                       send_member="SwitchToPrevious"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Seat"
                       send_member="SwitchToNext"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Session"
                       send_member="Activate"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Session"
                       send_member="SetIdleHint"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Session"
                       send_member="TakeControl"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Session"
                       send_member="ReleaseControl"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Session"
                       send_member="TakeDevice"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Session"
                       send_member="ReleaseDevice"/>

                <allow send_destination="org.freedesktop.login1"
                       send_interface="org.freedesktop.login1.Session"
                       send_member="PauseDeviceComplete"/>

                <allow receive_sender="org.freedesktop.login1"/>
        </policy>

</busconfig>



Additionally, I seem to get two sessions from loginctl. One is me, the second is owned by root, and is the lightdm-greeter. I don't know if the greeter session is meant to persist when I log in, so I don't know if this is part of the problem.

Code:
# loginctl
   SESSION        UID USER             SEAT           
        c1          0 root             seat0           
        c2       1000 enigma           seat0           

2 sessions listed.
# loginctl show-session c1
Id=c1
Name=root
Timestamp=Fri 2014-10-24 07:49:14 AEST
TimestampMonotonic=4292561
VTNr=7
Display=:0
Remote=no
Service=lightdm-greeter
Scope=session-c1.scope
Leader=226
Audit=0
Type=x11
Class=greeter
Active=no
State=closing
IdleHint=no
IdleSinceHint=0
IdleSinceHintMonotonic=0


Last edited by wpettersson on Wed Oct 29, 2014 10:28 pm; edited 1 time in total
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3846
Location: Austro Bavaria

PostPosted: Wed Oct 29, 2014 1:37 pm    Post subject: Reply with quote

systemd related,
plese update your title topic to systemd. Thank you
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