Vortex86DX Instructions from ICOP

Published on Saturday, December 5, 2009

Alexandru T. and I have exchanged a few emails, and he sent through a few helpful suggestions that were provided from ICOP. I have included them below. Thanks Alexandru!

1. Install Debian 5.0 on a normal PC (using a netinst image, for minimal install)

2. After installation boot normally from the same PC

3. Then, take the kernel from ftp://icop.com.tw/DIS_info/VDX/operating_system/VDX_Linux/linux-image-2.6.30-vortex86mx_1.0_i386.deb and then issue the following commands :

# dpkg -i  linux-image-2.6.30-vortex86mx_1.0_i386.deb
# update-initramfs -k 2.6.30-vortex86mx -c
# update-grub
# restart

4. Then take the hard-drive and install it on the Vortex86DX

5. When GRUB menu appears, press "e" and modify the boot loader as follows :

root        (hd0,0)
kernel        /boot/vmlinuz-2.6.30-vortex86mx root=/dev/hdb1 ro         --> if hdb1 does not work you can try (hda1= Primary Master or hdc1=Secondary Master)
initrd        /boot/initrd.img-2.6.30-vortex86mx

Then press b to boot

6. After booting, go to /boot/grub/menu.lst and make modifications from above permanently, so you will boot without any intervention ;)

Edit:Bob A. has also sent through some additional resources for your eboxing pleasures.

FYI - this Swedish company, http://www.lweb.se/tag/ubuntu/, has a pre-made ISO for Ubuntu 8.04LTS with the correct kernel for the eBox 3300/3310. It even supports the new (1011) IDE controller on the recent models. You can just put the ISO on a thumb drive, stick it in your eBox, and install normally. No need to install first on another machine, and no need to update the kernel after you're done. If you're happy with running 8.04 then this is way easier than any other install option that I've found
so far.

Lenny on Ebox 3310A

Published on Tuesday, November 3, 2009

As a preface, I take absolutely no credit for the below instructions. Stefan L kindly sent these through these instructions on installing Debian on the 3310A. I need to send a special thanks to Stefan, as I receive a lot of emails about the 3310 - but I don't have one, so I can't really do much:(
The only edit I've done is change out the links to my files on S3. If you find these helpful, or want to suggest an alteration, please leave a comment.
Download these files first:

The steps to install Lenny to CF in brief is:
  • 1) Install i386 version of Lenny to CF on another computer
  • 2) Add the revised kernel deb with dpkg -i *.deb
  • 3) Change fstab from hda1 to sdb1 (sda1 if there is no micro sd card) - uuids
    may be better
  • 4) Change /boot/grub/menu.lst to:
  • title           Debian GNU/Linux, kernel
    root            (hd0,0)
    kernel          /boot/vmlinuz- root=/dev/sdb1 ro verbose
    5) Probably need to change /boot/grub/device.map
    (hd1)   /dev/sda
    (hd0)   /dev/sdb
    With no micro sd it would be:
    (hd0) /dev/sda
    6) delete the section below "# PCI device ...." in /etc/udev/rules.d/70-persistent-net.rules (Otherwise the eBox network gets remapped to eth1 and may not appear if only eth0 is specified in the network settings) 7) Reboot & pray (bold added by Kelvin:P ). The next one is a revised initrd for the current Ubuntu 9.10: http://staff.washington.edu/lombaard/initrd.img-2.6.31-14-generic-pata_rdc 2.6.31-14 pata_rdc module for Ubuntu 9.10 The two changes are: blacklist dm_raid45 & add pata-rdc.ko "blacklist dm_raid45" needs to be added to /etc/modprobe.d/blacklist.conf I managed to boot into gnome desktop without any further problems. I have enabled PCI IDE Bus Mastering, plug&play and IDE native mode in the bios. Hope this saves someone else a few hours of frustration.

New Atheros Module and Ubuntu

Published on Tuesday, September 22, 2009

I've been using Atheros for quite some time, and I've always liked the madwifi drivers. They allowed really easy switching into monitor mode, and decent levels of packet injection. However, since I'm mostly in an office now, instead of writing web apps in cafes and trying to score free internet, I don't really need anything fancy. My gentoo stage 1 (3?) days are over. I use Ubuntu, because I'm lazy, and it mostly works.

My new laptop (well, 1.5 year old laptop now, but still new in my eyes) gave me the option between an Intel card and a Atheros wifi card. I chose the Atheros card; then the ath5k module came out, and life has been turbulent ever since.

In summary: the ath5k driver in the 2.6.28 kernel, which is what Ubuntu 9.04 uses, isn't as up-to-date as the drivers in compat-wireless. Fancy that... This presents me with the option of compiling a new kernel specifically with it, or just installing compat-wireless. I'm lazy, so...

I'll get a few basic troubleshooting commands out of the way first. After updating the kernel I kept getting disconnected - it appeared I was associate/disassociating frequently.

# dmesg
2577.134060] wlan0: associated
[ 2580.984838] wlan0: disassociating by local choice (reason=3)

# lspci | grep Atheros
03:00.0 Ethernet controller: Atheros Communications Inc. AR5212 802.11abg NIC (rev 01)

# ping
64 bytes from icmp_seq=2409 ttl=64 time=1.13 ms
64 bytes from icmp_seq=2410 ttl=64 time=2236.61 ms
64 bytes from icmp_seq=2411 ttl=64 time=4562.40 ms
64 bytes from icmp_seq=2412 ttl=64 time=6521.868 ms

The steps to resolve are as follows:

  • 1) Make sure you have headers for your current kernel.
  • 2) Make sure you have ability to compile programs.
  • 3) Download and install compat-wireless
  • 4) Unload and load the module.

So, first, use Synapitc to get the latest kernel headers and the 'build-essential' packages.

Next, download the compat-wireless package. I needed to use one from a few weeks ago because I received the following error:

make -C /lib/modules/2.6.28-15-generic/build M=/usr/src/compat-wireless-2009-09-22 modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.28-15-generic'
CC [M]  /usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.o
/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.c: In function 'b43_do_interrupt':
/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.c:1888: error: 'IRQ_WAKE_THREAD' undeclared (first use in this function)
/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.c:1888: error: (Each undeclared identifier is reported only once
/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.c:1888: error: for each function it appears in.)
/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.c: In function 'b43_request_firmware':
/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.c:2218: warning: format not a string literal and no format arguments
/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.c: In function 'b43_wireless_core_start':
/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.c:3867: error: implicit declaration of function 'request_threaded_irq'
make[4]: *** [/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43/main.o] Error 1
make[3]: *** [/usr/src/compat-wireless-2009-09-22/drivers/net/wireless/b43] Error 2
make[2]: *** [/usr/src/compat-wireless-2009-09-22/drivers/net/wireless] Error 2
make[1]: *** [_module_/usr/src/compat-wireless-2009-09-22] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.28-15-generic'
make: *** [modules] Error 2

You can download a working 2009-09-05 set from orbit-lab.org

# tar -xpjf compat-wireless-2009-09-05.tar.bz2
# cd compat-wireless-2009-09-05
# make
# make install
# make unload
# modprobe ath5k

All done. My variable ping times and random disconnections seem to have been mitigated. Thanks wireless guys!

Remove Dead Tags

Published on Monday, September 21, 2009

I've noticed my django-tagging install has been giving a lot of empty entries when doing a lookup on a tag. Tonight I finally got around to looking at what was causing this. This is surely not the best way to do this, but at 12:00am on a weekday, well, I shouldn't be doing it in the first place... I first wanted to see what type of content was generating the error:

for item in TaggedItem.objects.all():
print item.object
print item.content_type_id

Now that I could see what was causing it (I had removed an app that used django-tagging, but it left the tags with empty pointers). Removing the empty tags was easy enough:

for item in TaggedItem.objects.all():
print item.object

No more hanging TaggedItems.

Most Frequently Used French Words

Published on Sunday, August 30, 2009

Status: Done!

I'm currently studying French with my partner, and if you've read any of this site, you'll notice I'm a bit of a techie. Often several of my interests collide, which is what happened today. I was searching for the "most frequent french words," and while I found some lists, nothing was exactly what I wanted.
My desire was to have a PDF of the top few thousand most used French words. With the English translation next to it. In order. I've found some great resources, which I'll list now
I've also found 100s of sites with 50 words or so - not exactly what I wanted. This spawned a question for me: if I were to search a popular French newspaper website, what words would be the most frequent? I would want to learn those first. A few hours later, and I've compiled that list. I'll write the details of how I did it at the end, but just know I collected over 16,000 unique words, and "read" over 80,000 words from a variety of articles. Below is a PDF of the most popular words, ranked in order, with (maybe crappy) English translations.

The 3216 Most Unofficially Frequent French Words (or download as ODS format)

More to come...! I'm going to continue building the database to make sure the ranking is correct, and will make some pretty graphs when I have time. I will also likely modify things to include what type of word it is, and an example in a sentence.

Please feel free to use this list as you see fit in accordance with CC by 4.0

Testing SMS Gateways

Published on Tuesday, July 14, 2009

For one of my projects I'm testing an SMS gateway, and decided it would be fun to build a useful alarm clock out of it. For those of you who know Python, you may find this funny. /dev/ttyUSB0 is my Arduino with a temperature sensor.

import serial
import urllib2

def check_temp():
ser = serial.Serial('/dev/ttyUSB0', 9600)
t = ser.readline().strip()
return float(t)

t = check_temp()
if int(t) < 8:
message = "It+is+now+%f+degrees;+chuck+a+sicky." % t
f = urllib2.urlopen('http://api.clickatell.com/http/sendmsg?user=johnd&password=p@55w0rd&api_id=2132867&from=61433735555&to=61433735555&text=%s' % message)

And in crontab:

45 6 * * * python /opt/scripts/temp_alarm.py

Simple Arduino + LED Tutorial

Published on Wednesday, July 1, 2009

For this you'll need: an Arduino, an LED, a USB cable, and the Arduino software.

1) Get the LED, and plug it in to your Arduino. Plug in the long end to pin 13, plug the short end to the GND.

2) Plug in the Arduino into your laptop. Go to Tools->Serial Port. Choose the USB port that appears.

3) Take the code from the BlinkingLED tutorial and paste it in to the arduino like so:

4) Hit File->Upload to I/O Board.

5) Hit (physically) the little reset button. Voila! a blinking LED!

Arduino 101

Published on

Tonight, I'm proud to say, I've returned to childhood. Let me explain.
OK, fun over, back to work.

For the last year I've been wanting to purchase an Arduino, for no other reason than to play with. Like a kid. My Arduino arrived two days ago. This is a story of problems, but not the pull-your-hair-out type, more the... like when you run out of gas in the middle of Sydney. Going to your Christmas dinner. In your friend's car. Long story.

As a kid I never really learned about electronics. I took apart anything broken my parents set downstairs (and put back together the microwave I dismantled that my parent were going to give to my sister as a gift). But no electronics. I had a computer of some sort from when I was a wee kid, but not a single electronics kit, or not one I can remember.

I soon realised I forgot to order a few resistors needed for the various sensors I purchased. This morning before work I stopped by the local electronics store, and like a kid in a candy shop, ordered $1.60 worth of resistors and LEDs.

Just after coming home and eating insanely good Indian with YS, I set out to get an LED blinking. Without too many troubles, success! I graduated myself to the next grade and pulled out the temperature sensor. I looked at the 'special' wires I bought to connect to the sensor and the breadboard, and I soon realised I actually purchased the M->F wires instead of the assorted pack. I started looking around for cables I could cut.

Spare USB cable, no. Telephone cable, maybe. My partner's iPod cable... and I realised I could just slice up one of the cables and see if it worked. The cables were braided instead of solid coper, which sort of made my hopes sink, but it was too late now.

I soon wired everything together as the various forum posts suggest, plugged it in to my laptop, started the Arduino software, and loaded the Dallas Temperature Library, and - "Invalid CRC". I pulled the wires off, stripped a little more cabling off, plugged it back in, and tried again. It worked! I don't really know if the temperature is correct or not - we don't have any other way to measure it - but at this point, until I put in some more robust wires, I don't really even care.

Overall, I'm happy. I've created two simple physical computing missions, and wrote two blog entries, in well under two hours. This has been quite a relaxing break from the other duties in life. I plan to make the little system 'proper' (more robust), and link it to my mini server. I'll then create a simple chart (via Google's API) to display on this website.
OK, fun over, back to work.

GPS Gem Find - TangoGPS

Published on Monday, June 29, 2009

I've been looking for a simple, no-hassles GPS display program for Linux, and I believe I finally found one: TangoGPS. My requirements were quite simple; I needed something that would talk to gpsd, and display a dot on OpenStreetMaps. I've been able to do this in other programs (even in 3d in WorldWind), but I wanted something to download the maps for me, and GTK+ would be a plus.

TangoGPS was easy to install (apt-get install tangogps), and on my test 'drive' home tonight on the train, worked a treat. See related screenshots.

ISO Code Error

Published on Wednesday, June 17, 2009

I've received this error a few times when working with pytz:

Error reading file '/usr/share/xml/iso-codes/iso_3166.xml'

In short, install the 'iso-codes' package in Ubuntu/Debian. I'm sure this is covered in the manual that I didn't read, but I'm sure others didn't read it too.

apt-get install iso-codes

Radius Backed ACL

Published on Sunday, June 14, 2009

Status: Not Started

I run OSSEC almost everywhere - it is one of my favourite software packages. I'm running it at home on my tiny "server", which works great. If somebody scans me, I know. I would ultimately like to be able to block them at the gateway. Because the normal Cisco router IOS doesn't have a 'shun' command (as compared to the normal firewalls), there isn't any easy way to script it (I've tried using expect, I can't see how it could be done). I found that ACLs can be stored in a database.
After finding this out, I've added another project to my list: create a dynamic ACL database for my Cisco to integrate with, and block traffic to/from that OSSEC detected as dangerous. I've even contemplated integration with various RBLs and Google's Safe URL API.
This project might remain idle for a while, however, as I need to focus my energies on other areas.

Additional Resources

CLI Config
Integration with Websense
IOS requirements
Details of URL Filter

Operation Cold House

Published on

Status: Done!

My house is cold. I want to start playing with simple electronics before starting Operation Field, so have created Operation Cold House.

This is just simply sticking a temperature sensor onto an Arduino, linking that up to my little home "server", and uploading that to my website. I'll display some nifty graphs, too, and link it to Pachube. Stay tuned.

Update: Complete! The proof is in the pudding. I now have a personal website from home (sorry, not public) that displays the daily and weekly temperature at home. The process is basically like this: my little Arduino gathers the temperature, and is polled every minute with a python script via cron. This script then sticks the time and temperature into MySQL. It also exports the temperature to Pachube. Every 30m I have a script that queries MySQL and uses Google's Chart's API to graph the temperature. Looks great, I'll post a graph soon.

Installing Debian 5.0 on Vortex86DX

Published on

After writing about compiling a new kernel for the Vortex86DX, I've had quite a few people email me asking how I installed Debian in the first place. The installation is actually quite straightforward, but it involved several quirky techniques. After doing another install I decided to keep track of the process of installing Debian 5.0 on my eBox-3300.

The following guide assumes a few things. First, you are currently using Linux and a debian variety (although instructions could be altered if using Windows). Second, your USB shows up as /dev/sdb. Third, your eBox-3300 has the HDD set in Native mode. Forth, you are patient.

1) Download the custom vmlinuz and initrd.gz files from my site. Also, download the custom deb files we'll use near the end of installation:


2) Download an i386 netinst iso:


3) Make sure the USB has an MBR installed:

apt-get install syslinux mtools mbr
install-mbr /dev/sdb

4) Format the device as FAT32 with whatever tool you like.

5) Run syslinux on it:

syslinux /dev/sdb1

6) Mount the USB (or pull it out and plug it in again so it shows up on your desktop), and copy the downloaded vmlinuz, initrd, netinst.iso and deb files onto the USB. There should be a file called ldlinux.sys already; create a file called syslinux.cfg and put the following in it:

default vmlinuz
append initrd=initrd.gz root=/dev/rd/0 devfs=mount,dall rw DEBCONF_PRIORITY=medium

It should look like this:

Ebox files

7) Unmount the USB, and put it in your eBox-3300. When the system boots up initially, hit F11. Select your USB device. Depending how you created the MBR it might come up as saying "MBR FA:". Press "A". When 1234F comes up, press "1". Press enter at the SYSLINUX "boot:" screen.

8) Proceed as normal through the menu. It will search for an ISO image, and should detect the netinst image you inserted earlier. When you get to the "Load installer components" section, it will complain about no kernel modules found. Select YES. On the next screen you shouldn't need to load any components, so hit continue. Proceed as normal.

9) If you are ever asked about starting PC card services, hit NO. Proceed as normal.

10) Eventually you will hit a screen that says LVM is not available, hit CONTINUE. Proceed as normal.

11) Near the end it will toss up a list of available kernels. Select either, it shouldn't matter. When you are allowed to select drivers to include in the initrd, select TARGETED. Proceed as normal.

12) You might get to a point where it says Install GRUB boot loader on a hard disk. This will fail. That's ok, just skip it and select "continue without boot loader".

13) You will end up on the "Finish the installation" menu. DO NOT finish! We now need to swap out the current kernel with one that works. Scroll down and select "Execute a shell". Press CONTINUE. Try these steps when the shell prompt appears:

cd hd-media
cp *.deb /target/usr/src/
cp vmlinuz /target/boot/vmlinuz-2.6.26-2.486
cp initrd.gz /target/boot/
cd /target/boot
gunzip initrd.gz
mv initrd initrd.img-2.6.26-2-486

Your system will now reboot, and it should actually boot correctly. However, you're using a kernel that doesn't have any headers or modules, which means you can't activate anything. Once the box boots up, login and install the included custom kernels:

cd /usr/src
dpkg -i linux-image-
dpkg -i linux-headers-

Once the system comes back up, you should be running a spiffy 2.6.29 kernel, with the ability to add modules.

You may want to follow the tuning section from the MicroClient page on Google Groups. I also modified my fstab file to help reduce wear on the CF card:

tmpfs /var/run tmpfs defaults,noatime 0 0
tmpfs /var/lock tmpfs defaults,noatime 0 0
tmpfs /var/tmp tmpfs defaults,noatime 0 0 

Contribution 1: Francois Fleuret emailed through a kind reminder that the qemu-onto-SD card method is a viable option. So, if you want to go the SD route, and have an SD reader, this might be what you're after!

Basically, install Debian on a SD card with qemu (start qemu with the
install disk iso as cdrom and the SD card as hda), while you are still
in qemu, download and install the kernel deb file


then quit qemu, put the SD card in the box and reboot. You are done!

If you want the source file for the above kernels, you can get it from here: 2.6.29-3 source. I recently recompiled the kernel with some extra modules enabled (e.g. ecryptfs), so if you would like to try a newer kernel, you can download my updated kernels too:


Contribution 2: Trent L has also recompiled a 2.6.28 kernel with wireless extensions built into it, which is what was needed for his wireless card. He has kindly allowed me to distribute them; you can find them here:


Contribution 3: If you have the ebox-3310, you can still read through this, but you may also want to see a suggested installation method and kernels from Stefan.

Contribution 4: Alexandru T. sent through some instructions directly received from ICOP. I've added another page with the details. Thanks Alex!

Contribution 5:: Rainbow sent through the solution if your kernel panics with:

it report "kernel bug at fs/buffer.c 1864" and system go mad, even
> "halt" "reboot" take no effect.

Rainbow reported that:

this issue cause by an error Vcore, 0.90v refered by datasheet, and it should be above 0.97.

Contribution 6:: Bob's also sent through his config file.

Contribution 7: Bob A. has sent through some resources about a special ISO specific for the ebox. It has been added to another page.

Update: I've needed to recompile a new Lenny vortex86dx-enabled kernel for image, headers, source and config.

Downloading VMWare with Firefox

Published on Tuesday, June 9, 2009

I've had this issue happen to me several times, and I'm finally writing myself a note to fix it in the future. There seems to be an issue with downloading VMWare Workstation (.bundle). I first tried it with Firefox, but it just crapped out at loading it into /tmp. Next, I tried it with Lynx, but alas, it tried to download it as a text file.

Ahah! The quickest solution I could find is to right click the link, save as, and save it as a zip. Rename it to .bundle when you're done.

Create a Movie from Images

Published on Monday, June 1, 2009

I've started leaving my webcam on as a motion detector to find out who is leaving the shopping cards on our lawn, and ultimately have found it useful to stitch the images together into a movie. There are several ways to do this - and my way maybe isn't the best - but it works for me.

I first installed and configured motion, which I've used for years. I then created a file in ~/.motion called motion.com:

$ cat ~/.motion/motion.conf

height 480
width 640
framerate 2

By creating this file, it allows me to start motion without modifying the global motion.conf file permissions, or *gasp* running it under sudo. There are lots of options you can put in your motion.com file.

With motion installed, and configured, now install mencoder.

I prefer to generate a seed file based on the creation date for each image. If you try to use mencoder with just a *.jpg, it works, but my video jumped around.

$ pwd
$ ls -rt *.jpg > list.txt

This list.txt file now has the filenames, in chronological order, ready for consumption. I create the video like so:

mencoder mf://@list.txt -o `date +%G%m%d`.avi -ovc lavc -lavcopts vcodec=mjpeg

This will output a file with today's date in a few seconds. Remember, the `'s are the key by the #1, not quotes.

Compiling kernel for Vortex86dx

Published on Sunday, May 10, 2009

Update: I've written up a short tutorial on the method I used to install Debian 5.0 on this device.

A few months ago I purchased the eBox-3300 from WDL Systems. The system was promptly shipped, and there were no "gotchas" from WDL. The little box fit my exact needs - it is small, and built very, very well. I flew back to Australia and, after some trial and error, installed Debian 5.0 on it. For quite some time I was just using the vmlinuz file provided by WDL, which was provided by ICOP (DMP). This worked well, but there were two issues:

1) I couldn't load any modules (e.g. NFS).

2) I received an annoying email from OSSEC every few hours telling me it couldn't find modules.dep.

At the end of last week I finally decided to do something about it, and considering this little box is "x86 compliant", I figured it wouldn't be too hard to create a new package. It has been several years since I last created a self-compiled Debian-packaged kernel, so I decided to document the process for the next time I do it. These steps are really just a summary - but if you have much Linux experience, they should be enough to guide you. If I'm unclear, just send me an email.

Because the eBox-3300 is embedded, I logically decided to create the package on another system. However, I wanted to maximize the chances of it working, so I installed Debian 5.0 in VirtualBox, updated it, and proceeded.

As a prep, you may need to install ncurses-dev and kernel-package in your build environment.

apt-get install ncurses-dev kernel-package

1) Download latest kernel from: http://www.kernel.org/pub/linux/kernel/v2.6/

2) Download the DMP provided patch/config file for, copy it to /usr/src. Alternatively, you can borrow my config Make a backup.

3) Untar kernel, cd into the kernel directory. Issue:

make menuconfig

4) Configure kernel. If you used my config file, a lot of these should already be ticked.

a) Load alternative config file, I selected mine as /usr/src/config-, or if you downloaded the one from me, use config-

b) Enable generic x86 support

c) Enable Kernel .config support

d) Device drivers -> Network -> 10 or 100Mbit -> RDC R6040, set at built in

e) Turn off generic IDE support

f) Exit, make sure to save the kernel

g) Verify .config exists. If it doesn't, copy the config-2.6.x.x-vortex86dx file to .config

5) Create the kernel debs. In the kernel directory, issue these commands. This will build the kernel image, the headers, and the modules.

make-kpkg --initrd kernel_image kernel_source kernel_headers modules_image

6) Make coffee

7) Copy the debs to your running ebox by sftp (or usb, or whatever is available)

8) Install kernel in eBox-3300

dpkg -i linux-source-
dpkg -i linux-headers-
dpkg -i linux-image-

9) Reboot. If you want my compiled kernel/sources/header .DEBs, just shoot me an email and I'll make them available.

Summary: My only gripe about this little box was the lack of an easily customizable kernel, but no more. I'm still very happy with this $150 purchase.

Fixing locale errors in Ubuntu 8.04

Published on Sunday, May 3, 2009

I've hit this problem a few times, and figured I'd leave a note for myself how to fix it. Ubuntu 8.04 seems to hiccup sometimes (on a VPS) for generating the correct locales. In particular, I get this error, a lot:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

Normally I just do 'dpkg-reconfigure locales', but with 8.04, this doesn't seem to do squat. The solution is to edit the /var/lib/locales/supported.d/local file, and insert the correct locales (it will normally not exist, so create it):

# cat /var/lib/locales/supported.d/local
zh_TW.UTF-8 UTF-8
zh_TW BIG5
en_US.UTF-8 UTF-8
en_US ISO-8859-1
en_US.ISO-8859-15 ISO-8859-15

You can then do a 'dpkg-reconfigure locales' and they will be generated correctly. For a list of supported locales, try this:

cat /usr/share/i18n/SUPPORTED | grep US

Fixing mysql warning message

Published on

After restoring databases from one server to another I sometimes get this error on Ubuntu or Debian:

error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'

This makes a lot of sense, and the solution is pretty simple. If you look in:

cat /etc/mysql/debian.cnf

You'll see the defaults for your system. Copy the password listed there, and open a connection to MySQL as root (or some other user). Next, enter this (lets say your password specified in debian.cnf was 'abracadabra':

mysql> select PASSWORD('abracadabra');
| PASSWORD('abracadabra')                   |
| *38794E19D534EBA4F0F78903FA00F1DA2989DCA2 | 
1 row in set (0.00 sec)

Next, since we already have the prompt open, do this command:

mysql> USE mysql;
mysql> UPDATE user SET password='*38794E19D534EBA4F0F78903FA00F1DA2989DCA2' where user='debian-sys-maint';
mysql> FLUSH privileges;

Restart MySQL, and the error should have gone away.

Operation Field

Published on Monday, April 13, 2009

Status: 10%

It is time for a new project. I've finally decided I want to do some electronics stuff - at least play around in that realm a little. However, I want to "get out and about" a little as well, so this leads me to my idea: a controllable long-range RC plane.

I've been debating whether to go the embedded Linux route, or the more simple microcontroller route. One of the first things I stumbled upon was ArduPilot, a cheap Arduino-based board allowing for a UAV. However, after looking through the requirements I would have needed to purchase an RF transmitter, and they aren't cheap. This made me rethink the ArduPilot route and to evaluate what I really wanted to do: control the plan. My ultimate goal is to attach a joystick to my computer and be able to control the RC plane. This presents another problem with the ArduPilot, however, as there isn't an extra Rx pin available on the ArduPilot board (or so the forums say), I wouldn't be able to transmit coordinates on the fly.

After much research, I think I've determined what I'm going to do. I'm ultimately going to adopt the best parts of the ArduPilot, and fill in the gaps with my own board. I'm going to take an EasyStar, combine it with an Arduino Mini, Xbee, XY Sensor, GPS module, servos, H-bridges and a custom PCB, and hope it works.

One thing I've learned from YS is to stage our the things I buy. For instance, instead of signing up for a year at a local gym, try a month first. This project won't be any different, and while most of the equipment is very reasonably priced, I still want to make sure I enjoy this type of thing. The first stage is going to be to buy the Arduino Mini, breadboard, servos and h-bridge (and a cheap DC motor), and see if I can get it all working. If I can, I'll buy the EasyStar and see if I can control it with a joystick. If still successful, I'll acquire the Xbees and GPS module - and these represent the majority of the cost.

Another element I've considered is how to visualize the RC plane flying around. I had contemplated looking into using Google Earth, but I'd really prefer to use a free variant. I also want to strengthen my Java knowledge, so have opted to use the SDK for WorldWind. I was very excited to see that they also have support for OSM, which is just spectaculous. I plan to have a HUD that on the right displays the plane's location in WorldWind, and on the left display current altitude, tilt and RF strength. Since I've been flying through a book on Processing, this looks like a perfect real-life opportunity to use it.

I'm likely to start putting my money where my mouth is in the next two weeks.

True Consolidation

Published on

Back in 2000 I managed to acquire several retired systems to bring to Uni: this included 4-5 cheap P120 machines. At the time, I thought this was great; I had an OpenBSD box as my gateway, a FreeBSD box, a few Linux boxes, and likely something else that doesn't even exist now. The school has a superfast connection, unlimited bandwidth, and I was curious. Although I didn't really have time, I still managed to install and have all these servers running from my room.

I realized I was doing at home what I was being paid to do at work.

Fast forward to 2007, and my mindset has changed. In 2007 I didn't want to have 6 servers running at once, I wanted to have one server running 12 servers at once! Thanks to Xen and VMware this was easily obtained. Initially using Xen, and then ESXi, I had the freedom to setup Domains, tear them down, and start over. Eventually, however, I realized I was doing at home what I was being paid to do at work. That doesn't sound like fun. I also realized that, despite picking a motherboard and processor that could shift into low power usage, I was still using more watts than I needed to. I was also spending way too much time mucking around with things - I want to focus on just one or two projects at a time, and I really want to start programming more.

Last month I finally finished the ultimate 'consolidation': I moved everything to a tiny embedded Linux box. While back in the U.S. I contacted WDL Systems and requested for shipping costs on a tiny embedded box. I bought the eBox-3300, with an embedded board from ICOP, and it was promptly shipped out. After returning home to Sydney I migrated all my apps from the various virtual servers to my little box running Debian 5.0: OSSEC, Samba, Lighttpd, Asterisk and flow-tools. The little box is just perfect for what I need - a tiny home server. I still get around 8MB/sec transferring files, which indicates the network is still the bottleneck, and VOIP calls with Asterisk are still clear.

Overall, I've been happy with this little box. My 'playing time' with IT has gone down significantly, my energy usage has gone down, and I now have a server I can take with me wherever I go.

Files between ESX and Linux via NFS

Published on Monday, March 2, 2009

I like ESX. I like Linux. It is absurdly easy to configure Linux as an NFS server and mount it in ESXIi).

Installed NFS

I currently use Ubuntu Server for my home lab, but the process is basically the same for Red Hat and derivatives.

sudo apt-get install nfs-common
sudo apt-get install nfs-kernel-server

Next, configure NFS so it can server your local LAN. Normally you would list only specific servers, but, well, we're being cheap and dirty today. Open /etc/exports in VI or your editor of choice.


Restart NFS.

sudo /etc/init.d/nfs-common

Go to Configuration -> Storage -> Add Storage.

Select NFS

Fill in the info, see screenshot.

Wait a minute. Voila! New datastore.

Images to come shortly.

Renaming Apache Log Locations

Published on Sunday, January 25, 2009

I realized a few of my log files were growing unusually large, and even worse, logrotate was skipping them. I took a look in logrotate.d and straight away realized why: I had created silly names for the log file. logrotate look for .log files, but I had specified mine as .log -- e.g. kelvinism_access_log. I was as familiar with logrotate when I set up the domains, so set forth to get them in the rotation.

Firstly, I had to rename the actual log files. So, to rename kelvinism_access_log to kelvinism_access.log, a one-liner:

for x in *_log; do mv $x `basename $x _log`.log; done;

Next, I needed to rename the log location inside each of the Apache config files. While a one-liner might be possible, I used the following tiny script:


for x in *
sed 's/\_log/\.log/' $x > /tmp/tmpfile.tmp
mv /tmp/tmpfile.tmp $x

Beginning Scripting ESXi

Published on Tuesday, January 6, 2009

I'm not impressed too often with much software, especially the closed source kind. I find a leaning preference to all things FOSS. If I had a million dollars, I'd likely spend all day contributing to all the projects I wish I had time to contribute to. Regardless, there are a select few closed-source products that I believe are truly excellent. I mean, the type of software where you aren't asking "I wish this could do this" and start asking "I wonder what else this can do."

While I've played around with most types of virtualization out there (OpenVZ, Xen, V-Server, qemu...), I've really found a soft spot for VMWare.

Don't get me wrong, if I was going to host a heap of Linux web servers I would absolutely use Xen, but for a heterogeneous environment, I haven't used anything as easy as VMWare's products. Not that I judge a product by how easy it is to use, not by a long shot, but ease of use sure makes judging other factors easier.

Regardless, this isn't a post trumpeting VMWare. I just realized tonight that some of the VMs I have running don't need to be except for certain hours of the day, or if condition A is true. The first example is my backup mail server; I really don't need it even powered on unless my main server is down. The second example is my Server 2003 instance, which has VI3 on it; I don't need this running unless I'm asleep. One of the most useful resources I've seen for the vmrun command is over at VirtualTopia -- loaded with examples.

Turn off via time

On my "monitoring" instance, which is always up, I've decided to install the script that controls my VM. I've opted to use a soft shutdown. = ESXi box

datastore1 = name of datastore that hosts VMs


vmrun -t esx -h -u root -p root_password stop "[datastore1] Server 2003 R2/Server 2003 R2.vmx" soft

I have that saved in a file called stop_2003.sh in /opt/vmware/bin; make sure it isn't world readable. I also have a start_2003.sh:


vmrun -t esx -h -u root -p root_password start "[datastore1] Server 2003 R2/Server 2003 R2.vmx"

Next, edit root's crontab (crontab -e):

# m h  dom mon dow   command
0 8 * * * /opt/vmware/bin/start_2003.sh
0 23 * * * /opt/vmware/bin/stop_2003.sh

The conditional task is a tad bit more tricky, but just a tad. Ping won't do, since the mailserver could go down itself, so install nmap. Create a script:


if nmap -p25 -PN -sT -oG - mail.kelvinism.com | grep 'Ports:.*/open/' >/dev/null ; then
echo `time` >> mailserver.log

And sticking with our theme, start_mail.sh:


vmrun -t esx -h -u root -p root_password start "[datastore1] Mail Server/Mail Server.vmx"

This of course changes the crontab entry to:

# m h  dom mon dow   command
0 8 * * * /opt/vmware/bin/start_2003.sh
0 23 * * * /opt/vmware/bin/stop_2003.sh
*/5 * * * * /opt/vmware/bin/detect_port.sh

So, that's it. detect_port.sh is lacking any type of error detection or redundancy - if one packet/scan is dropped, the mail server will turn on. I'll re-work this at some point, but it works for now.

Update: Vmware has also released a decent blog entry about using vmrun: on their blog.