Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

PMS 0.9.6.4 on Arch Linux Crashes Upon Navigating to Manage Page

MelanomaSkyMelanomaSky Posts: 7Members
A bug report for a PMS 0.9.6.4 seen on Arch Linux.
Just upgraded my Arch Linux package for PMS to 0.9.6.4, using the AUR
package here:

http://aur.archlinux.org/packages.php?ID=51350

What I observe after upgrade is the following -- starting the server
seems okay, but if I navigate to localhost:32400/manage, it seems to
then crash along these lines:

[jon@demonslayer]sudo /etc/rc.d/plexmediaserver start
:: Starting Plex Media Server [DONE]
[jon@demonslayer]process 19135: D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open "/home/plex/hudson/workspace/Plex-Dependency-Builder/label/Linux-Ubuntu-Lucid-amd64/output/6023bc9-linux-ubuntu-x86_64/var/lib/dbus/machine-id": No such file or directory
See the manual page for dbus-uuidgen to correct this issue.
D-Bus not built with -rdynamic so unable to print a backtrace

After some messing around I notice a couple of things:

It seems that there are many build-leaks of '/home/plex/hudson/...' directory
strings in the PMS binaries (via 'strings | grep hud'); that may indicate a
bit of snafu in the build process.

Totally ghetto (humorous) workaround:

[jon@demonslayer]sudo mkdir plex
[jon@demonslayer]sudo chown jon plex/
[jon@demonslayer]cd plex/
[jon@demonslayer]ls
[jon@demonslayer]mkdir -p hudson/workspace/Plex-Dependency-Builder/label/Linux-Ubuntu-Lucid-amd64/output/6023bc9-linux-ubuntu-x86_64/var/lib/dbus/
[jon@demonslayer]cd hudson/workspace/Plex-Dependency-Builder/label/Linux-Ubuntu-Lucid-amd64/output/6023bc9-linux-ubuntu-x86_64/var/lib/dbus/
[jon@demonslayer]dbus-uuidgen
c96a6f1355f4838858ed993e0006bd8d
[jon@demonslayer]dbus-uuidgen > machine-id

With this, I can restart the server, and voila, I do not observe that it
seems to crash when I navigate to the 'manage' web UI.

Thought I'd file this bug -- please let me know if there's a better
category or place to put this! Thanks!

Comments

  • ziggimonziggimon Plex Dev Team AarhusPosts: 2,479Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    And you didn't experience this with 0.9.6.3? Or earlier?

    /Mark
  • drmontydrmonty Posts: 9Members, Plex Pass Plex Pass
    edited June 2012
    I'm the currented maintainer of the plexmediaserver-package for archlinux and can't reproduce the issue by MelanomaSky.
    Everything works as asspected.

    Please try to reinstall dbus and Make sure that dbus is enabled in the DAEMONS array in /etc/rc.conf.
  • ziggimonziggimon Plex Dev Team AarhusPosts: 2,479Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    edited June 2012
    Thanks for getting in here and replying drmonty. I appeeciate it.

    /Mark
  • MelanomaSkyMelanomaSky Posts: 7Members
    Thanks guys for the quick response! I gathered some further data points:

    My repro case is: start PMS, navigate to localhost:32400/manage/index.html.

    9.6.3 does not show the issue; seems just fine. For 9.6.3 I'm using the
    bits via AUR: plexmediaserver-0.9.6.3.143-4466fb5-x86_64.pkg.tar.xz.

    9.6.4 shows the issue 100% for me.

    I strace'd the processes in both cases with this diff:

    @
       export LC_ALL="en_US.UTF-8"
       export LANG="en_US.UTF-8"
       ulimit -s 3000
      -./Plex\ Media\ Server
      +strace -D -ff -o/home/jon/Desktop/PlexTraces/9.6.4/pt -e trace=file ./Plex\ Media\ Server
    


    I put the traces into different directores for each run. What I see is that
    the 9.6.3 binaries never attempt to open any file matching '*machine*'. The
    9.6.4 binary fails always attempting to open the 'machine-id' file.

    At this point I have two guesses:

    One explanation could be that the 9.6.4 paths are simply different, and there
    are newly-introduced paths which now need this file. But maybe not?

    My second guess is that the reason for the differences is in how the dbus
    libraries were built from the dbus sources; different build options could
    influence whether the error to find 'machine-id' aborts the process:

      /**
       * Gets the hex-encoded UUID of the machine this function is
       * executed on. This UUID is guaranteed to be the same for a given
       * machine at least until it next reboots, though it also
       * makes some effort to be the same forever, it may change if the
       * machine is reconfigured or its hardware is modified.
       * 
       * @param uuid_str string to append hex-encoded machine uuid to
       * @returns #FALSE if no memory
       */
      dbus_bool_t
      _dbus_get_local_machine_uuid_encoded (DBusString *uuid_str)
      {
        dbus_bool_t ok;
      
        _DBUS_LOCK (machine_uuid);
        if (machine_uuid_initialized_generation != _dbus_current_generation)
          {
            DBusError error = DBUS_ERROR_INIT;
      
            if (!_dbus_read_local_machine_uuid (&machine_uuid, FALSE,
                                                &error))
              {
      #ifndef DBUS_BUILD_TESTS
                /* For the test suite, we may not be installed so just continue silently
                 * here. But in a production build, we want to be nice and loud about
                 * this.
                 */
                _dbus_warn_check_failed ("D-Bus library appears to be incorrectly set up; failed to read machine uuid: %s\n"
                                         "See the manual page for dbus-uuidgen to correct this issue.\n",
                                         error.message);
      #endif   
    


    If 9.6.4 is built with DBUS_BUILD_TEST unset, and 9.6.3 is built with
    it set,it could explain why I don't hit the problem on 9.6.3.

    ----

    For my Arch setup, I have dbus packages installed:

      [jon@demonslayer]pacman -Q | g -i dbus
      dbus 1.4.20-1
      dbus-core 1.4.20-2
      dbus-glib 0.98-1
      [jon@demonslayer]ps auxww | g -i dbus
      jon      11795  0.0  0.0  20112   596 tty1     S    Jun22   0:00 /usr/bin/dbus-launch --sh-syntax --exit-with-session xfce4-session
      jon      11796  0.0  0.0  13508  1416 ?        Ss   Jun22   0:00 /usr/bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
      jon      14842  0.0  0.0   8656  1056 pts/9    S+   11:14   0:00 grep -i dbus
      root     19578  0.0  0.0  20112   688 ?        S    Jun22   0:00 dbus-launch --autolaunch d0bc93054cb95982c0f92d590006bd8f --binary-syntax --close-stderr
      root     19579  0.0  0.0  13132   884 ?        Ss   Jun22   0:00 /usr/bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
    


    But I don't usually run a system-wide dbus instance via /etc/rc.conf:

      [jon@demonslayer]grep DAEMONS /etc/rc.conf
      # DAEMONS
      DAEMONS=(syslog-ng network crond sshd)
    


    I added dbus, rebooted, and observe the same problem:

      [jon@demonslayer]sudo ./start.sh 
      Password: 
      process 820: D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open "/home/plex/hudson/workspace/Plex-Dependency-Builder/label/Linux-Ubuntu-Lucid-amd64/output/6023bc9-linux-ubuntu-x86_64/var/lib/dbus/machine-id": No such file or directory
      See the manual page for dbus-uuidgen to correct this issue.
        D-Bus not built with -rdynamic so unable to print a backtrace
      ./start.sh: line 11:   820 Aborted                 ./Plex\ Media\ Server
      [jon@demonslayer]grep dbus /etc/rc.conf
      DAEMONS=(syslog-ng network crond sshd dbus)
      [jon@demonslayer]rc.d list | grep dbus
      [STARTED][AUTO] dbus
    


    Reinstall, restart, problem seems to persist:

      [jon@demonslayer]sudo pacman -Sy dbus
      :: Synchronizing package databases...
       core                                                                                               104.3 KiB   130K/s 00:01 [###########################################################################] 100%
       extra                                                                                             1403.5 KiB  1026K/s 00:01 [###########################################################################] 100%
       community                                                                                         1687.7 KiB  1070K/s 00:02 [###########################################################################] 100%
       multilib is up to date
      warning: dbus-1.4.20-1 is up to date -- reinstalling
      resolving dependencies...
      looking for inter-conflicts...
      
      Targets (1): dbus-1.4.20-1
      
      Total Installed Size:   0.07 MiB
      Net Upgrade Size:       0.00 MiB
      
      Proceed with installation? [Y/n] Y
      (1/1) checking package integrity                                                                                             [###########################################################################] 100%
      (1/1) loading package files                                                                                                  [###########################################################################] 100%
      (1/1) checking for file conflicts                                                                                            [###########################################################################] 100%
      (1/1) checking available disk space                                                                                          [###########################################################################] 100%
      (1/1) upgrading dbus                                                                                                         [###########################################################################] 100%
      
      [jon@demonslayer]sudo /etc/rc.d/dbus restart
      Password: 
      :: Stopping D-BUS system messagebus                                                                                                                                                                     [DONE] 
      :: Starting D-BUS system messagebus     
      
      [jon@demonslayer]sudo ./start.sh 
      Password: 
      process 1426: D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open "/home/plex/hudson/workspace/Plex-Dependency-Builder/label/Linux-Ubuntu-Lucid-amd64/output/6023bc9-linux-ubuntu-x86_64/var/lib/dbus/machine-id": No such file or directory
      See the manual page for dbus-uuidgen to correct this issue.
        D-Bus not built with -rdynamic so unable to print a backtrace
      ./start.sh: line 11:  1426 Aborted                 ./Plex\ Media\ Server
    


    ----
    What remains as a mystery for me right now is why this doesn't quite
    reproduce on other systems: at this point I would expect it to; but
    it's also possible I have something wonky locally.
  • MelanomaSkyMelanomaSky Posts: 7Members
    More data -- diffing the binaries 9.6.3 versus 9.6.4, I'm now inclined
    to say that 9.6.4 was compiled differently and thus hits new paths that
    aren't hit in 9.6.3:

    [jon@demonslayer]md5sum ~/AUR-Stuff/pms-0.9.6.3-143-4466fb5/plexmediaserver/src/usr/lib/plexmediaserver/libdbus-1.so.3 
    8c22de2ec41980e571472fe54595ccbf  /home/jon/AUR-Stuff/pms-0.9.6.3-143-4466fb5/plexmediaserver/src/usr/lib/plexmediaserver/libdbus-1.so.3
    [jon@demonslayer]md5sum ~/AUR-Stuff/pms-0.9.6.4.154-c16a2c6/plexmediaserver/src/usr/lib/plexmediaserver/libdbus-1.so.3
    03f5a7ae776479a47cb91e5937652b66  /home/jon/AUR-Stuff/pms-0.9.6.4.154-c16a2c6/plexmediaserver/src/usr/lib/plexmediaserver/libdbus-1.so.3
    
    [jon@demonslayer]strings ~/AUR-Stuff/pms-0.9.6.3-143-4466fb5/plexmediaserver/src/usr/lib/plexmediaserver/libdbus-1.so.3 > /tmp/963-libdbus
    [jon@demonslayer]strings ~/AUR-Stuff/pms-0.9.6.4.154-c16a2c6/plexmediaserver/src/usr/lib/plexmediaserver/libdbus-1.so.3 > /tmp/964-libdbus
    
    [jon@demonslayer]diff -u /tmp/963-libdbus /tmp/964-libdbus | grep autolaunch
    -Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead
    +Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
    +--autolaunch
    


    Cross referencing that with the dbus sources, I think the 9.6.4 library
    was built with DBUS_SESSION_BUS_ADDRESS; see dbus-sysdeps-unix.c:

    /**
     * Returns the address of a new session bus.
     *
     * If successful, returns #TRUE and appends the address to @p
     * address. If a failure happens, returns #FALSE and
     * sets an error in @p error.
     *
     * @param address a DBusString where the address can be stored
     * @param error a DBusError to store the error in case of failure
     * @returns #TRUE on success, #FALSE if an error happened
     */
    dbus_bool_t
    _dbus_get_autolaunch_address (const char *scope,
                                  DBusString *address,
                                  DBusError  *error)
    {
    #ifdef DBUS_ENABLE_X11_AUTOLAUNCH
      /* Perform X11-based autolaunch. (We also support launchd-based autolaunch,
       * but that's done elsewhere, and if it worked, this function wouldn't
       * be called.) */
      const char *display;
      static char *argv[6];
      int i;
      DBusString uuid;
      dbus_bool_t retval;
    
      _DBUS_ASSERT_ERROR_IS_CLEAR (error);
      retval = FALSE;
    
      /* fd.o #19997: if $DISPLAY isn't set to something useful, then
       * dbus-launch-x11 is just going to fail. Rather than trying to
       * run it, we might as well bail out early with a nice error. */
      display = _dbus_getenv ("DISPLAY");
    
      if (display == NULL || display[0] == '\0')
        {
          dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED,
              "Unable to autolaunch a dbus-daemon without a $DISPLAY for X11");
          return FALSE;
        }
    
      if (!_dbus_string_init (&uuid))
        {
          _DBUS_SET_OOM (error);
          return FALSE;
        }
    
      if (!_dbus_get_local_machine_uuid_encoded (&uuid))
        {
          _DBUS_SET_OOM (error);
          goto out;
        }
    
      i = 0;
      argv[i] = "dbus-launch";
      ++i;
      argv[i] = "--autolaunch";
      ++i;
      argv[i] = _dbus_string_get_data (&uuid);
      ++i;
      argv[i] = "--binary-syntax";
      ++i;
      argv[i] = "--close-stderr";
      ++i;
      argv[i] = NULL;
      ++i;
    
      _dbus_assert (i == _DBUS_N_ELEMENTS (argv));
    
      retval = _read_subprocess_line_argv (DBUS_BINDIR "/dbus-launch",
                                           TRUE,
                                           argv, address, error);
    
     out:
      _dbus_string_free (&uuid);
      return retval;
    #else
      dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED,
          "Using X11 for dbus-daemon autolaunch was disabled at compile time, "
          "set your DBUS_SESSION_BUS_ADDRESS instead");
      return FALSE;
    #endif
    }
    


    From that code snippet above I'm thinking 9.6.4 hits the path
    '_dbus_get_local_machine_uuid_encoded', and bails out with the
    abort from my previous update.

    In 9.6.3, the function wouldn't be hit in this path.

    Still don't know why only I'm seeing this problem though.
  • MelanomaSkyMelanomaSky Posts: 7Members

    From that code snippet above I'm thinking 9.6.4 hits the path
    '_dbus_get_local_machine_uuid_encoded', and bails out with the
    abort from my previous update.

    In 9.6.3, the function wouldn't be hit in this path.

    Still don't know why only I'm seeing this problem though.


    If I manually swap out the 9.6.4 libdbus-1.so.3 file with the one provided
    from the 9.6.3 bundle, things "seem to work".
  • MelanomaSkyMelanomaSky Posts: 7Members

    If I manually swap out the 9.6.4 libdbus-1.so.3 file with the one provided
    from the 9.6.3 bundle, things "seem to work".


    Binary patching the 9.6.4 libdbus-1.so.3 so that its machine-id path
    points to "/var/lib/dbus/machine-id" also seems to work.
  • MelanomaSkyMelanomaSky Posts: 7Members
    After some further experimentation, I don't think this is an Arch packaging issue. I
    think this is mis-building of the dbus library.

    Plex devs: I think you want to build the dbus library with './autogen.sh --prefix=""'.
  • drmontydrmonty Posts: 9Members, Plex Pass Plex Pass
    nicely done MelanomaSky :)
  • tobiashietatobiashieta Plex Dev Team Posts: 5,540Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee

    After some further experimentation, I don't think this is an Arch packaging issue. I
    think this is mis-building of the dbus library.

    Plex devs: I think you want to build the dbus library with './autogen.sh --prefix=""'.


    MelanomaSky, thanks for your in depth analysis of the problem. I don't think that the solution is correct though. We never even call autogen when we build dbus, we call configure, and the way we build our packages we could not just set prefix to a empty string and that seems like the wrong solution to me anyway, if it was build-time problem it should have the same problems on all Linux platforms (since dbus is built the same way everywhere) and you seem to be the only one that have reported this problem. My guess is that it still have something to do with your system. Also note that many other systems we are running on doesn't even have dbus installed so I don't think it has anything to do with that.

    Which package is the arch package based on? Ubuntu? 64bit?
  • drmontydrmonty Posts: 9Members, Plex Pass Plex Pass
    It's based on http://www.plexapp.com/repo/pool/main/p/plexmediaserver/ latest one.
    For x86_64, amd64 gets used
    otherwise the i386 package.
  • lotuskiplotuskip Posts: 1Members
    I am also using Arch Linux and the same package from the AUR, and am experiencing the same problem as MelanomaSky. I haven't done as deep research, but on the surface my issue seems to be identical. Just letting you know that this is not a single instance.

    I just upgraded dbus from 1.4.20 to 1.6.0, and the problem seems to be the same with both versions. I am starting dbus at boot time.

    @MelanomaSky: many thanks for the ghetto workaround! Silly, but works!
  • drmontydrmonty Posts: 9Members, Plex Pass Plex Pass
    edited June 2012
    ok, I get the same issue on my other PC, with same architecture (x86_64).
    will test a reinstallation of the package on my main machine this afternoon.
    I think library got not replaced on update, 'cause library was in use (even if daemon got stopped).

    edit: as I aspected, library was in use, so some files did not got replaced correctly since first install.
    Already update arch-package with libdbus-1.so.3 from 0.9.6.3.143-4466fb5.
    Hope this gets fixed.
  • drmontydrmonty Posts: 9Members, Plex Pass Plex Pass
    Still an issue with 0.9.6.5.177-5c3cf40
    process 14440: D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open "/home/plex/hudson/workspace/Plex-Dependency-Builder/label/Linux-Ubuntu-Lucid-amd64/output/6023bc9-linux-ubuntu-x86_64/var/lib/dbus/machine-id": No such file or directory
    See the manual page for dbus-uuidgen to correct this issue.
    D-Bus not built with -rdynamic so unable to print a backtrace
  • tobiashietatobiashieta Plex Dev Team Posts: 5,540Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    Didn't have time to fix it for this release, but it's merged into the tree for next release
  • rklootwijkrklootwijk Posts: 9Members ✭✭
    I am having the same issue on CentOS 6.2 and the plexmediaserver-0.9.6.5.177-5c3cf40.x86_64 package.
  • ziggimonziggimon Plex Dev Team AarhusPosts: 2,479Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    Rene wrote:

    I am having the same issue on CentOS 6.2 and the plexmediaserver-0.9.6.5.177-5c3cf40.x86_64 package.


    Wow that is interesting.

    do you have dbus running on your system? And can you provide us with more information. Like how minimal did you install the system? and do you have a machine-id in /var/lib/dbus/ ?

    I have several CentOS 6.2 installs, none express this issue.

    /Mark
  • drmontydrmonty Posts: 9Members, Plex Pass Plex Pass
    Finally working with 0.9.6.6.198-7deaf26.
    Thank you very much :) !
Sign In or Register to comment.