Sunday, August 10, 2014

Install transmission on opened linkstation

Note: More detailed instructions are available at http://forum.nas-hilfe.de/buffalo-technology-nas-anleitungen/transmission-auf-der-linkstation-live-und-pro-ls-chlv2-ls-xhl-ls-vl-mit-rotem-webinterface-t749.html

Remove existing optware first (If there are any) and then install it,

rm -rf /mnt/disk1/.optware
rm -rf /usr/lib/ipkg
cd /tmp
wget http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/ls-mvkw-bootstrap_1.2-7_arm.xsh
sh ./ls-mvkw-bootstrap_1.2-7_arm.xsh
mv /etc/init.d/optware /etc/init.d/rc.optware
ipkg update

I installed an old version of transmission as I need proxy functionality. Proxy functionality has been removed in newer versions.

ipkg install /mnt/disk1/share/transmission_1.92-1_arm.ipk

Installing transmission (1.92-1) to root...
Installing openssl (0.9.8v-2) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/openssl_0.9.8v-2_arm.ipk
Installing libcurl (7.24.0-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/libcurl_7.24.0-1_arm.ipk
Installing zlib (1.2.5-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/zlib_1.2.5-1_arm.ipk
Installing libevent (2.0.20-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/libevent_2.0.20-1_arm.ipk
Configuring libcurl
Configuring libevent
Configuring openssl
Configuring transmission
Configuring zlib
Successfully terminated.

Create start up and kill scripts,

update: if S95transmission.sh startup script does not get executed, when the linkstation is rebooted please refer to this blog post. http://swapoff.blogspot.com/2015/02/fix-optetcinitd-scripts-not-executing.html

echo '/opt/bin/transmission-daemon -g /mnt/disk1/share/.config/transmission-daemon' >/opt/etc/init.d/S95transmission.sh
chmod 755 /opt/etc/init.d/S95transmission.sh
echo 'killall /opt/bin/transmission-daemon' >/etc/rc.d/extensions.d/K05transmission.sh
chmod 755 /etc/rc.d/extensions.d/K05transmission.sh


Create required directories for transmission,

mkdir /mnt/disk1/share/downloads
chmod -R 775 /mnt/disk1/share/downloads
mkdir /mnt/disk1/share/incomplete
chmod -R 775 /mnt/disk1/share/incomplete


Execute S95transmission.sh to start transmission,

/opt/etc/init.d/S95transmission.sh
/opt/bin/transmission-daemon: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory

If transmission requires older libevent libs, install them manually,

cd /
tar -xvf /mnt/disk1/share/libevent_1.4.13-1_arm.tar.gz

Try to start transmission again.

/opt/etc/init.d/S95transmission.sh
/opt/bin/transmission-daemon: error while loading shared libraries: libssl.so.0.9.7: cannot open shared object file: No such file or directory

If transmission requires openssh 0.9.7 and if you can't find the libraries just copy 0.9.8 libraries as 0.9.7 libraries or just create symbolic links.

cd /opt/lib/

cp libssl.so.0.9.8 libssl.so.0.9.7
cp libcrypto.so.0.9.8 libcrypto.so.0.9.7

or

ln -s libssl.so /opt/lib/libssl.so.0.9.7
ln -s libcrypto.so /opt/lib/libcrypto.so.0.9.7

You should be able to start transmission now. Transmission will create it's own configuration files and folders once it is started.
Now it's time to configure settings.json file. You have to stop transmission daemon before editing this file.

kill transmission daemon

killall transmission-daemon

Edit settings.json file with your requirements. You can find more information about the parameters in this configuration file from https://trac.transmissionbt.com/wiki/EditConfigFiles link.

cd /mnt/disk1/share/.config/transmission-daemon
cp settings.json settings.json.bk

After doing the changes, here is the diff of my old and new configuration files,

diff -b  settings.json.bk settings.json  
--- settings.json.bk Sat Aug  9 18:56:00 2014
+++ settings.json Sat Aug  9 19:03:26 2014
@@ -9,11 +9,11 @@
     "bind-address-ipv4": "0.0.0.0", 
     "bind-address-ipv6": "::", 
     "blocklist-enabled": false, 
-    "dht-enabled": true, 
-    "download-dir": "\/root\/Downloads", 
+    "dht-enabled": false, 
+    "download-dir": "\/mnt\/disk1\/share\/downloads", 
     "encryption": 0, 
-    "incomplete-dir": "\/mnt\/disk1\/share\/.config\/transmission-daemon\/Incomplete", 
-    "incomplete-dir-enabled": false, 
+    "incomplete-dir": "\/mnt\/disk1\/share\/incomplete", 
+    "incomplete-dir-enabled": true, 
     "lazy-bitfield-enabled": true, 
     "message-level": 2, 
     "open-file-limit": 32, 
@@ -40,15 +40,15 @@
     "rpc-authentication-required": false, 
     "rpc-bind-address": "0.0.0.0", 
     "rpc-enabled": true, 
-    "rpc-password": "{37368ecab1a25447ef72869757670b0843a11af2ng37XPZL", 
+    "rpc-password": "password", 
     "rpc-port": 9091, 
-    "rpc-username": "", 
-    "rpc-whitelist": "127.0.0.1", 
+    "rpc-username": "admin", 
+    "rpc-whitelist": "*.*.*.*", 
     "rpc-whitelist-enabled": true, 
     "speed-limit-down": 100, 
     "speed-limit-down-enabled": false, 
     "speed-limit-up": 100, 
     "speed-limit-up-enabled": false, 
-    "umask": 18, 
+    "umask": 2, 
     "upload-slots-per-torrent": 14
 }

umask changed to 2 so that newly created files by transmission will have rw permission.

umask explanation from  https://trac.transmissionbt.com/wiki/EditConfigFiles,

umask: Number (default = 18) Sets transmission's file mode creation mask. See ​the umask(2) manpage for more information. Users who want their saved torrents to be world-writable may want to set this value to 0. Bear in mind that the json markup language only accepts numbers in base 10, so the standard umask(2) octal notation "022" is written in settings.json as 18.

below command is useful to convert octal number to base 10 number,
echo $(( 8#002 ))

Tuesday, August 5, 2014

log in to buffalo nas ls vl 1 TB as root

More detailed information can be found at http://buffalo.nas-central.org/wiki/Open_Stock_Firmware_LS-VL

If below error is shown by acp_commander, try plugging  in NAS ethernet cable to a different ethernet port in router.

A SocketTimeoutException usually indicates bad firewall settings.
Check especially for *UDP* port 22936 and make sure that the connection to your LS is working.
ERROR: Exception: SocketTimeoutException (Receive timed out) [ACP Send/Receive (Packet:8020 = ACP_Discover)]

1. Reset root password to abc123

java -jar acp_commander.jar  -t 192.168.1.3 -ip 192.168.1.3 -pw password -c "(echo abc123; echo abc123) | passwd"

2. Backup sshd_config file

java -jar acp_commander.jar  -t 192.168.1.3 -ip 192.168.1.3 -pw password -c "cp -p /etc/sshd_config /etc/sshd_config.orig"

3. Change PermitRootLogin to yes

java -jar acp_commander.jar  -t 192.168.1.3 -ip 192.168.1.3 -pw password -c "sed -i '/PermitRootLogin/s/no/yes/' /etc/sshd_config"

4. Restart sshd  service

java -jar acp_commander.jar  -t 192.168.1.3 -ip 192.168.1.3 -pw password -c "/etc/init.d/sshd.sh restart"


Information about the tested system,

from dmesg output or cat /proc/version,
Linux version 3.3.4-88f6281 (root@build2.dd-hot24.nas.buffalo.local) (gcc version 4.2.0 20070413 (prerelease)) #1 Tue Jul 9 14:48:53 JST 2013

from uname -a output,
Linux LS-VL406 3.3.4-88f6281 #1 Tue Jul 9 14:48:53 JST 2013 armv5tel unknown