API Changing

Get help with all aspects of SABnzbd
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
julianh
Newbie
Newbie
Posts: 4
Joined: November 23rd, 2020, 5:33 am

API Changing

Post by julianh »

A bit of a Weird one.

My Sab clients are regularly reporting that they cannot access Sabnzbd. On Sab it says " API key incorrect, Use the API key from Config->General in your 3rd party program: 127.0.0.1>Radarr/0.2.0.1504 (ubuntu 18.04)"

However when I look at the API key in Sabnzbd it has indeed changed, so I change the key in the client, a few days later I get the same error and the key has changed again in Sabnzbd. What's strange is it seems to be switching between the same 2 keys.

Does anyone have any suggestions?

Thanks

Here are some details;

Version: 3.1.1 [99b5a00]
Uptime: 2d
Config File: /home/sabnzbd/.sabnzbd/sabnzbd.ini
Parameters: "/usr/bin/sabnzbdplus" "-s" "0.0.0.0:8080" "--browser" "0"
Python Version: 3.6.9 (default, Oct 8 2020, 12:12:24) [GCC 8.4.0] [UTF-8]
OpenSSL: OpenSSL 1.1.1 11 Sep 2018
Multicore Par2 (ticked)


From the log file

2020-11-10 06:55:26,136::INFO::[sabnzbdplus:1142] --------------------------------
2020-11-10 06:55:26,234::INFO::[sabnzbdplus:1143] sabnzbdplus-3.1.0 (rev=23f86e95f1f980963c4e4017276b3a3e2adfc6e2)
2020-11-10 06:55:26,346::INFO::[sabnzbdplus:1144] Full executable path = /usr/bin/sabnzbdplus
2020-11-10 06:55:26,347::INFO::[sabnzbdplus:1154] Platform = posix
2020-11-10 06:55:26,347::INFO::[sabnzbdplus:1155] Python-version = 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0]
2020-11-10 06:55:26,347::INFO::[sabnzbdplus:1156] Arguments = "/usr/bin/sabnzbdplus" "-s" "0.0.0.0:8080" "--browser" "0"
2020-11-10 06:55:26,352::INFO::[sabnzbdplus:1160] Not inside a docker container
2020-11-10 06:55:26,352::INFO::[sabnzbdplus:1163] Preferred encoding = UTF-8
2020-11-10 06:55:26,352::INFO::[sabnzbdplus:1179] SSL version = OpenSSL 1.1.1 11 Sep 2018
2020-11-10 06:55:26,524::INFO::[sabnzbdplus:1188] Certifi version: 2018.01.18
2020-11-10 06:55:26,524::INFO::[sabnzbdplus:1189] Loaded additional certificates from: /etc/ssl/certs/ca-certificates.crt
2020-11-10 06:55:26,524::INFO::[sabnzbdplus:1234] Using INI file /home/sabnzbd/.sabnzbd/sabnzbd.ini
2020-11-10 06:55:26,952::INFO::[postproc:140] Loading postproc queue
2020-11-10 06:55:26,954::INFO::[__init__:951] [N/A] /home/sabnzbd/.sabnzbd/admin/Rating.sab missing
2020-11-10 06:55:26,954::INFO::[scheduler:205] Setting schedule for midnight BPS reset
2020-11-10 06:55:26,957::INFO::[config:857] Writing settings to INI file /home/sabnzbd/.sabnzbd/sabnzbd.ini
2020-11-10 06:55:26,976::INFO::[__init__:349] All processes started
2020-11-10 06:55:27,230::INFO::[sabnzbdplus:297] Template location for Glitter is /usr/share/sabnzbdplus/interfaces/Glitter
2020-11-10 06:55:27,260::INFO::[sabnzbdplus:297] Template location for Config is /usr/share/sabnzbdplus/interfaces/Config
2020-11-10 06:55:27,262::INFO::[misc:988] [N/A] Running external command: ['/usr/bin/unrar']
2020-11-10 06:55:27,452::INFO::[misc:988] [N/A] Running external command: ['/usr/bin/par2', '-h']
2020-11-10 06:55:27,896::INFO::[sabnzbdplus:398] SABYenc module (v4.0.1)... found!
2020-11-10 06:55:27,900::INFO::[sabnzbdplus:417] Cryptography module (v2.1.4)... found!
2020-11-10 06:55:27,900::INFO::[sabnzbdplus:422] par2 binary... found (/usr/bin/par2)
2020-11-10 06:55:27,900::INFO::[sabnzbdplus:429] UNRAR binary... found (/usr/bin/unrar)
2020-11-10 06:55:27,900::INFO::[sabnzbdplus:439] UNRAR binary version 5.50
2020-11-10 06:55:27,901::INFO::[sabnzbdplus:447] 7za binary... found (/usr/bin/7za)
2020-11-10 06:55:27,901::INFO::[sabnzbdplus:458] nice binary... found (/usr/bin/nice)
2020-11-10 06:55:27,901::INFO::[sabnzbdplus:462] ionice binary... found (/usr/bin/ionice)
2020-11-10 06:55:27,904::INFO::[sabnzbdplus:1421] Starting web-interface on 0.0.0.0:8080
2020-11-10 06:55:27,904::INFO::[_cplogging:219] [10/Nov/2020:06:55:27] ENGINE Bus STARTING
2020-11-10 06:55:27,975::INFO::[_cplogging:219] [10/Nov/2020:06:55:27] ENGINE Started monitor thread '_TimeoutMonitor'.
2020-11-10 06:55:28,378::INFO::[_cplogging:219] [10/Nov/2020:06:55:28] ENGINE Serving on http://0.0.0.0:8080
2020-11-10 06:55:28,379::INFO::[_cplogging:219] [10/Nov/2020:06:55:28] ENGINE Bus STARTED
2020-11-10 06:55:28,380::INFO::[sabnzbdplus:1458] Starting sabnzbdplus-3.1.0
2020-11-10 06:55:28,385::INFO::[dirscanner:117] Dirscanner starting up
2020-11-10 06:55:28,385::INFO::[urlgrabber:96] URLGrabber starting up
2020-11-10 06:55:28,385::INFO::[notifier:122] Sending notification: SABnzbd - SABnzbd 3.1.0 started (type=startup, job_cat=None)
2020-11-10 06:55:28,519::INFO::[postproc:232] Completed Download Folder /home/sabnzbd/Downloads/complete is not on FAT
2020-11-10 06:55:29,445::WARNING::[interface:341] API key incorrect, Use the API key from Config->General in your 3rd party program: 127.0.0.1>Radarr/0.2.0.1504 (ubuntu 18.04)
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: API Changing

Post by sander »

Aren't mixing up the API and the NZB key?

If not: are you using a different sabnzbd.ini, for example via different startup methods?
julianh
Newbie
Newbie
Posts: 4
Joined: November 23rd, 2020, 5:33 am

Re: API Changing

Post by julianh »

Thanks for getting back to me, the key is the API key not the NZB key. it's valid to start off then isn't. The startup method is the same as it changes on reboots
Still stuck. any suggestions
User avatar
safihre
Administrator
Administrator
Posts: 5338
Joined: April 30th, 2015, 7:35 am
Contact:

Re: API Changing

Post by safihre »

Are you sure you aren't running 2 different instances of Sabnzbd? Since it's switching between the 2 api keys.
Could it be that it maybe also installed the Snap version of Sabnzbd?
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
julianh
Newbie
Newbie
Posts: 4
Joined: November 23rd, 2020, 5:33 am

Re: API Changing

Post by julianh »

I'm open to suggestions on how to check, but when I reboot the VM, the API key changes, but not always. This is why I'm scratching my head. How do I ensure it's not me seeing the wrong information. What can I post?

Thanks
User avatar
jcfp
Release Testers
Release Testers
Posts: 986
Joined: February 7th, 2008, 12:45 pm

Re: API Changing

Post by jcfp »

You'd want to check if the same config file is used (your topic start post mentions '/home/sabnzbd/.sabnzbd/sabnzbd.ini' so you know where to look).

As safihre mentioned, you're most likely running two different instances, for example because you setup two different autostart mechanisms and/or combined two different install methods on a single system.
julianh
Newbie
Newbie
Posts: 4
Joined: November 23rd, 2020, 5:33 am

Re: API Changing

Post by julianh »

HI all, I know it's been awhile, but I've been testing. You're right I suspect there are two instances of Sabnzbd being run, as the history is different today, after the API changed.

So how can force it to run one instance. I can only see one . The /etc/init.d/sabnzbdplus is below

Any further suggestions?

Thanks
---sabnzbdplus file ---
#!/bin/sh
#
# Copyright (C) 2008-2017 by JCF Ploemen <[email protected]>
# released under GPL, version 2 or later

################################################
# #
# TO CONFIGURE EDIT /etc/default/sabnzbdplus #
# #
################################################

### BEGIN INIT INFO
# Provides: sabnzbdplus
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Should-Start: $named dbus avahi network-manager wicd
# Should-Stop: $named dbus avahi network-manager wicd
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: SABnzbd+ binary newsgrabber
# Description: SABnzbd+ is a web-based binary newsgrabber with nzb
# support, designed to download files from Usenet.
# This script provides that functionality as a system
# service, starting the program on boot.
### END INIT INFO

NAME="sabnzbdplus"
DAEMON="/usr/bin/sabnzbdplus"
SETTINGS="/etc/default/$NAME"

([ -x "$DAEMON" ] && [ -r "$SETTINGS" ]) || exit 0

DESC="SABnzbd+ binary newsgrabber"
PIDFILE="/var/run/$NAME/pid"
DEFOPTS="--daemon --pidfile \"$PIDFILE\""

# these are only accepted from the settings file
unset USER CONFIG HOST PORT EXTRAOPTS

[ -r /etc/default/locale ] && {
. /etc/default/locale;
[ -n "$LANG" ] && export LANG;
}
export PYTHONIOENCODING=utf-8

. /lib/lsb/init-functions

is_running() {
# don't try to match --name: it changes after restarting via the web interface
start-stop-daemon --status --quiet --user "${USER%:*}" --pidfile "$PIDFILE"
RET=$?
[ $RET -gt 3 ] && exit 1 || return $RET
}

load_settings() {
if [ -z "$USER" ]; then
. "$SETTINGS"

[ -z "${USER%:*}" ] && {
log_action_msg "$DESC: service not enabled, edit $SETTINGS";
return 1;
}

OPTIONS="$DEFOPTS"
[ -n "$CONFIG" ] && OPTIONS="$OPTIONS --config-file \"$CONFIG\""
[ -n "$HOST" ] && SERVER="$HOST" || SERVER=
[ -n "$PORT" ] && SERVER="$SERVER:$PORT"
[ -n "$SERVER" ] && OPTIONS="$OPTIONS --server \"$SERVER\""
[ -n "$EXTRAOPTS" ] && OPTIONS="$OPTIONS $EXTRAOPTS"
fi
return 0
}

start_sab() {
load_settings || exit 0
if ! is_running; then
install --directory --owner="${USER%:*}" --group=root --mode=0700 "$(dirname "$PIDFILE")" || exit 1
log_daemon_msg "Starting $DESC"
eval start-stop-daemon --start --quiet --chuid "$USER" --exec "$DAEMON" -- $OPTIONS
log_end_msg $? || exit $?
else
log_action_msg "$DESC: already running (pid $(cat "$PIDFILE"))"
fi
}

stop_sab() {
load_settings || exit 0
if is_running; then
log_daemon_msg "Stopping $DESC"
start-stop-daemon --stop --quiet --user "${USER%:*}" --pidfile "$PIDFILE" --retry 30
log_end_msg $? || exit $?
else
log_action_msg "$DESC: not running"
fi
}

case "$1" in
start)
start_sab
;;
stop)
stop_sab
;;
force-reload|restart|try-restart)
[ "$1" = 'try-restart' ] && {
(load_settings && is_running) || exit 0
}
stop_sab
start_sab
;;
status)
load_settings || exit 4
if is_running; then
log_action_msg "$DESC: running (pid $(cat "$PIDFILE"))"
else
log_action_msg "$DESC: not running"
[ -f "$PIDFILE" ] && exit 1 || exit 3
fi
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
exit 3
;;
esac

exit 0
User avatar
jcfp
Release Testers
Release Testers
Posts: 986
Joined: February 7th, 2008, 12:45 pm

Re: API Changing

Post by jcfp »

The init script isn't the problem, it's strict enough not to randomly select different configs. There's a second mechanism starting sab with a different config but at the same port, most likely a redundant systemd service you added (in /etc/systemd/ or /lib/systemd/) under a different name than sabnzbdplus, but it could also be a desktop autostart or session restore function, even rc.local...
User avatar
safihre
Administrator
Administrator
Posts: 5338
Joined: April 30th, 2015, 7:35 am
Contact:

Re: API Changing

Post by safihre »

Maybe you have also the Snap verison of SABnzbd installed?
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
jasonnm
Newbie
Newbie
Posts: 3
Joined: October 29th, 2011, 6:58 am

Re: API Changing

Post by jasonnm »

Hey guys,
I'm also getting the same problem, but on Windows - there is only once instance running, but everytime I reboot my PC the key changes (and it's different each time, it would seem).

Anything I can check? I generally keep up to date - I think my last upgrade of SABNZBD was a couple of weeks ago. Everything was fine up to that point.
Is it best just to uninstall and reinstall?
Thanks!
User avatar
safihre
Administrator
Administrator
Posts: 5338
Joined: April 30th, 2015, 7:35 am
Contact:

Re: API Changing

Post by safihre »

Are your other settings preserved normally? Like server settings etc?
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
Post Reply