Building a torrent box with the Viglen MPC

Mini PC

Back in July 2009 I was given a Viglen Contender MPC microcomputer by an associate and it piqued my interest as I thought it would make a great low powered torrent box. On closer examination it is a rebadged FIC ION A503 (also known as Linutop) and it is based on the AMD Geode LX chipset (think 486 speeds here) and comes complete with 512Mb of PC2700 RAM and a 40Gb 2.5″ hard drive. Viglen were suppliying these units with an out of date version of Xubuntu (7.04) which was out of maintenance. The unit I acquired had a standard Windows XP image including all the current applications in use at the client’s site. Watching it boot up was a painful experience, it must have taken all of 5 minutes to get to the desktop. However, once there the response was just about OK but I wouldn’t rely on this as a day to day workhorse.

I thought it would make a great low powered torrent box

After some research I decided that it was time that I got re-acquainted with Linux. Now Viglen chose Xubuntu for a definite reason. The hardware itself is not really up to running a more resource hungry graphical environment such as Gnome or KDE etc. Xubuntu runs the Xfce window manager as it is a lightweight GUI that is ideal for older systems that run on slower hardware. Sadly Viglen couldn’t get the basic install right which I believe resulted in a number of units being unbootable, that is unless you know how to fix these things.

Installing Linux on the Viglen presents its own set of challenges as it is hardly as straightforward as some people would have you believe. In order to install Linux without getting a kernel panic you need to pass a few parameters in the boot sequence namely “pnpbios=off pci=noacpi“, if you’re unfortunate not to get to the graphical setup screen it has been suggested to pass this parameter “vga=forcevesa”. A number of websites recommend using the “alternate” text mode version of the Xubuntu distribution. However, although the kernel panic was avoided the install was frustrating as once it had completed and the system rebooted the signal from the onboard video was out of range leading to an unusable system.

Now it’s been a while since I last experimented with Linux, the last disributions I used were RedHat 5.2 and SuSe 5.2 and that was with the enlightenment desktop manager (e11 if I recall correctly), so I am used to having to muck around with linux in order to get it working e.g. modproble to detect SoundBlaster audio cards etc. With Xubuntu becoming increasingly frustrating, I decided to try out Debian 5.1 with almost the same problems.

One person recommended hooking up the hard drive to a “normal” PC and installing Xubuntu from there, while the install went like a breeze (when compared to the running in treacle speed of the Viglen), once again I was plagued by missing video. I tried running the startx command to try an diagnose what was causing the problem but to no avail as once the display disappeared there was no obvious way of killing the process and returning to the command line.

Out of curiosity I tried booting Slax 6 from a BartPE iso file I had and strangely enough I was able to load the live environment without the issues that Xubuntu presented me with. Armed with this knowledge I downloaded copies of Xubuntu i386 desktop CD’s for versions 8.04 and 9.04. The 9.04 installation failed with the same display problems as the alternative images. I was successful in installing the 8.04 (Hardy Heron) release. With 8.04 successfully installed I set about updating the distribution to the latest version. However this was not nearly as straightforward as you would think. In fact it was necessary to first upgrade the distribution to 8.10LTS before making the final upgrade to 9.04. The whole process took the best part of a Sunday afternoon on the Viglen.

With the upgrade finally completed I set about making the unit suitable for headless operation. Now the latest version of Xubuntu already has a remote desktop server package installed called “Vino”. Unfortunately it doesn’t work very well and is sluggish as hell, so an alternative means of controlling the PC needed to be found. I tried TightVNC but for some reason unknown to me I could never get the full desktop to display only a grey “X” session, I then tried FreeNX ( which is a proprietary application which is free in it’s basic form. Sadly I couldn’t get it to work even after hours pouring over FAQ’s etc (Tip: When using any Linux distribution you need to get use to doing this as nothing is as straightforward as Microsoft… there you go there’s the flame bait for all the Open Source fanboi’s). I eventually settled on using “x11vnc + Java” and having it run on startup by entering the following command;

x11vnc -forever -usepw -httpdir /usr/share/vnc-java/ -httpport 5800

in the user’s session. Now the fun began when I tried to do something that in the Windows world is so simple you’d laugh if I told you… automatically login as a user. Despite many forum posts and FAQ’s, automatic login doesn’t always work under Xubuntu 9.04. I’ve tried enabling it under the Logon screen option as well as manaully editing the /etc/gdm/gdm.conf and the gdm.conf-custom files to enable it and it still doesn’t work!

There had been some mention on the Ubuntu bug reports that GDM didn’t always work under 9.04, there was some speculation of a “race condition” which is a timing issue where certain events are not processed in the intended order leading to a failure. It was suggested to add a “sleep 3” statement in the gdm.conf file just before the [Daemon] statements but this didn’t work either. Eventually I stumbled on a post that made mention of the order that GDM was being processed in the init.rc-d startup files.

Although I didn’t know what the value of the GDM was I was able to finally resolve the issue by issuing the following commands in a terminal.

sudo update-rc.d -f gdm remove
sudo update-rc.d gdm defaults 99

After a number of power cycles I was able to verify that the system would boot up into an Xfce desktop environment as the specified user. Result!!

Update 23rd August 2009

Well after what looked like progress I hit yet another brick wall… getting file sharing using Samba to work. It seems that under Xubuntu Samba is broken and no matter what I tried I couldn’t get it working at all.

With this issue I decided that it was time to give Xubuntu a rest and look at some of the other distro’s out there. I tried Puppy Linux which had a really fast startup but ran into problems when installing it to the hard drive with autologin. It kept looping at the text stage respawning tty1 for some reason. I then looked at DSL but discovered it doesn’t install to the hard drive particularly well.

While on the quest I tried Ubuntu server which installed perfectly well in my VM test environment, but when installing onto the Viglen it couldn’t see the internal IDE hard drive. This problem had me scratching my head for some time, and it was purely by chance that in a free moment I was listening to the Ubuntu Podcasts that I learned that the IDE support was missing from the released kernel in the latest Ubuntu releases and had to be added manually. Now this in my opinion is why Linux is not and will never be ready for prime time useage… something as fundamental as basic hardware support should be built in from the get-go and not an afterthought. Now I may upset a few Linux users out there but my experience as a Windows Sysadmin and where time = money I can’t be wasting time in getting the fundamentals right. Now I know that Mac OS is built on BSD Unix but just look at how polished it is and how easy it is to use, now compare an contrast to any other mainstream Linux distro… maybe it’s me but I expect a better user experience. Anyway rant over.

During the podcast I heard that one of the presenters had recently got bored with Xubuntu and installed Crunchbang Linux instead, and this prompted me to try it and see how far I would get. To be honest the install of the latest release of Crunchbang went well, no real issues that i could think ofapart from getting used to the Openbox Window Manager (which is quite nice and lightweight!). So with #! (Crunchbang) as my base I then started at looking into getting rTorrent setup with a gui front end. I found a very long (and involved) howto on Flipside Reality’s site and while reading the comments I found a link to the Ubuntu forums detailing a script to install rTorrent and wtorrent with minimal configuration. The script worked like a charm and I was able to setup rTorrent and wtorrent simply which is how it should be!

For remote desktop admin duties I installed the OpenSSH server and x11vnc + Java. To get x11vnc running at login I had to modify Openbox’s default autostart file, by editing the file ~/.config/openbox/ and adding the following line:

x11vnc -forever -rfbauth ~/.vnc/passwd -display :0 -httpdir /usr/share/vnc-java/ -httpport 5800 &

After setting the vncserver password by using the following:

sudo x11vnc -storepasswd

I still couldn’t connect to the server. So I decided to try again by running the vnc command line in a Terminal and monitor the live error reports which showed that the password file could not be read. This immediately points to a permissions issue because most commands have to be run as “root” and therefore only have those permsisions applied. So chmod’ing the file to 775 sorted out that issue and a test connection was established successfully.

Getting Samba setup was not as difficult as it was under Xubuntu. Once installed I added two shares from the external hard drive to the configuration. I did run into one problem which resulted in the shared folder’s being visible but unable to display the contents, this was quickly fixed by using the following lines in the smb.conf file:
   comment = Completed downloads
   path = /mnt/exthdd/download/done
   writable = yes
   create mask = 0777
   directory mask = 0777
   guest ok = yes
   read only = no
;   share modes = no

   comment = Drop *.torrent files here
   path = /mnt/exthdd/download/torrents
   writable = yes
   create mask = 0777
   directory mask = 0777
   guest ok = yes
   read only = no
;   share modes = no

If you have an external drive like I have that was originally formatted with the NTFS filesystem then you need the create & directory mask settings or all you will see if an empty share and an error message saying that the resource is unavailable when you try to access it. Some websites that go through Samba configuration don’t always mention this and it can be a real head scratcher when it happens to you!

The last problem I came across while testing was that with the external hard drive being auto mounted I was getting error messages when logging into the wtorrent page stating “Warning: disk_total_space() [function.disk-total-space]: No such file or directory in /var/www/cls/rtorrent.cls.php on line 325”. When I opened a file manager and clicked on the actual drive the errors disappeared from the page. I put this down to the drive not being visible until clicked on in the file manager. To get round this I had to edit the /etc/fstab file and add in the following:

/dev/sdb1 /mnt/exthdd ntfs-3g defaults 0 0

Next I created a folder called “exthdd” in /mnt and then reloaded the fstab file by “sudo -a”. On checking the disk status the external hard drive was mounted in a new mount point and was visible to the system.

Correction: The errors were due to the fact that the wtorrent client had been previously configured with different values for the file paths in the database. I got round this by backing up the .rtorrent.rc file which I had edited and uninstalling/re-installing rTorrent + wTorrent via the script and entering the correct file paths using the new mount points in the wtorrent install.php page.

The last test is to see if it will run  “headless”. It did 🙂 Now I’m a happy bunny!

While testing the installation I did come across a minor problem with uploading *.torrent files via the wTorrent GUI, I received an error message stating Error: Impossible to create file on given directory, please check permisions. There is also some doubt as to whether on onboard NIC on the Viglen is really running at 100Mbit as file transfers are considerably slower. At the moment this is a fairly minor issue so I’ll get round to investigating this at my leisure now that everything is working.

In conclusion the whole experience has been a steep learning curve with many twists and turns along the way. If I had to do it again I would probably have installed TinyXP + uTorrent and be done in a couple hours. However I now have a bittorrent solution that’s not only versatile but also has a small carbon footprint.

Update 26th July 2010

Well after a year of running trouble free (I even installed SABnzbd+ and believe me that was the easiest install ever!) I found that since last week something had broken and WTorrent would not talk to rtorrent no matter what. So at the moment I am currently spending time trying to get rtorrent installed with the new and improved ruTorrent GUI, and while there are many walkthroughs on installing the two (even scripts!) the majority of them are broken in some way or other because the author’s rarely consider updating their documentation to take into account the effects of changing versions of software a case in point being the new folder structure in ruTorrent.

So watch this space!


2 thoughts on “Building a torrent box with the Viglen MPC

Comments are closed.