Posted: Wed May 23, 2018 0:25 Post subject: [Solved] Duplicate processes and reboots
Hey guys, I've been diving into customizing my router and I'm blown away with what the thing is capable of, but I'm starting to run into issues in terms of stability.
All this is done with a USB hard drive formatted with EXT2/3 for /jffs and /opt, NTFS for shared data, and a linux-swap partition for swap. The NTFS partition is mounted via script to a fixed point for use in most of the services above.
Note: I do not know if swap is even being used.
Now it works but I don't know if I can get it to do so for longer than a week. Today alone the router has rebooted 3 times and I'm not unix savvy enough to figure out exactly why.
I'm not sure if this is normal and I've found nothing about it, but is it normal for there to be so many instances of transmission, minidlna, and so on? Perhaps this is why I'm getting these reboots? For now I'm disabling minidlna until I figure out how to make it stable.
Last edited by JZharay on Wed May 23, 2018 21:25; edited 2 times in total
I think MiniDLNA was the culprit. For whatever reason, having multiple paths for it to include created an equal number of instances of the process. So my router's CPU was splitting its time to them. Putting them all in one directory fixed the wild CPU usage.
That still doesn't account for the four transmission instances which shows up in syslog with three of them trying to set their ports but returning errors instead:
Code:
May 23 08:37:50 Netgear daemon.err transmission-daemon[1353]: RPC Server Unable to bind to 0.0.0.0:9091 after 10 attempts, giving up (rpc-server.c:773)
May 23 08:37:51 Netgear daemon.err transmission-daemon[1349]: RPC Server Unable to bind to 0.0.0.0:9091 after 10 attempts, giving up (rpc-server.c:773)
May 23 08:37:52 Netgear daemon.err transmission-daemon[1371]: RPC Server Unable to bind to 0.0.0.0:9091 after 10 attempts, giving up (rpc-server.c:773)
The problem wasn't so much the service, but my numerous partitions. My old startup script for the USB was mounting one of my drives to a fixed directory, making sure transmission's config files were my own and not the dd-wrt's default, and then restarting the process with "killall -HUP transmissiond". Problem was a time-case issue. It'd mount the drive four times at the same time (the initial mount, /jffs, /otp, /data), running the script each time and thus making a bash check impossible.
For those getting into this and wanting how I did it, here are my scripts:
USB Mount Script (change UUID to your drive partition's):
Code:
#!/bin/bash
if mount | grep -q "/tmp/mnt/data"; then
echo Nothing to mount.
else
mkdir /tmp/mnt/data
mount $(findfs UUID=01D3E16BDAD94A20) /tmp/mnt/data
fi
Startup Script:
Code:
#!/bin/bash
waitcount=0
until mount | grep -q "/tmp/mnt/data"; do
if [ "$waitcount" -eq 3 ]; then
echo "Drive not found?"
exit 1
fi
echo Waiting 10 seconds for mount...
sleep 10
waitcount=$((waitcount+1))
done
if ps | grep -v grep | grep -q "transmission"; then
echo Transmission already started!
else
echo Starting Transmission
rm /jffs/transmission/settings*
cp /jffs/transmission.settings.json /jffs/transmission/settings.json
transmissiond --config-dir /jffs/transmission
fi
if ps | grep -v grep | grep -q "minidlna"; then
echo MiniDLNA already started!
else
echo Starting MiniDLNA
minidlna -f /jffs/minidlna/minidlna.conf
fi
Extra: Restarting/Rebuilding MiniDLNA and Transmission
Code:
#!/bin/bash
if mount | grep -q "/tmp/mnt/data"; then
echo Rebuilding MiniDLNA
killall minidlna
rm /jffs/minidlna/files.db
minidlna -R -f /jffs/minidlna/minidlna.conf
else
echo HDD not mounted!
fi
if mount | grep -q "/tmp/mnt/data"; then
echo Restarting Transmission
killall transmissiond
rm /jffs/transmission/settings*
cp /jffs/transmission.settings.json /jffs/transmission/settings.json
transmissiond --config-dir /jffs/transmission
else
echo HDD not mounted!
fi