Monday, May 30, 2011

Truecrypt 7 on Synology

The following is a basic guide to getting truecrypt 7.0a to compile on a Synology 1511+, using the optware tools. You should be able to follow this guide for non-x86 devices by changing references to "-march=i686" to the architecture of your device.


Download the latest truecrypt 7 sources from (this post is based on 7.0a)


Download NASM sources from the web

./configure --prefix=/opt/local CFLAGS="-march=i686" CC=gcc
make install



Download Fuse 2.8.5 from the web

./configure --prefix=/opt/local
make install
in fuse-src/include
cp fuse.h fuse_com*.h fuse_opt.h ../../truecrypt-7.0a-source/
make install-pkgconfigDATA
export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig



Download wxWdigets 2.8.12 - Truecrypt won't compile using 2.9.x series!


PKCS Headers

In /tmp/pkcs
export PKCS11_INC=/tmp/pkcs11


Build wxWidgets

In truecrypt-src directory

make NOGUI=1 WX_ROOT=/tmp/wxWidgets-2.8.12 wxbuild CFLAGS="-march=i686" CC=gcc


Build TrueCrypt

If you get something on the lines of

"TrueCrypt::CipherAES::IsHwSupportAvailable() const"

or "is_aes_hw_cpu_supported" make sure you have NOASM=1. It is for hardware AES anyway.


export LD_LIBRARY_PATH='/opt/lib:/opt/local/lib'
You will need to edit the Makefile and in the "Linux" section, add
CC_FLAGS += '-march=i686'
CC_XX_FLAGS += '-march=i686'


Else you will get complaints about _sync_fetch_and_add_4. (


Final step!

make NOGUI=1 WXSTATIC=1 ARCH=i686 CC=gcc AS=/opt/local/bin/nasm NOASM=1


Truecrypt compiled in Main/truecrypt


Copy this to your /opt/local/bin or where ever you place your executables.


I'll have a following post on using Truecrypt files.

When trying to mount an Truecrypt image it complained about a missing module. I have compiled the required modules in this post.

Sunday, May 29, 2011

Mounting Loopback Device on Synology

DSM 3.1 and 1511+, should work on other models.


First you will need to load the loop device kernel module

insmod /usr/lib/modules/loop.ko

Then you will need to initialise the loop back device with your image.

Check for a free loop device

losetup -f

If you don't have one do

mknod /dev/loop0 b 7 0

Then mount the loop device to the image.

losetup /dev/loop0 <img>

Then mount the loopback device to the filesystem

mount -t <filesystem> /dev/loop0 <mount point>

Dos Filesystem Tools on Synology

Need to be able to fsck fat filesystems on synology system?

Download dosfstool from

Then on (Synology 1511+ with build tools (optware-devel) install run

make CC=gcc CFLAGS="-march=i686"
make install-bin PREFIX=/opt/local


Thursday, May 26, 2011

Install Deluge on Synology

Install optware packages.

Install optware-devel

install gcc

Install Bash

Link Bash to /bin

ln -s /opt/bin/bash /bin/bash

Install Boost libraries


install openssl-dev

install zlib

ipkg install py25-buildutils


in your deluge source directory:

edit, change /usr/include to /opt/include

(you could also do a symbolic link if you like)


Fix the boost compile error!

nano /opt/include/boost/config/user.hpp
python2.5 build
python2.5 install --prefix=/opt/local


download install chardet

build, install



install py-xdg



Enjoy your new deluge installation.


You'll need to create a startup script, more on this later.


Configuring linux for synology cross-compile

Quickly configure the Synology cross compile toolchain on linux. (1511+ Intel Atom)

You may also need to specify C(XX)FLAGS="march=i686" See previous post on this.

env \
LD=/usr/local/x86_64-linux-gnu/bin/x86_64-linux-gnu-ld \
RANLIB=/usr/local/x86_64-linux-gnu/bin/x86_64-linux-gnu-ranlib \
LDFLAGS="-L/usr/local/x86_64-linux-gnu/lib" \
CFLAGS="-I/usr/local/x86_64-linux-gnu/include" \
./configure \
--target=x86_64-linux-gnu \
--build=i686-pc-linux-gnu \
--prefix=/usr/local \

Wednesday, May 25, 2011

ddrescue on synology (optware)

Done on a 1511+ (Atom x86_64)


If you do a straight compile you will get

undefined reference to `__sync_fetch_and_add_4'

need to tell it to use the i686 arch.

./configure --prefix=/opt/local CXXFLAGS="-march=i686"

Tried using ddrescue 1.14 (2011) compiled successfully.


Leave a comment if you would like me to send you a copy of the compile executable.

Macintosh filesystem support on Synology

Unfortunately the Synology boxes don't come with support for mounting Macintosh filesystems, which in a environment of primarily macintoshes was disappointing.

I originally set out to compile the kernel modules on the synology box itself, but after some stuffing about I decided to do it using a Ubuntu virtual machine.

You should be able to do this the same way on the Synology, but note you will definitely need to download the toolchain from Synology. OPTWARE GCC WILL NOT WORK. (At least on the 1511+ which uses a Intel Atom processing in 64bit mode, the optware gcc is 32bit only. You will get an error about 64bit mode not compiled in). See this post

Next up you'll need to download the Synology DSM GPL sources to get the kernel source, I tried using the generic kernel from but the version string on the Synology kernel is slightly different and won't load a module built against the generic sources.

Synology Box
vermagic: SMP mod_unload
Generic Kernel

I guess you could do whatever configuration is required to get the same version, but it is easier to download the sources from Synology website.

Next up you'll need a basic development environment, in my case I used the netinstall of 11.04 and install the bare system. Install build-estential and you'll need ia32-libs if you are using a 64bit machine, as the Synology toolchain is 32bit.

Once you've done that, extract the Synology toolchain into /usr/local, which depending on what architecture you are using, you'll have a couple of processor specific toolchains, in my case for the 1511+ I have,


If you are using the 1511+, the kernel is 64bit so you want to use "x64_64-linux-gnu" for your cross compile.

Check your specific kernel type using "uname -a"

Next extract the GPL sources from Synology into a directory, I used /usr/local/src

Double check the version of linux kernel on your box by using "uname -a", in my case I am on "2.6.32"

Change into the specific kernel source directory for you kernel, in this example "/usr/local/src/linux-2.6.32"

You need to get the default setting for the kernel for your specific unit by copying the correct config from the "synoconfigs" directory. In this case,

cp synoconfigs/x86_64 .config

Run the following command

make ARCH=x86_64 CROSS_COMPILE=/usr/local/x86_64-linux-gnu/bin/x86_64-linux-gnu- menuconfig

Inside the config, select the modules you want to create (make sure you have them selected as modules), save your new config and run

make ARCH=x86_64 CROSS_COMPILE=/usr/local/x86_64-linux-gnu/bin/x86_64-linux-gnu- modules

I created the hfsplus module, which ended up in fs/hfsplus/hfsplus.ko

running modinfo on the new module gives the following

filename:       hfsplus.ko
license:        GPL
description:    Extended Macintosh Filesystem
author:         Brad Boyerdepends:        
vermagic: SMP mod_unload



Leave a comment if you want me to send you the compiled hfsplus.ko module. (compatible with 1511+)

Tuesday, May 24, 2011

"No such file" when trying to execute linux program?

Yup, random error thanks for the help on this one.


Odds are you are on a 64bit machines trying to run a 32bit application.


If you are in ubuntu, do this

apt-get install ia32-libs



Friday, May 20, 2011

CentOS Package Error, YUM returns pkgKey Error.

Got this random error from YUM

Error: pkgKey 3185 doesn't exist in repo base You could try running: 
	package-cleanup --problems
	package-cleanup --dupes
	rpm -Va --nofiles --nodigest

Thankfully, google is your friend and you can fix it this this "un-suggested" way:

yum clean all
yum clean metadata


Leave a comment if this works for you.

Quicker Screen Sharing in OSX

Goto ~/Library/Application Support/

Drag "Screen Sharing" to your dock.


Now you have a popup with all your recent screen sharing sessions.

Update DNS Server on CentOS 5

DNS Servers are located here. (Same for most Linux distros)


Wednesday, May 18, 2011

Sweet OSX Apps: iResize

Looking for a free program to bulk resize your photos? Look no further than

iResize, available from the author's website

Go get it.

Automounting your CIFS shares on OSX

So, say you have a NAS/Server exposing shares over CIFS (SMB), and you want your OSX based computer / media player PLEX ( to automatically mount your media share on boot...Lets go. Works on 10.5 and 10.6, untested on others.

Note in my testing I have found CIFS to be more reliable and faster for transfers, essential when you have multiple systems accessing media/files. I had performance issues with AFP especially listing large directories.

OSX has a nice, built in mechanism for auto mounting filesystems, re-mounting them if they drop, it's called autofs.

In order to mount your SMB/CIFS share (or any type for that matter) it is simply a case of updating your /etc/fstab file.

In the follow example replace the following with your details

<SERVER> The DNS or IP of your server, [ eg. "server.local" OR "" ]
<SHARE> The name/path of the share on your server, [ e.g. "media" ] 
<USER> The username of the user to access the server share [ e.g. "john" ]
<PASS> The password of the user
<MOUNT> Where you want the share to be mounted [ e.g. "/Users/username/Media" ]

In Terminal, do the following

sudo nano /etc/fstab

Enter your password when requested...

<SERVER>:/<SHARE> <MOUNT> url automounted,url==cifs://<USER>:<PASS>@<SERVER>/<SHARE> 0 0

Save the file and exit, (press ctrl+x and answer yes to save)

Next you want to chmod your mount folder to ensure that you can access it, and the system can mount to it.

chmod 777 <mount>

Next, we want to restart the autofs service, so it knows of our new auto-mount

sudo automount -vc

It will return a list of mounts that it is automounting, and your new one should be in there. If you have any troubles, check the formatting of the command you a have placed in the /etc/fstab file, check your paths and user permissions on the server for the provided user.