[SOLVED] Error startup: CoreFoundation/CoreFoundation.h:

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

Re: Error duing startup: CoreFoundation/CoreFoundation.h:

Post by sander »

No error message. Pity!

Rereading this thread, I want to verify a few things:
- starting SABnzbd.py / sabnzbdplus (so the plain SABnzbd) works?
- starting the /etc/init.d/sabnzbd.sh gives the error message?
- that script /etc/init.d/sabnzbd.sh does some checking, and wants to compile a file (which goes wrong)?

dirkonline
Newbie
Newbie
Posts: 18
Joined: February 12th, 2017, 4:09 am

Re: Error duing startup: CoreFoundation/CoreFoundation.h:

Post by dirkonline »

sander wrote:No error message. Pity!

Rereading this thread, I want to verify a few things:
- starting SABnzbd.py / sabnzbdplus (so the plain SABnzbd) works?
- starting the /etc/init.d/sabnzbd.sh gives the error message?
- that script /etc/init.d/sabnzbd.sh does some checking, and wants to compile a file (which goes wrong)?
starting SABnzbd.py / sabnzbdplus (so the plain SABnzbd) works? -> Yes SABnzdb runs and works
starting the /etc/init.d/sabnzbd.sh gives the error message? -> Yes,
/etc/init.d/sabnzbd.sh restart
armv7l
armv7l
Shutting down SABnzbdplus at Sun Feb 12 09:56:46 CET 2017...
Waiting for SABnzbdplus to shut down: 1, Done (Sun Feb 12 09:56:47 CET 2017)
armv7l
Performing SABnzbdplus prestartup checks at Sun Feb 12 09:56:47 CET 2017...
Checking for git... Found!
HEAD is now at 80c8ad5 remove -o from 7zip. Reverses #1149 Fixes #1175
Already up-to-date.
Checking environment
Checking if all configured directories exist....... Done
Creating Symbolic links for required utils. Done
Done
Already up-to-date.
Starting SABnzbdplus/share/CACHEDEV1_DATA/.qpkg/SABnzbdplus/Repository/lib/pytho n/cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_7882f2abxb4bfcf60. c:210:43: fatal error: CoreFoundation/CoreFoundation.h: No such file or director y
compilation terminated.
Done (Sun Feb 12 09:57:12 CET 2017)
that script /etc/init.d/sabnzbd.sh does some checking, and wants to compile a file (which goes wrong) -> Yes I think so, hold on:
#!/bin/sh

QPKG_NAME="SABnzbdplus"
QPKG_DIR=$(/sbin/getcfg $QPKG_NAME Install_Path -f /etc/config/qpkg.conf) #root of the qpkg dir
LOG_DIR=$(/sbin/getcfg misc log_dir -f $QPKG_DIR/Config/sabnzbd.ini) #log dir where the TAG files are stored
DAEMON="/opt/bin/python"
DAEMON_PACKAGE="$QPKG_DIR/Repository/lib/python"
DAEMON_OPTS=" SABnzbd.py -f /${QPKG_DIR}/Config/sabnzbd.ini --browser 0 --daemon --pid /tmp" #watch out that --pid only sets the path to the pidfile, not the name
PID_NAME="/tmp/sabnzbd" #am a bit lazy to code the pidpath in a variable too, so change path here to path set by --pid in the line above
PID_FILE="$PID_NAME-$(/sbin/getcfg Misc port -f $QPKG_DIR/Config/sabnzbd.ini).pid" #sabnzbd itself names it's pidfile to sabnzbd-<portnr-listening-on> can be http or https port
QDOWNLOAD=$(/sbin/getcfg SHARE_DEF defDownload -d Qdownload -f /etc/config/def_share.info)

#The url to the git repository we're going to install
GIT_URL=git://github.com/clinton-hall/nzbToMedia.git
GIT_URL1=http://github.com/clinton-hall/nzbToMedia.git

#Determin Arch
ver="none"
if /bin/uname -m | grep "armv5tejl"; then ver="arm"; fi
if /bin/uname -m | grep "armv5tel"; then ver="arm"; fi
if /bin/uname -m | grep "i686"; then ver="x86"; fi
if /bin/uname -m | grep "x86_64"; then ver="x86"; fi
if /bin/uname -m | grep "armv7l"; then ver="x31"; fi
arch="$(/bin/uname -m)"
[ $ver = "none" ] && err_log "Could not determine architecture $arch"

if [ -z "$LANG" ]; then
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
fi

export PYTHONPATH=$DAEMON_PACKAGE
export PATH=${QPKG_DIR}/${ver}/bin-utils:/Apps/bin:$PATH
export LD_LIBRARY_PATH=${QPKG_DIR}/${ver}/lib:/Apps/lib:$LD_LIBRARY_PATH

CheckForUpgrade() { #checks if there is a new sab version available and installs it
if [ ! -d ${QPKG_DIR}/sabnzbd/.git ]; then
git clone https://github.com/sabnzbd/sabnzbd.git ${QPKG_DIR}/sabnzbd || git clone git://github.com/sabnzbd/sabnzbd.git ${QPKG_DIR}/sabnzbd
cd ${QPKG_DIR}/sabnzbd
git checkout master
fi
cd ${QPKG_DIR}/sabnzbd
git pull
}

UpdateScripts() {
cd /share/$QDOWNLOAD/nzbToMedia
if [ ! -d /share/$QDOWNLOAD/nzbToMedia/.git ]; then
#git clone the qpkg in a temp dir ($$ returns the pid we are running under, should be random enough)
git clone $GIT_URL /share/$QDOWNLOAD/nzbToMedia || git clone $GIT_URL1 /share/$QDOWNLOAD/nzbToMedia
fi
#check for success else log error and breakoff install
if [ ! -d /share/$QDOWNLOAD/nzbToMedia/.git ]; then
/bin/echo "Could not git clone $GIT_URL"
fi
git reset --hard
git pull
sleep 10
}

CheckQpkgEnabled() { #Is the QPKG enabled? if not exit the script
if [ $(/sbin/getcfg ${QPKG_NAME} Enable -u -d FALSE -f /etc/config/qpkg.conf) = UNKNOWN ]; then
/sbin/setcfg ${QPKG_NAME} Enable TRUE -f /etc/config/qpkg.conf
elif [ $(/sbin/getcfg ${QPKG_NAME} Enable -u -d FALSE -f /etc/config/qpkg.conf) != TRUE ]; then
/bin/echo "${QPKG_NAME} is disabled."
exit 1
fi
if [ `/sbin/getcfg "git" Enable -u -d FALSE -f /etc/config/qpkg.conf` = UNKNOWN ]; then
/sbin/setcfg "git" Enable TRUE -f /etc/config/qpkg.conf
elif [ `/sbin/getcfg "git" Enable -u -d FALSE -f /etc/config/qpkg.conf` != TRUE ]; then
echo "git is disabled."
exit 1
fi
if [ `/sbin/getcfg "Python" Enable -u -d FALSE -f /etc/config/qpkg.conf` = UNKNOWN ]; then
/sbin/setcfg "Python" Enable TRUE -f /etc/config/qpkg.conf
elif [ `/sbin/getcfg "Python" Enable -u -d FALSE -f /etc/config/qpkg.conf` != TRUE ]; then
echo "Python is disabled."
exit 1
fi
[ -x /Apps/bin/git ] || /etc/init.d/git.sh restart && sleep 2
[ -x $DAEMON ] || /etc/init.d/python.sh restart && sleep 2
}

CheckForGit(){ #Does git exist?
/bin/echo -n " Checking for git..."
if [ ! -f /Apps/bin/git ]; then
if [ -x /etc/init.d/git.sh ]; then
/bin/echo " Starting git..."
/etc/init.d/git.sh start
sleep 2
else #catch all
/bin/echo " No git qpkg found, please install it"
/sbin/write_log "Failed to start $QPKG_NAME, no git found." 1
exit 1
fi
else
/bin/echo " Found!"
fi
}

CheckQpkgRunning() { #Is the QPKG already running? if so, exit the script
#exit if the file exists, else grab the https port and recheck
[ -f $PID_FILE ] && exit 1 #Normal HTTP port
PID_FILE="$PID_NAME-$(/sbin/getcfg Misc https_port -f $QPKG_DIR/Config/sabnzbd.ini).pid"
[ -f $PID_FILE ] && exit 1 #HTTPS port
#ok, we survived so sabnzbd should not be running
}

CheckEnvironment() { #Checks all (Download)paths, and links some libraries
/bin/echo " Checking environment"

#we assume the downloadshare will allways be used so it must be available
if [ ! -d $(/sbin/getcfg ${QDOWNLOAD} path -f /etc/config/smb.conf -d /ERROR) ] || [ ! -d "/share/${QDOWNLOAD}" ]; then
echo " ${QDOWNLOAD} is not found, aborting qpkg start."
exit 1
fi

/bin/echo -n " Checking if all configured directories exist"
#read all config directories from the config file
LOG_DIR=$(/sbin/getcfg misc log_dir -f $QPKG_DIR/Config/sabnzbd.ini)
DIRSCAN_dir=$(/sbin/getcfg misc dirscan_dir -f $QPKG_DIR/Config/sabnzbd.ini)
NZB_backup_dir=$(/sbin/getcfg misc nzb_backup_dir -f $QPKG_DIR/Config/sabnzbd.ini)
DOWNLOAD_dir=$(/sbin/getcfg misc download_dir -f $QPKG_DIR/Config/sabnzbd.ini)
CACHE_dir=$(/sbin/getcfg misc cache_dir -f $QPKG_DIR/Config/sabnzbd.ini)
COMPLETE_dir=$(/sbin/getcfg misc complete_dir -f $QPKG_DIR/Config/sabnzbd.ini)
SCRIPT_dir=$(/sbin/getcfg misc script_dir -f $QPKG_DIR/Config/sabnzbd.ini)
/bin/echo -n "."

#Walk the directories, set rights and create if needed
[ -d ${LOG_DIR} ] || /bin/mkdir -p ${LOG_DIR}
/bin/chmod 777 ${LOG_DIR}
/bin/echo -n "."
[ -d ${DIRSCAN_dir} ] || /bin/mkdir -p ${DIRSCAN_dir}
/bin/chmod 777 ${DIRSCAN_dir}
/bin/echo -n "."
[ -d ${NZB_backup_dir} ] || /bin/mkdir -p ${NZB_backup_dir}
/bin/chmod 777 ${NZB_backup_dir}
/bin/echo -n "."
[ -d ${DOWNLOAD_dir} ]|| /bin/mkdir -p ${DOWNLOAD_dir}
/bin/chmod 777 ${DOWNLOAD_dir}
/bin/echo -n "."
[ -d ${CACHE_dir} ] || /bin/mkdir -p ${CACHE_dir}
/bin/chmod 777 ${CACHE_dir}
/bin/echo -n "."
[ -d ${COMPLETE_dir} ] || /bin/mkdir -p ${COMPLETE_dir}
/bin/chmod 777 ${COMPLETE_dir}
/bin/echo -n "."
[ -d ${SCRIPTS_dir} ] || /bin/mkdir -p ${SCRIPTS_dir}
/bin/chmod 777 ${SCRIPT_dir}
/bin/echo " Done"
#Create symbolic links for required bin-utils and library files
/bin/echo -n " Creating Symbolic links for required utils"
/bin/echo -n "."

#copy the scripts over
SCRIPTS_FOLDER="/share/$QDOWNLOAD/nzbToMedia"
[ ! -f $SCRIPTS_FOLDER/CharTranslator.py ] && /bin/ln -sf "${QPKG_DIR}/Repository/scripts/CharTranslator.py" "${SCRIPTS_FOLDER}/CharTranslator.py"

/bin/chmod 777 ${QPKG_DIR}/${ver}/bin-utils/par2
/bin/chmod 777 ${QPKG_DIR}/${ver}/bin-utils/ionice
/bin/chmod 777 ${QPKG_DIR}/${ver}/bin-utils/nice
/bin/chmod 777 ${QPKG_DIR}/${ver}/bin-utils/unrar
/bin/echo " Done"
}

ConfigPython(){ #checks if the daemon exists and will link /usr/bin/python to it
#python dependency checking
if [ ! -x $DAEMON ]; then
/sbin/write_log "Failed to start $QPKG_NAME, $DAEMON was not found. Please re-install the Pythton qpkg." 1
exit 1
fi
[ -d $QPKG_DIR/Repository/lib ] || /bin/mkdir $QPKG_DIR/Repository/lib
[ -d $QPKG_DIR/Repository/lib/python ] || ln -sf $QPKG_DIR/${ver}/python $QPKG_DIR/Repository/lib/python
[ -d $QPKG_DIR/Repository/bin ] || ln -sf $QPKG_DIR/${ver}/bin $QPKG_DIR/Repository/bin
if [ $ver = "x31" ]; then
PY_DIR=$(/sbin/getcfg Python Install_Path -f /etc/config/qpkg.conf)
[ -f ${PY_DIR}/lib/python2.7/lib-dynload/_ctypes.so ] || cp $QPKG_DIR/${ver}/lib/_ctypes.so ${PY_DIR}/lib/python2.7/lib-dynload/_ctypes.so
[ -f ${PY_DIR}/lib/python2.7/lib-dynload/_sqlite3.so ] || cp $QPKG_DIR/${ver}/lib/_sqlite3.so ${PY_DIR}/lib/python2.7/lib-dynload/_sqlite3.so
[ -f ${PY_DIR}/lib/python2.7/lib-dynload/_ssl.so ] || cp $QPKG_DIR/${ver}/lib/_ssl.so ${PY_DIR}/lib/python2.7/lib-dynload/_ssl.so
[ -f ${PY_DIR}/lib/python2.7/lib-dynload/zlib.so ] || cp $QPKG_DIR/${ver}/lib/zlib.so ${PY_DIR}/lib/python2.7/lib-dynload/zlib.so
fi
ln -sf $DAEMON ${QPKG_DIR}/${ver}/bin-utils/python2 && ln -sf $DAEMON ${QPKG_DIR}/${ver}/bin-utils/python && ln -sf $DAEMON ${QPKG_DIR}/${ver}/bin-utils/python2.7
}

AddCron(){ #adds the once a day restart of sabnzbd to the crontab if tagged
#if not yet added to crontab, and feature is tagged, add a restart schedule for SABnzbdplus, every day
[ -f $LOG_DIR/AUTO_RESTART ] && /bin/echo -n " AUTO_RESTART tag found. Checking if crontab needs to be altered..."
if [ -z "$(/bin/cat /etc/config/crontab | /bin/grep "sabnzbd.sh restart")" ] && [ -f $LOG_DIR/AUTO_RESTART ]; then
/bin/echo -n " Yes, "
/bin/echo "5 3 * * * /etc/init.d/sabnzbd.sh restart" >> /etc/config/crontab
#restart crontab
/usr/bin/crontab /etc/config/crontab
fi
/bin/echo "Done"
}

RemoveCron(){ #removes the once a day restart of sabnzbd to the crontab, if found
if [ -n "$(/bin/cat /etc/config/crontab | /bin/grep "sabnzbd.sh restart")" ]; then
/bin/echo -n "Removing restart from crontab... "
/bin/sed -i '/sabnzbd.sh restart/d' /etc/config/crontab
#restart crontab
/usr/bin/crontab /etc/config/crontab
/bin/echo " Done"
fi
}

StartQpkg(){ #starts the QPKG
/bin/echo -n "Starting $QPKG_NAME"
cd ${QPKG_DIR}/sabnzbd
PATH=${PATH} ${DAEMON} ${DAEMON_OPTS}
/bin/sleep 3
/bin/echo " Done ($(/bin/date))"
}

ShutdownQPKG() { #kills a proces based on a PID in a given PID file
if [ -f $PID_FILE ]; then
#grab pid from pid file
Pid=$(/bin/cat $PID_FILE)
i=0
/bin/kill $Pid
/bin/echo -n " Waiting for ${QPKG_NAME} to shut down: "
while [ -d /proc/$Pid ]; do
sleep 1
let i+=1
/bin/echo -n "$i, "
if [ $i = 45 ]; then
/bin/echo -n " Tired of waiting, killing ${QPKG_NAME} now"
/bin/kill -9 $Pid
/bin/rm -f $PID_FILE
#clean up stuff we've linked to
/bin/echo " Done ($(/bin/date))"
exit 1
fi
done
/bin/rm -f $PID_FILE
#clean up stuff we've (might have) linked to
/bin/echo "Done ($(/bin/date))"
else
/bin/echo "${QPKG_NAME} is not running? ($(/bin/date))"
fi
}

case "$1" in
start)
{
/bin/echo "Performing SABnzbdplus prestartup checks at $(/bin/date)..."
CheckQpkgEnabled #Check if the QPKG is enabled, else exit
CheckQpkgRunning #Check if the QPKG is not running, else exit
CheckForGit #Check for git, start qpkg if needed
ConfigPython
UpdateScripts #Ensure scripts are up-to-date
CheckEnvironment #Check for all needed environment thingies
AddCron #Add a restart (thus auto upgrade check) to the crontab at 03:05 every night, if tagged
CheckForUpgrade #Do an upgrade check if wanted
StartQpkg #Start sabnzbd... (finaly ;) )
} 2>&1 | /usr/bin/tee $LOG_DIR/$QPKG_NAME-QPKG.log #Dump all output into the logfile

;;
stop)
{
/bin/echo "Shutting down ${QPKG_NAME} at $(/bin/date)... "
RemoveCron #removes the restart script if found. (should always remove regardless if tag exists or not)
/bin/touch $LOG_DIR/$QPKG_NAME-QPKG.log #make sure the logfile exists
#check if the pidfile exists, else grab the https port and fire shutdown routine
[ -f $PID_FILE ] || PID_FILE="$PID_NAME-$(/sbin/getcfg Misc https_port -f $QPKG_DIR/Config/sabnzbd.ini).pid"
ShutdownQPKG #shutdown the package, this routine also removes the cronjob
} 2>&1 | /usr/bin/tee -a $LOG_DIR/$QPKG_NAME-QPKG.log #append all output to the logfile
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac

User avatar
sander
Release Testers
Release Testers
Posts: 6974
Joined: January 22nd, 2008, 2:22 pm

Re: Error duing startup: CoreFoundation/CoreFoundation.h:

Post by sander »

OK. Then I would say the creater of that script (= package maintainer?) should take care of it; SABnzbd itself can't do it.

dirkonline
Newbie
Newbie
Posts: 18
Joined: February 12th, 2017, 4:09 am

Re: Error duing startup: CoreFoundation/CoreFoundation.h:

Post by dirkonline »

I am not sure if he is actively working on these issues
But I'll reach out to him on git he is actively there
Maybe it's still me though andmore a config issue of my oaths for python etc

User avatar
safihre
Administrator
Administrator
Posts: 3651
Joined: April 30th, 2015, 7:35 am
Location: Switzerland
Contact:

Re: Error duing startup: CoreFoundation/CoreFoundation.h:

Post by safihre »

Clinton-hall is active, just let him know on the QNAP forums.
So to make sure: when you just run sabnzbd.py, both cryptography and yEnc work?

dirkonline
Newbie
Newbie
Posts: 18
Joined: February 12th, 2017, 4:09 am

Re: Error duing startup: CoreFoundation/CoreFoundation.h:

Post by dirkonline »

safihre wrote:Clinton-hall is active, just let him know on the QNAP forums.
So to make sure: when you just run sabnzbd.py, both cryptography and yEnc work?
I'm on the road now, I'll try again and provide the output to make sure I didn't miss something earlier.

dirkonline
Newbie
Newbie
Posts: 18
Joined: February 12th, 2017, 4:09 am

Re: Error duing startup: CoreFoundation/CoreFoundation.h:

Post by dirkonline »

okay, I read that incorrectly earlier. My bad, sorry.

How do I start SABnzdb directly using the python script? As far as I understand it, I need to use the script either way so I am not quite sure how I am supposed to provide the output you requested. Sorry.

User avatar
safihre
Administrator
Administrator
Posts: 3651
Joined: April 30th, 2015, 7:35 am
Location: Switzerland
Contact:

Re: Error duing startup: CoreFoundation/CoreFoundation.h:

Post by safihre »

Do you know which folder SABnzbd is installed?
You should be able to run

python /folder/to/SABNzbd/SABnzbd.py -f /folder/to/SABNzbd/Config/sabnzbd.ini

User avatar
sander
Release Testers
Release Testers
Posts: 6974
Joined: January 22nd, 2008, 2:22 pm

Re: Error duing startup: CoreFoundation/CoreFoundation.h:

Post by sander »

For the record:

Code: Select all

Starting SABnzbdplus/share/CACHEDEV1_DATA/.qpkg/SABnzbdplus/Repository/lib/python/cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_7882f2abxb4bfcf60.c:210:43: fatal error: CoreFoundation/CoreFoundation.h: No such file or directory
CoreFoundation is a MacOS (formerly known as OSX) and iOS thing. https://en.wikipedia.org/wiki/Core_Foundation
That should not happen on your Linux NAS. It must be something upstream. It's unclear to Safihre and me what the root cause is.

For Google reference: #Cryptography #cffi #CoreFoundation

User avatar
sander
Release Testers
Release Testers
Posts: 6974
Joined: January 22nd, 2008, 2:22 pm

Re: Error duing startup: CoreFoundation/CoreFoundation.h:

Post by sander »

Dirk: And if you're going to report this upstream, check if that file _Cryptography_cffi_7882f2abxb4bfcf60.c still exist, and if so, if it contains "CoreFoundation.h". That would be wrong on your NAS, and closer to the root cause.

dirkonline
Newbie
Newbie
Posts: 18
Joined: February 12th, 2017, 4:09 am

Re: Error duing startup: CoreFoundation/CoreFoundation.h:

Post by dirkonline »

@Sander When you talk about reporting this upstream, who do you think I should reach out to? I am fairly certain this has nothing to do with Clinton's start script.

@safihre: I have not been home since we spoke but I will test is asap and get back to you here. I do know where SABnzdb is installed so I will give it a try for completeness sake.

dirkonline
Newbie
Newbie
Posts: 18
Joined: February 12th, 2017, 4:09 am

Re: Error duing startup: CoreFoundation/CoreFoundation.h:

Post by dirkonline »

Hi, so I never managed to get this reported somewhere. But in the end, I sorted it out be removing everything and doing a fresh install based on another QPKG by an amazing guy called OneCD on the QNAP forum. Same principle as Clinton's really but using a different and very robust method. -> https://forum.qnap.com/viewtopic.php?f=320&t=132373

Entware-3x (standard), except on i686 where Entware-ng will be installed
Git v2.12.2
Python v2.7.13
SABYenc v3.0.2
Par2cmdline-MT v0.6.14, except on ARMv5. This will use the single-thread par2 instead.
Cryptography v1.5.1
OpenSSL v1.0.2k
and one or more of the following:
SABnzbd+ v2.0.0 (master branch)

Thanks again for all the help!

User avatar
safihre
Administrator
Administrator
Posts: 3651
Joined: April 30th, 2015, 7:35 am
Location: Switzerland
Contact:

Re: [SOLVED] Error startup: CoreFoundation/CoreFoundation.h:

Post by safihre »

Cool! Thanks!

Post Reply