Opened 9 years ago

Closed 7 years ago

#7910 closed defect (fixed)

olpc-update should inhibit OHM suspend

Reported by: cjb Owned by: cscott
Priority: high Milestone: 8.2.0 (was Update.2)
Component: upgrade utility Version: not specified
Keywords: Cc: cscott, dsd
Blocked By: Blocking:
Deployments affected: Action Needed: test in build
Verified: no


cjb will provide a stanza to inhibit OHM over dbus from running Sugar code, and cscott will add to olpc-update.

Change History (9)

comment:1 Changed 9 years ago by cjb

  • Owner changed from cjb to cscott

Scott, here's the stanza:

import dbus

    bus = dbus.SystemBus()
    keystore = bus.get_object('org.freedesktop.ohm',
    # Find out the current state.
    inhibit = keystore.GetKey('suspend.inhibit')
    print inhibit

    # Set to inhibit.
    keystore.SetKey('suspend.inhibit', 1)
    inhibit = keystore.GetKey('suspend.inhibit')
    print inhibit

    # When done, unset inhibit.
    keystore.SetKey('suspend.inhibit', 0)
    inhibit = keystore.GetKey('suspend.inhibit')
    print inhibit
except dbus.DBusException, e:
    print "Error setting OHM inhibit: %s" % e

comment:2 Changed 9 years ago by cjb

  • Cc dsd added

This stanza fails with "A security policy in place prevents this sender from this message to this recipient" when running inside Sugar (but not when running from a Linux tty).

comment:3 Changed 9 years ago by cjb

Ah, I think it might simply be that root can make these method calls and user olpc can't, because OHM's on the SystemBus.

comment:4 Changed 9 years ago by cjb

I'm confused, though, because I understand /etc/dbus-1/system.d/ohm.conf to be saying that non-root users can send to org.freedesktop.ohm.Keystore.

comment:5 Changed 9 years ago by cscott

The fix is;a=commitdiff;h=68ecf1fdbc39e5662e409ce90ec195613771299c

-        keystore = bus.get_object('org.freedesktop.ohm',
-                                  '/org/freedesktop/ohm/Keystore',
-                                  'org.freedesktop.ohm.Keystore')
+        proxy = bus.get_object('org.freedesktop.ohm',
+                               '/org/freedesktop/ohm/Keystore')
+        keystore = dbus.Interface(proxy, 'org.freedesktop.ohm.Keystore')

I don't completely understand this, but it seems to have something to do with root being able to call methods on an unbound interface, while olpc can't. (The third argument to bus.get_object seems to be ignored, so pre-patch you get a proxy for the object, but it's not bound to the correct interface.)

comment:6 Changed 9 years ago by cjb

Oh! Thanks very much, that explains it.

comment:7 Changed 9 years ago by cscott

  • Action Needed changed from code to test in build
  • Component changed from not assigned to upgrade utility

In olpc-update 2.15 and sugar-update-control 0.8, which should land in joyride-2293 or 2294.

comment:8 Changed 9 years ago by Quozl

Had an unexpected suspend in the middle of doing olpc-update from joyride-2402 to 2404, from within a Terminal activity. But was not able to reproduce it later.

comment:9 Changed 7 years ago by dsd

  • Resolution set to fixed
  • Status changed from new to closed

This is working correctly in 10.1.2 (olpc-update-2.23) (the inhibit is done through the bitfrost python module)

Note: See TracTickets for help on using tickets.