Synology Subversion server

I recently purchased a NAS box from Synology, A DS106j. I packed it out with a nice 500gb Hdd, and stuffed all my music on it, with space to spare. The box has some really nice features, Web server with PHP, A Torrent/Http download client (which comes in really handy for downloading large items from MSDN!), a nice Photo album that will auto create albums from photos on a usb key. Pretty neat. There’s a whole bunch of other stuff, but the interesting thing for me was the fact that inside, its a tiny linux box running NSLU2 so it should be quite modifiable.

Fortunately, it is. I happened across this page outlining what’s inside my DS106, and after some hunting i managed to track down a hack which enables telnet ! After reading the Synology Forums, ooh, for what seemed like whole minutes, I happened across some threads outlining how to install ipkg. Once ipkg was installed, its a short jump to installing the Latest subversion client, which was pretty painless. So, i now have a nice self-contained Subversion server, that’s always on, and facing the net (through my firewall) – no PC required!  Sweet!

Ok, so here are the steps required to make your Synology box into a fully fledged Subversion Server.

DISCLAIMER : This involves flashing your ROM to allow telnet access and modifying your box. Follow these steps ONLY if you understand the risks. If following these instructions Bricks your Box, ends your marriage , exposes your credit card numbers to nigerian scammers and destroys all life on the planet, don’t blame me. Damn, it may even invalidate your warranty. YOU HAVE BEEN WARNED!

 

  1. Download the telnet hack from here
  2. Open up your browser, login to your Synology box, and go to the firmware update page.
  3. upload the firmware, and flash your box. At this point the update will fail with an error 42 – this is normal, its designed this way to prevent your box rebooting.
  4. Open up a telnet session (run a command prompt and type telnet) or if alternatively download Putty
  5. connect to your Synology box – you should see the BusyBox login prompt! Congratulations, you’re half way there!
  6. login as ‘root’ – the password will be the same as your Admin password on the Box’s web admin page.
  7. Next download this file and copy it a folder on your Synology box, ‘public’ will do.
  8. next untar the archive using (if you copied the file to your public folder)

    tar -xzvf /volume1/public/bootstrap-ppc.tar.gz

    This will unzip the ipkg tools we’ll use for fetching and installing the subversion server.

  9. create a link using

    ln -s /volume1/opt /opt

  10. and then append the new paths to the environment

    export PATH=/opt/bin:/opt/sbin:$PATH

  11. Next, get an updated package database and then make sure we have the latest version of the installer

    ipkg update
    ipkg upgrade

  12. finally, we install the Subversion client with

    ipkg install svn

  13. Once that’s complete we can use the command line tools to create our repository, and fire up the svnserve server daemon.

 

Ok, so what are the chances of you getting this far, and not knowing how to use the svn command line tools? if you’re Wintel dev-chimp like me that spends most of his time looking for slick gui tools, then you’ll probably need a refresher, so here’s a couple of extra steps to get you started so you can go back to your nice Tortoise or AnkhSVN

  1. Create a new shared folder from the Synology web client – and leave it visible in explorer. This allows access to the repositories file system from the PC so we can edit the configs (using the pc), and back it all up to the PC/Burn DVD images etc. when required. I created a new folder called ‘svn’.
  2. Create the repository in that shared folder we’ve just created using the web client with this :

    svnadmin create /volume1/svn/repository

  3. When your repository is created we then go back to the PC, and edit the subversion config files straight from the shared folder. Its important to use an editor that won’t mess up the line endings , something like Notepad++
  4. Edit the config files in
    repository/conf
  5. you’ll need to add yourself a user , or enable anonymous access in the svnserve.conf file. RTFM for how to do this, but the config files do outline the bare minimums.
  6. at the command prompt fire up the subversion server
    svnserve -d -r /volume1/svn/repository

Note : you may need to reboot your synology box after changing the configs. Mine wouldn’t give me access until i’d rebooted, so YMMV.

also, you might like to add the svnserve command into the etc/rc config file. if you do, remember to make sure the /opt/bin and /opt/sbin paths are exported before you add the svnserve command.

For the observant, since the Diskstation has a webserver, you could probably get the Apache subversion mods running too. I don’t really need that so i didn’t bother looking into it. Another thing that might interest you is that now you have telnet access and ipkg installed , you can install a whole host of other usefull tools a decent list is available here

Anyway if all has gone well, you can now go back to your PC, and browse your brand spankin’ new repository!

Enjoy!

This entry was posted in General. Bookmark the permalink.

35 Responses to Synology Subversion server

  1. Pingback: RunToTheHills » Blog Archive » Synology Bittorrent Problems?

  2. Jonas says:

    Hi rob,

    nice tut for installing a subversion πŸ™‚

    I just wanted to ask you one question. I’ve installed the subversion succesfully on my synology DS-106 but since a day or two I’m having problems using the svnadmin command using a telnet session. It allways tells me:

    svnadmin: relocation error: /opt/lib/libsvn_fs_base-1.so.0: undefined symbol: apr_atomic_cas

    Do you have a suggestion for this? Removing and installing the package again via ipkg did not solve my problem. I’m helpless

  3. Jonas says:

    HI rob,

    just have fixed it right now. Seems that there have been a bug in the version I’ve installed. Just ran ipkg update and then ipkg upgrade svn. 1.4.3-2 is working fine now. Used 1.4.2-1 before.

  4. rob says:

    good, you got there first πŸ™‚ I was about to suggest making sure you’re up-to-date first. It is pretty cool isn’t it. Personally, i stay away from telnet, and use tortoise from the comfort of my windows machine πŸ™‚
    cheers!

  5. jolo says:

    Hi there,

    unzipped the bootstrap file and gotall the contents, made it to step 11, but then i get the following response in telnet
    -ash: ipkg: not found. I stayed true to your tutorial 100% except that i untared the bootstrap under windows.

    i own a ds101j

  6. rob says:

    you should follow the instructions and untar on the syno-box. i dont think it correctly re-creates the paths and their casing under windows. untar with busybox and it should be ok.

  7. jolo says:

    Hi Rob,

    i tried again untaring in buybox, but the link in step 9 is already made to a directory that had another name.Where is this link to be found? I guess i have to delete the link before i can run ipkg.But what really makes me wonder is that i can’t even run ipkg commands in the original directory.It again gives out the same message, that ipkg can’t be found.Anyway i’m sure i will get this problem solved if you can tell me how to start over again by making everything reversible. By the way, will i have with the subversion server the ability to manage all packets and versions of for example apache and others… Greetings

  8. Hi Rob
    Nice compact tutorial.
    I recently bought a DS-106j and enjoy it’s many features.
    I found your tutorial and have followed it, but when executing step 11 ipkg update this happens:
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/ds101g/cross/stable/Packages.gz
    wget: error while loading shared libraries: /opt/lib/libdl.so.2: ELF file OS ABI invalid
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/ds101g/cross/stable/Packages.gz
    wget: error while loading shared libraries: /opt/lib/libdl.so.2: ELF file OS ABI invalid
    An error ocurred, return value: 2.
    Collected errors:
    ipkg_download: ERROR: Command failed with return value 127: `wget –passive-ftp -q -P /opt/ipkg-KVVLry http://ipkg.nslu2-linux.org/feeds/optware/ds101g/cross/stable/Packages.gz
    ipkg_download: ERROR: Command failed with return value 127: `wget –passive-ftp -q -P /opt/ipkg-KVVLry http://ipkg.nslu2-linux.org/feeds/optware/ds101g/cross/stable/Packages.gz

    Any ideas, regards
    Svend E. Schwartz

  9. Hi Again Rob
    I rebooted my DS-106j and tried executing ipkg update without adding opt/bin and opt/sbin to my path, this time success.

    Svend E. Schwartz

  10. govokinolij says:

    Hi all!

    Looks good! Very useful, good stuff. Good resources here. Thanks much!

    G’night

  11. Pingback: RunToTheHills » Blog Archive » Visualisation Rocks!.

  12. likopinko says:

    Hi

    I am really excited. Very useful, i found lots of intresting things here. Your web site is helpful. Best regards!

    Bye

  13. fopikolijok says:

    Hello

    Nice! Many thanks, easy to find helpful information. Good work.

    Bye

  14. Helko says:

    Hi

    I’ve installed svn on my Synology DS 207.
    The following error occurs when I start svnserve:

    bash-3.2# ipkg install svn
    Installing svn (1.4.5-1) to root…
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/ds101g/cross/stable/svn_1.4.5-1_powerpc.ipk
    Configuring svn
    Successfully terminated.
    bash-3.2# svnserve
    svnserve: error while loading shared libraries: libuuid.so.1: cannot open shared object file: No such file or directory

    Any suggestions?

    Regards, Helko

  15. rob says:

    Hi Helko,
    two things spring to mind.
    1) make sure you’ve updated all the other packages (as in the original post)
    2) make sure you’ve rebooted.
    i think someone else also had the same problem as you and sorted it out in the same way!
    thanks for visiting!

  16. lokimikoj says:

    Hi all!

    Wow!!! Your site is beautiful!! I love the artwork.

  17. effeksys says:

    Hello.

    If i me re-login on telnet, i get the following response in telnet:
    -ash: ipkg: not found

    Also the entries in the Path are missing after re-login.

    After “PATH=/opt/bin:/opt/sbin:$PATH”:
    /opt/bin:/opt/sbin:/usr/sbin:/bin:/usr/bin:/sbin:/bin:/sbin:/usr/bin:/usr/sbin:
    /usr/syno/bin:/usr/syno/sbin:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:
    /usr/sbin:/usr/syno/bin:/usr/syno/sbin:/usr/local/bin:/usr/local/sbin

    After re-login:
    /usr/sbin:/bin:/usr/bin:/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/syno/bin:
    /usr/syno/sbin:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:
    /usr/syno/bin:/usr/syno/sbin:/usr/local/bin:/usr/local/sbin

    what’s wrong?

  18. rob says:

    Hi Effeksys,
    it shouldn’t matter about the paths, as long as you un-tar on the syno-box – it wont work under windows. you need to copy everything to the nas first. also, make sure that you update all the packages first.

  19. Effeksys says:

    Hi Rob,
    thx for your fast answer. I’ve tried on Mac OS X and WinXP, but doesnt work!? I copy the bootstrap to public and un-tar it on the synobox (DS106j; FW: 2.0.3 – 0458; BusyBox v1.1.0 (2007.04.02-17:14+0000)).

    “DiskStation> tar -xzvf /volume1/public/bootstrap-ppc.tar.gz
    root/.bash_profile
    root/.bashrc
    volume1/opt
    volume1/opt/src
    …”

    re-create the link:
    DiskStation> rm opt
    DiskStation> ln -s /volume1/opt /opt

    update/upgrade ipkg:
    DiskStation> ipkg upgrade
    Nothing to be done
    Successfully terminated.

    After re-login, the same problem:
    -ash: ipkg: not found & missing the entries in $PATH

    Have you one more suggestion for my Problem?

  20. Effeksys says:

    update/upgrade ipkg:
    Configuring bash
    Configuring readline
    Successfully terminated.
    Collected errors:
    Warning: remove /bin/bash failed: No such file or directory

  21. olabomba says:

    Helko => I had the same problem ; try to install :

    ipkg install e2fsprogs

  22. Lion says:

    Hello,

    i have the same problem, i took the offical pat file from synology, i can login and make your steps, but at end i get the message “not found”.

    regards,

  23. Peter says:

    Hello Rob,

    Thanks for the valuable info. I have managed to get this going, but with a few issues to resolve along the way.

    Using the tar command on the DS106e with the current directory as /volume1/public/ results in the contents being placed at /volume1/public/volume1/opt/ and not /volume1/opt/. This means that using the link command “ln -s /volume1/opt /opt” leaves the link pointing to the wrong place. Moving the files to /volume1/opt/ resolved the problem for me.

    Also entering the PATH mods and the svnserve command into the /etc/rc file does not seem to be effective. Are you sure this is the definitive location for initialisation with BusyBox?

    Regards,

    Peter

  24. rob says:

    Hi Peter!
    Thanks for commenting. TBH, its been so long ago that I installed SVN on my Diskstaion, i can barely remember how to telnet into it.
    I seem to rememeber that I did a lot of hunting for information on busybox to get it all working though. I’m sorry i cant be of more help.
    I’ll see if i can telnet into it (cant even remember the password it was so long ago!) and if so, where the file mods were that i made. I’m pretty sure that the description i made in the original post was correct though.
    Cheers,
    Rob

  25. Peter says:

    Rob,

    Don’t worry about it too much for my benefit. My DS-106e seems to have taken exception to my tinkering and won’t talk to me anymore (nothing to do with your info). I’m out for the next two weeks and will get back onto it later.
    Thanks!

    Peter

  26. Pingback: Installed subversion on my Synology CS 407

  27. Ling says:

    Hi Rob,

    Thanks for this excellent tutorial. I’ve managed to setup telnet and svnserve on my cubestation 406, with no problems!

    Repository setup and my first C# project checked in too!

    This is great! I’d buy you a beer if you were in Hong kong!

    Ling

  28. cooky says:

    Thx for your work. I read it and I just bought a DS-107+.
    I followed your steps (but except telnet I used the synology patch ssh).
    When I start ipkg the following error appears:

    DiskStation> ipkg update
    /opt/bin/ipkg: /opt/bin/ipkg: 1: Syntax error: “(” unexpected

    Any idea?

  29. cooky says:

    Sorry for posting.
    It does not work for Marvell based models.
    You could/should mention it in your very good docu.

  30. rob says:

    @Ling – No problem πŸ˜‰ I’ll add that to my virtual beer list πŸ™‚
    @cooky – I don’t know why it doesn’t work, I don’t have any other Syno boxes, but the tutorial does say its for the DS106J. If I ever upgrade i’ll look into this, but its kind of difficult to diagnose when i dont have a box, plus i’m not really a unix head, so I couldn’t offer the even the vaguest piece of useful advice. Sorry!

  31. Hugo says:

    Hi Rob,

    I’m having the same error about libuuid.so.1
    I have an DS209+
    All my packages are up-to-date and I’ve rebooted but to no avail.
    Searching on the internet revealed libuuid.so.1 having something to do with the ext2 package.
    I think I should not be fiddling with that?
    btw I do not have any libuuid.* file on the box.

    Hope you can help!

    Hugo

  32. rob says:

    Hi Hugo.
    I no longer really mess with my diskstation – i’ve got hosted a SVN server with dreamhosts, and its been over a year since i fiddle with it.
    Sorry cant help!
    Cheers

  33. Hi Rob,

    I’d just like to say a huge thanks for posting these instructions – they’re fantastic!

    For anyone wanting to get their Synology SVN Server to start automatically on boot or reboot here’s how I got mine working..

    I wasn’t brave enough to edit the /etc/rc file ;o)

    1. Log into your Diskstation (telnet or ssh), as ‘root’, and issue the following command:

    cp /usr/syno/etc/rc.d/S95sshd.sh /usr/syno/etc/rc.d/S99svnserve.sh

    2. then edit the new file with the following command:

    nano /usr/syno/etc/rc.d/S99svnserve.sh

    3. delete all of the contents of the file (keep pressing Ctrl + K to cut each line), and paste in all of the following:

    [from here – not including this line]
    #!/bin/sh
    # svnserve script for the Synology DiskStation
    # inspired by http://rob.runtothehills.org/archives/25
    # this script written by Andrew Freemantle (http://www.fatlemon.co.uk)

    case “$1” in

    stop)
    echo “Stop svnserve…”
    killall svnserve > /dev/null 2>&1
    ;;

    start)
    # don’t care if svnserve is already running, just kick of another one
    export PATH=$PATH:/opt/bin:/opt/sbin
    svnserve -d -r /volume1/svn/repository > /dev/null 2>&1 &
    echo “Start SSH…”
    ;;

    restart)
    $0 stop
    sleep 1
    $0 start
    ;;
    *)
    echo “usage: $0 { start | stop | restart}” >&2
    exit 1
    ;;

    esac
    [to here – not including this line]

    Thanks again Bob, and I hope this helps someone else save a couple of hours ;o)

  34. rob says:

    Hi Andrew!
    NIce to see that the article is still usefull!, its such a long time ago since I’ve actually fiddled with my synology box. I now have SVN hosting at Dreamhosts – makes more sense in my current circumstances, but the local SVN server at home is still used, and my DS106j is still going strong. Synology really do rock!
    Thanks for reading!

  35. Rullbandspelare says:

    Thanks!
    Saved me many hours today!

Leave a Reply