0

It seems that i am failing big time to make aria2 autostart on boot.

Config:

  • Raspberry Pi 2
  • OSMC
  • Aria v 1.18.8 (latest apt-get)

Tried to make aria2 autostart via 3 methods:

  • init.d
  • systemd
  • crontab

Also tried the guidance here: https://bbs.archlinux.org/viewtopic.php?id=194644

All above work ok. Note that i can start aria using either the init.d script or by using systemctl start.

My /var/log/aria2.log after startup:

2015-10-20 16:48:29.134906 [ERROR] [HttpListenCommand.cc:114] IPv4 RPC: failed to bind TCP port 10101
Exception: [SocketCore.cc:292] errorCode=1 Failed to bind a socket, cause: Name or service not known
2015-10-20 16:48:29.136017 [ERROR] [HttpListenCommand.cc:114] IPv6 RPC: failed to bind TCP port 10101
Exception: [SocketCore.cc:292] errorCode=1 Failed to bind a socket, cause: Name or service not known
2015-10-20 16:48:29.136283 [ERROR] [MultiUrlRequestInfo.cc:292] Exception caught
Exception: [DownloadEngineFactory.cc:215] errorCode=1 Failed to setup RPC server.

My aria2.conf

daemon=true
enable-rpc=true
rpc-listen-port=10101
rpc-listen-all=true
rpc-secret=losadara6
####### your download folder, ensure that this folder exist! ##########
dir=/mnt/xontros/test/_dl/aria
log=/var/log/aria2.log
log-level=warn
dht-listen-port=53102
auto-save-interval=30
#seed ratio and seed time in minutes
seed-ratio=1.0
seed-time=1460
max-upload-limit=1K
max-download-limit=800K
event-poll=select
pause-metadata=true

My init.d script which runs ok by hand but not when in rc.d

#! /bin/sh
# /etc/init.d/aria2cRPC
### BEGIN INIT INFO
# Provides: aria2cRPC
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: aria2c RPC init script.
# Description: Starts and stops aria2 RPC services.
### END INIT INFO
#VAR
RUN="/usr/bin/aria2c"
ARIA_PID=$(pidof aria2c)
# Some things that run always
touch /var/lock/aria2cRPC
# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting script aria2cRPC "
if [ -z "$ARIA_PID" ]; then
nohup $RUN --daemon=true --enable-rpc=true -D --conf-path=/etc/aria2/aria2.conf
echo "Started"
else
echo "aria2cRPC already started"
fi
;;
stop)
echo "Stopping script aria2cRPC"
if [ ! -z "$ARIA_PID" ]; then
kill $ARIA_PID
fi
echo "OK"
;;
status)
if [ ! -z "$ARIA_PID" ]; then
echo "The aria2cRPC is running with PID = "$ARIA_PID
else
echo "No process found for aria2c RPC"
fi
;;
*)
echo "Usage: /etc/init.d/aria2cRPC {start|stop|status}"
exit 1
;;
esac
exit 0
  • The probable reason for not working is because, scripts are being called before network is up. Try calling it in rc.local or atleast have some mechanism to make sure that network is up and running by the time you call your script. A recent very similar question (ie, usiing network services) : raspberrypi.stackexchange.com/questions/37424/… Hope it helps. – dhruvvyas90 Oct 20 '15 at 14:27
  • tried rc.local, tried crontab...Have inmind that OSMC is using the newer systemd for autostart..I even add the command in mediacenter.service... – e4rthdog Oct 20 '15 at 14:32
2

This is because aria2 is trying to use IPv6 and failing. You can disable this option by adding following line to aria2 config

disable-ipv6=true
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.