Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]KDE ignores laptop lid - suspect PolicyKit - updated
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

Joined: 07 Mar 2007
Posts: 554

PostPosted: Tue Mar 12, 2013 10:47 am    Post subject: [SOLVED]KDE ignores laptop lid - suspect PolicyKit - updated Reply with quote

Can anyone help me please? KDE 4.8 broke power management for me on my ASUS notebook. Checking the forums, all I could find was similar problems that went away either with reinstalling stuff or the next release. But my problems remain on KDE 4.9.5 etc.

Shutting the lid causes some disk activity, but doesn't hibernate the system, though KDE power management is configured to do that. Neither hibernate nor suspend work from KDE menus, but pm-hibernate and pm-suspend work fine from root command line.

I'd not spotted that polkitd was segfaulting. Syslog says
kernel: polkitd[...] segfault at ... ip ... sp ... error 4 in polkitd

recompiling for gdb, rebooting and attaching to the first polkitd process lets me see a backtrace, though it's not a lot of use, as I think the segfault is in the javascript interpreter used to process the policy rules. In summary, the backtrace shows:
Code: (6 levels deep, didn't run with version with symbols)
polkitbackendjsauthority.polkit_backend_js_authority_check_authorization_sync { subject_is_local=1 subject_is_active=0 action_id=org.freedesktop.upower.suspend }

I note that it says subject_is_active=0; this is before I've logged into KDE. I'm surprised there's anything to do with suspend going on yet.

When I log in, ck_list_sessions shows one session for me active and local, though interestingly with no login session id.
FWIW, udisks --mount works for me. upower -d shows mostly what I'd expect, except the Daemon entries are all "no", even though I'm on battery, and should be able to suspend and hibernate.
I tried playing with policy settings in the KDE System Settings - Actions Policy, but changes to e.g org.freedesktop.upower.suspend result in org.freedesktop.DBus.Error.AccessDenied, with details Unknown reply from QPolkit-1, Error Message did not receive a reply (timeout by message bus).

This is a standard KDE desktop, using stable stuff almost everywhere, and AFAIR no changes to Polkit, ConsoleKit, Pam, DBus, udev, or whatever. No sign of systemd.

I notice that each time I close and reopen the lid, syslog contains
dbus[2659]: [system] Activating service name='org.freedesktop.PolicyKit1' (using servicehelper)
logger: ACPI event unhandled: button/lid LID close
polkitd[4872]: Loading rules from directory /etc/polkit-1/rules.d
polkitd[4872]: Loading rules from directory /usr/share/polkit-1/rules.d
polkitd[4872]: Finished loading, compiling and executing 3 rules
dbus[2659]: [system] Successfully activated service 'org.freedesktop.PolicyKit1'

and .xsession-errors has
PolicyKit daemon disconnected from the bus.

It also gets several copies of
plasma-desktop(3267)/plasma StatusNotifierItemSource::refreshCallback: DBusMenu disabled for this application

I've no idea what. if anything, any of this means!
(I assume the breakage is down to KDE changes to support systemd. I'm still using openrc & udev, but AFAIK so are most Gentoo KDE users.)

Last edited by Goverp on Tue May 28, 2013 12:09 pm; edited 1 time in total
Back to top
View user's profile Send private message

Joined: 07 Mar 2007
Posts: 554

PostPosted: Sun Mar 24, 2013 8:10 pm    Post subject: Reply with quote

In the hope someone reads this thread, I've done some more digging.

Backtraces show (as above) that the the polkit daemon repeatedly dies due to a segfault in the spidermonkey javascript engine used by policykit. At the point of failure, spidermonkey is being used to run a rule asynchronously with a timeout. That shouldn't cause a segfault, of course.

Comparing my laptop, which shows the fault, with my desktop, which doesn't, a few significant differences:

1) The successful system's polkit startup goes on to the message "Acquired the name org.freedesktop.PolicyKit1 on the system bus" in syslog at the point where the failing system hits the segfault.

2) A polkit bug report at suggests diagnosis by restarting polkitd. When I do that, it acquires the name correctly, but then issues the message "WARNING ***: skipping unknown tag <i> at line 336", as per the bug report. The bug report goes on to suggest the authentication client behind polkit (I assume consolekit) is timing out.

3) The consolekit daemon is in the default runlevel, and active, and its log in /var/log/ConsoleKit/history has no signs of anything going wrong.
ck-list-sessions output for both is the same except the failing system has "login-session-id = ''", whereas the successful one has a numeric id.
        unix-user = '1000'
        realname = 'Paul Gover'
        seat = 'Seat1'
        session-type = ''
        active = TRUE
        x11-display = ':0'
        x11-display-device = '/dev/tty7'
        display-device = ''
        remote-host-name = ''
        is-local = TRUE
        on-since = '2013-03-24T19:05:01.110575Z'
        login-session-id = '4294967295'

The laptop differs from the desktop in several ways, most notably NetworkManager gets involved in the startup, and sometimes gets timeouts itself.

I'm running an up-to-date stable KDE system on an Intel Atom processor with adequate resources.
polkit-0.110 dbus-1.6.8 KDE 4.9.5 consolekit-0.4.5-p20120320-r1.
It all "just worked" about KDE 4.7.

Can anyone point me at a suggestion as how to proceed? I've spent ages Googling this problem - lots of hits, but most of them are either full of misguided half-assed guesswork, or use the Windows default solution (i.e. reinstall everything in sight).

Maybe I should just remove all software "*Kit". Given the appalling & unnecessary complexity. lack of documentation and ability of anyone to debug the mess... :-)
Back to top
View user's profile Send private message

Joined: 07 Mar 2007
Posts: 554

PostPosted: Tue May 28, 2013 12:08 pm    Post subject: Reply with quote

I revisited this problem, and found some gnome users suffering from spidermonkey segfaulting. Their fix was to recompile bits of gnome and spidermonkey with all optimizations off. As my problem is on an Intel Atom-powered netbook and I use -O3, I tried recompiling spidermonkey without optimization, but that didn't work. Recompiling both it and polkit did fix the segfaults, and now polkitd stays around, and hibernation, suspend, and network manager all work. Some time, I'll try bisecting to see which optimizations on what actually fix the issue. As for now, my fix was to add lines to /etc/portage/package.env
dev-lang/spidermonkey unriced
sys-auth/polkit unriced
and add file /etc/portage/env/unriced
# Simple-minded compile for sensitive packages
CFLAGS="-O2 -march=i686"

I wonder why polkitd would break when "over" optimized. Might be related to the fact it contains 370 gotos.
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