NotifyOSD not working as daemon on Ubuntu 12.04

Support for the Debian/Ubuntu package, created by JCFP.
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
timpotter
Newbie
Newbie
Posts: 9
Joined: August 11th, 2012, 7:07 am

NotifyOSD not working as daemon on Ubuntu 12.04

Post 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?
timpotter
Newbie
Newbie
Posts: 9
Joined: August 11th, 2012, 7:07 am

Re: NotifyOSD not working as daemon on Ubuntu 12.04

Post by timpotter »

I should probably mention I'm running version 0.7.17RC1 from the jcfp PPA.
timpotter
Newbie
Newbie
Posts: 9
Joined: August 11th, 2012, 7:07 am

Re: NotifyOSD not working as daemon on Ubuntu 12.04

Post 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.
User avatar
sander
Release Testers
Release Testers
Posts: 9255
Joined: January 22nd, 2008, 2:22 pm

Re: NotifyOSD not working as daemon on Ubuntu 12.04

Post 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
User avatar
sander
Release Testers
Release Testers
Posts: 9255
Joined: January 22nd, 2008, 2:22 pm

Re: NotifyOSD not working as daemon on Ubuntu 12.04

Post by sander »

No response ...?
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: NotifyOSD not working as daemon on Ubuntu 12.04

Post by shypike »

I'll look at this before releasing 0.7.17
User avatar
sander
Release Testers
Release Testers
Posts: 9255
Joined: January 22nd, 2008, 2:22 pm

Re: NotifyOSD not working as daemon on Ubuntu 12.04

Post by sander »

FYI: No response from the OP, which drains my energy, so I'll unsubscribe and put the OP on my ignore list.
timpotter
Newbie
Newbie
Posts: 9
Joined: August 11th, 2012, 7:07 am

Re: NotifyOSD not working as daemon on Ubuntu 12.04

Post 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.
timpotter
Newbie
Newbie
Posts: 9
Joined: August 11th, 2012, 7:07 am

Re: NotifyOSD not working as daemon on Ubuntu 12.04

Post 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?
Post Reply