Page 1 of 1

NotifyOSD not working as daemon on Ubuntu 12.04

Posted: February 8th, 2014, 10:46 pm
by timpotter
Hello All,

I've recently moved my sabnzbd over to my ubuntu 12.04 machine, and wanted to get notifyOSD working but noticed that it was greyed out.

Based on http://forums.sabnzbd.org/viewtopic.php ... 086#p72905 I was able to understand what is going on, but unfortunately the suggestion didn't work.

Here is what I know:
my env variable DISPLAY=:0
running pynotify in a python interpreter works (and os.environ shows correct display).
running sabnzbd without daemon mode works.
when I run sabnzbd in daemon mode, the log shows:

Code: Select all

2014-02-08 20:52:40,364::INFO::[growler:267] Send to NotifyOSD: SABnzbd@summers / SABnzbd 0.7.17RC1 started
2014-02-08 20:53:05,391::INFO::[growler:273] NotifyOSD not working
My attempt was to put 'export DISPLAY=:0' into a separate line in /etc/default/sabnzbdplus
# This file is sourced by /etc/init.d/sabnzbdplus
#
# When SABnzbd+ is started using the init script, the
# --daemon option is always used, and the program is
# started under the account of $USER, as set below.
#
# Each setting is marked either "required" or "optional";
# leaving any required setting unconfigured will cause
# the service to not start.

# [required] user or uid of account to run the program as:
USER=tim

# [optional] full path to the configuration file of your choice;
# otherwise, the default location (in $USER's home
# directory) is used:
CONFIG=

# [optional] hostname/ip and port number to listen on:
HOST=0.0.0.0
PORT=

# [optional] extra command line options, if any:
EXTRAOPTS=
export DISPLAY=:0
Any thoughts?

Re: NotifyOSD not working as daemon on Ubuntu 12.04

Posted: February 8th, 2014, 10:51 pm
by timpotter
I should probably mention I'm running version 0.7.17RC1 from the jcfp PPA.

Re: NotifyOSD not working as daemon on Ubuntu 12.04

Posted: February 8th, 2014, 11:10 pm
by timpotter
With Sickbeard, I was able to get the application to send messages correctly by exporting the DISPLAY and DBUS_SESSION_BUS_ADDRESS environment variables before the start-stop-daemon call in the init.d script.

Unfortunately trying that with sabnzbd didn't work.

Re: NotifyOSD not working as daemon on Ubuntu 12.04

Posted: February 9th, 2014, 6:28 am
by sander
I know very little about OSD, but I do use SAB on Ubuntu, so let's go:

The logging you post is generated in here in sabnzbd/growler.py:

Code: Select all

                try:
                    note = pynotify.Notification(title, message, icon)
                    note.show()
                except:
                    # Apparently not implemented on this system
                    logging.info(error)
                    return error
Maybe first just one line code that will print the excpetion error:

Code: Select all

                try:
                    note = pynotify.Notification(title, message, icon)
                    note.show()
                except:
                    # Apparently not implemented on this system
                    logging.info(error)
                    print "Ouch, notify gave an unexpected error:", sys.exc_info()[0]
                    return error

Re: NotifyOSD not working as daemon on Ubuntu 12.04

Posted: February 10th, 2014, 2:13 pm
by sander
No response ...?

Re: NotifyOSD not working as daemon on Ubuntu 12.04

Posted: February 10th, 2014, 2:15 pm
by shypike
I'll look at this before releasing 0.7.17

Re: NotifyOSD not working as daemon on Ubuntu 12.04

Posted: February 11th, 2014, 9:32 am
by sander
FYI: No response from the OP, which drains my energy, so I'll unsubscribe and put the OP on my ignore list.

Re: NotifyOSD not working as daemon on Ubuntu 12.04

Posted: March 9th, 2014, 12:55 pm
by timpotter
Well, I guess that I should have subscribed to my own post... I didn't see these messages, and am sorry for wasting time.

I've upgraded to RC2, and will retest this to confirm whether or not its working and then reply back.

Re: NotifyOSD not working as daemon on Ubuntu 12.04

Posted: March 9th, 2014, 3:00 pm
by timpotter
sander wrote:I know very little about OSD, but I do use SAB on Ubuntu, so let's go:

The logging you post is generated in here in sabnzbd/growler.py:

Code: Select all

                try:
                    note = pynotify.Notification(title, message, icon)
                    note.show()
                except:
                    # Apparently not implemented on this system
                    logging.info(error)
                    return error
Maybe first just one line code that will print the excpetion error:

Code: Select all

                try:
                    note = pynotify.Notification(title, message, icon)
                    note.show()
                except:
                    # Apparently not implemented on this system
                    logging.info(error)
                    print "Ouch, notify gave an unexpected error:", sys.exc_info()[0]
                    return error

So I had to change things a little bit. I believe print would only work if I was calling from the command line vs as a daemon, right?

So instead I used the line

Code: Select all

                   logging.info('Ouch, notify gave an unexpected error: %s', sys.exc_info()[0])
And I had to import sys, but after, I got the following response:
2014-03-09 13:56:11,163::INFO::[growler:275] Ouch, notify gave an unexpected error: <class 'gio.Error'>

so then I added the [1] array element, and got:
2014-03-09 14:00:39,076::INFO::[growler:275] Ouch, notify gave an unexpected error: <class 'gio.Error'>, Error calling StartServiceByName for org.freedesktop.Notifications: Timeout was reached

trying [2] gave me a traceback object, is any of that useful?

googling this error, I see that its been identified elsewhere, but I'm not 100% sure why. One thread talks about the fact that the DBUS object is wrong, and that reminded me of something.

When I don't include 'export DISPLAY=:0' in the start script in /etc/init.d/sabnzbdplus I get the following error upon starting the daemon:
** (sabnzbdplus:16603): WARNING **: Command line `dbus-launch --autolaunch=b7eca4d94b29d7e7d7e50e62000005a1 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n

So I believe that I inadvertently covered up that message by setting my DISPLAY variable... but maybe that is a red herring.


Thoughts?