Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Session dbus from root
Forum Updated to NodeBB v4.3 + New Features

Session dbus from root

Scheduled Pinned Locked Moved Mobile and Embedded
6 Posts 2 Posters 5.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kimf
    wrote on 23 Nov 2010, 19:18 last edited by
    #1

    Hi, I'm trying to use a QContactManager from a daemon on Maemo, which fails.

    I have been told I have to make sure the session dbus are initialized to use the user's session dbus, but how do I do that ?

    I have read I have to set the environment variable DBUS_SESSION_BUS_ADDRESS to the address on the user's session dbus, and I'm fairly sure it is set to the value found in /tmp/session_bus_address.user (I'm logging the value from my program and it looks right) but still my program fails the moment I try to access the address book.

    The following are logged in syslog :

    GLIB WARNING ** mc-client - Unrecognized presence online' GLIB MESSAGE libosso-abook - osso-abook-aggregator.c:2220: EBook error 8 on file:///root/.osso-abook/db GLIB WARNING ** GLib-GObject - invalid (NULL) pointer instance GLIB CRITICAL ** GLib-GObject - g_signal_connect_data: assertion G_TYPE_CHECK_INSTANCE (instance)' failed
    GLIB CRITICAL ** Gdk - gdk_pango_context_get_for_screen: assertion GDK_IS_SCREEN (screen)' failed GLIB CRITICAL ** Pango - pango_context_set_font_description: assertion context != NULL' failed

    Can anyone tell me how to initialize the session dbus correctly ?

    Thanks.

    Kim

    1 Reply Last reply
    0
    • C Offline
      C Offline
      chriadam
      wrote on 23 Nov 2010, 23:33 last edited by
      #2

      Hi Kim,

      It looks like osso-abook-aggregator.c is trying to open the file /root/.osso-abook/db, whereas it probably should open the file /home/user/.osso-abook/db (if the normal user is named "user"). Although I might be wrong. Are you able to set $HOME to /home/user temporarily? Or maybe there's a better way to do it -- but I don't think that the problem you're seeing is related to DBUS specifically (maybe I'm wrong).

      Cheers,
      Chris.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kimf
        wrote on 24 Nov 2010, 19:13 last edited by
        #3

        Hi Chris

        Unfortunately that didn't do anything :

        Log from my program (started as root) :

        DBUS_SESSION_BUS_ADDRESS = unix:abstract=/tmp/dbus-iYWiqWAGpx,guid=36b2abf727d8f3e6044e57590000000f
        PATH = /usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
        HOME = /home/user

        Log from my program (started as user) :

        DBUS_SESSION_BUS_ADDRESS = unix:abstract=/tmp/dbus-iYWiqWAGpx,guid=36b2abf727d8f3e6044e57590000000f
        PATH = /usr/bin:/bin
        HOME = /home/user

        And still the program exits the moment I try to create an instance of QContactManager as root, syslog :
        @
        callloggerd[3243]: GLIB WARNING ** mc-client - Unrecognized presence `online'
        e-addressbook-factory[1096]: GLIB WARNING ** eds/file - e_book_backend_file_setup_db_env at e-book-backend-file.c:1814: cannot create dir '/root/.osso-abook/db': Permission denied
        e-addressbook-factory[1096]: GLIB WARNING ** eds/file - e_book_backend_file_load_source at e-book-backend-file.c:2010: cannot setup db_env to /root/.osso-abook/db
        callloggerd[3243]: GLIB MESSAGE libosso-abook - osso-abook-aggregator.c:2220: EBook error 20 on file:///root/.osso-abook/db
        callloggerd[3243]: GLIB WARNING ** GLib-GObject - invalid (NULL) pointer instance
        @
        and so on ...

        Kim

        [edit: syslog output fixed / Denis Kormalev]

        1 Reply Last reply
        0
        • C Offline
          C Offline
          chriadam
          wrote on 24 Nov 2010, 23:28 last edited by
          #4

          Hi Kim,

          Yeah, I'm not sure how to work around this issue. The problem appears to be as I said: the platform libraries are attempting to open up (or create) a contact database in the /root/ directory instead of /home/user/. I can only imagine that it is using some environment variable for that, but I'm not entirely certain. If it wasn't $HOME then perhaps something else?

          So in short, I don't know what the solution is, but the problem is clear - the lower level platform is detecting that the current user is root, and detecting the home directory of root to be something other than what you specified in $HOME environment variable, it seems. If you can work around that problem somehow (by figuring out how it detects the home directory of the user, and spoofing that to be the normal user) then you should have solved the problem.

          Cheers,
          Chris.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kimf
            wrote on 25 Nov 2010, 21:58 last edited by
            #5

            Hi Chris

            Thanks for your input, it did push me in the right direction.

            First I changed my program to dump the entire environment to the log file, and ran it from root and user, and found that the environments had almost nothing in common !

            It couldn't be true I had to reconstruct everything to run as a daemon, so I went back to the old drawing board.

            Maybe the solution was to somehow run the daemon in 'user space' (funny enough this is where everything started, until someone over at maemo.org suggested the dbus to be my problem).

            After a lot of reading on the 'net, I found the solution.

            In my event.d script I changed the start script to :

            su -c 'my daemon' -l user

            And now everything is working like a dream ;)

            Thanks a lot.

            Kim

            1 Reply Last reply
            0
            • C Offline
              C Offline
              chriadam
              wrote on 25 Nov 2010, 23:11 last edited by
              #6

              Hi Kim,

              I'm glad you managed to find a solution to the problem!

              Cheers,
              Chris.

              1 Reply Last reply
              0

              4/6

              24 Nov 2010, 23:28

              • Login

              • Login or register to search.
              4 out of 6
              • First post
                4/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved