Rest easy Steve Jobs

For those that know me, I have never been an Apple or Microsoft fan and have always slanted towards Linux, GPL and the Free Software foundation.

All that aside, I will still stand back and pay homage to a great showman and visionary that was Steve Jobs!

I have never owned an iMac, iPod, IPhone or iPad – and possibly never will – Steve Jobs has, without a doubt – shaped our technological world.

Microsoft came up with one of the first ever hand held devices – but it was a failure. Steve Jobs did it with style and introduced them to the world!

They became status symbols and also a part of every day life… Google and Microsoft were then able to launch their versions on a piggy-back ride.

Not only that, but Steve Jobs had also shaped Pixar (Disney/Pixar), they produced the 1st ever fully CGI animated feature length film – ‘Toy Story’ and continued to produce many many more with competition from DreamWorks then Sony and many others.

Steve Jobs – Visionary and an Evolutionary Genius - You will be missed!

RIP from all us fellow geeks!

Logitech MK710 Wireless Desktop Keyboard and Mouse

I have always been a fan of Logitech and when I found out that Logitech Australia has a Fan Page on Facebook, I had to instantly become one of their fans.

Our Logitech Family

I then applied to become a Logitech Product Tester (LPT10272) and after being unsuccessful for a few rounds of testing, I was eventually accepted and promptly received the Logitech MK710 to test.

While wanting to do thorough in depth testing as to give an impartial and unbiased review (yes I am already a fan), certain things happened that caused a delay (possibly to the dismay of Logitech Australia and their fans).

I will not go into too much detail about what happened… but to be brief, our Home network RAID failed (we got a replacement Hardware RAID card from the good people at Adaptec) and then my mum (who lives in the UK) fell seriously ill.

This was an unfortunate sequence of events and was no way jinxed by our friends at Logitech Australia – so… on to the review (sorry I could not add a YouTube Review to accompany this post)!

Unboxing and Installation

Opening the box, everything was well packaged and secure with no annoying polystyrene; being mainly cardboard means that the box is easily recyclable.

You are then presented with the MK700 Keyboard, M705 Mouse, a tiny Logitech Unifying USB receiver, A USB extender cable, Duracell Batteries, SetPoint Software (for Windows XP/Vista and 7) on CD and the instruction booklet in various languages.

I was impressed that they included the USB extender cable and although we have no need for it, it could come in very handy for people that have difficulty plugging in such a tiny device into their USB port due to sightedness or dexterity problems.

After unpacking, we simply plugged the Unifying Receiver into a spare USB port and the devices worked instantly (on both Windows XP and Ubuntu Linux) although not all extra buttons on the devices will work until the software has been installed as to configure them – but more on that further down.

 M705 Mouse

What an impressive bit of kit! This is the most advanced pointing device we have ever used (3 button and a scroll wheel is all we have ever needed until now).

The features of this device are amazing and further enhanced once you make use of the SetPoint software (again – further info below).

To start with, the contour and design is comfortable to use although our 4 year old daughter finds it a little cumbersome – bearing in mind that this has been designed for business usage and the semi-pro gamer – tiny (as in child) hands will find its design a little bit ergonomically restrictive.

If you are left handed (which none of our family are), you will find this design uncomfortable – but you can not please all of the people all of the time (a lot of other Logitech Mice have symmetrical designs that will feel comfortable in either the left or right hand – we also own a few Logitech cordless optical mice with such a design).

The accuracy of the MK705 mouse has been further enhanced by replacing the optical sensor with a Class 1 Laser and although non lethal, it should be noted (according to instructions) that you should not attempt to magnify its intensity with the use of glasses, microscopes and other lenses… please keep this device for its intended use.

The Performance Laser however, gives you the freedom in using the device on most surfaces (your leg, clothing, settee) but I did not test on glass – so if it has dark field capabilities – I do not know – but would think glass is not intended for this device to be used on.

You can go further than just using standard left, right and centre click buttons as another 3 have been included which will require the installation of the SetPoint software for full usage.

Back and Forward buttons allow you to flip between web pages and an Application Switch button acts like ALT+TAB on steroids!

On to the centre scroll wheel/button – you would think that there would be nothing new with a design that has been used in mice since 1993 but the M705 has literally re-invented the wheel!

Not only can you scroll up and down and centre click in the usual manor but also scroll left and right – 4 axis of movement feels natural, it simply works for you as opposed to you working with it – but thats not all…

The MicroGear precision scroll wheel has a nice weighted feel which acts like a fly-wheel and for good reason – just flick the scroll toggle and the wheels behaviour can be changed from click-to-click precision scrolling to hyper fast ‘free wheeling’ scrolling.

Finally we get around to mentioning they have included an ‘on/off’ switch and an ‘LED’ battery level indicator (you can also check the battery levels using the SetPoint software). When you switch the mouse on, the LED will glow green for 10 seconds to tell you the batteries are good but will flash red if the level is below 10%.

As the mouse is low powered (Mouse and Keyboard both have auto sleep modes to extend battery life), the batteries can last for up to 3 years – so why include an on/off switch? Well, opening the battery compartment provides a clue – there is a space to store the USB Unifying receiver which means that if you are a gamer who attends the occasional LAN party or an office worker who frequently changes work stations, you can simply take it with you!

MK700 Keyboard

If comfort and design is important for mice, then equally it is important for a keyboard - especially if you (like myself) use one for at least 8 hours a day and as such, the MK700 is nicely contoured with a cushioned palm rest which feels soft but also durable enough to withstand years of wear and tear.

The angle of your keyboard is also a very important thing to consider, some prefer to use them flat while others like to work with the keyboard at an angle so the MK700 actually comes with 4 legs, one pair provide an angle of 4 degrees and another pair provide an angle of 8 degrees. Although the legs look small, they appear to be made of a high strength plastic so as to not break or snap off.

The keys are low profile and concave (Logitech ‘Incurve’ keys) but also have enough travel which feels more natural than keyboards you find on laptops and other low profile keyboards on the market and are also closely spaced which will reduce the junk and dust gathering inside (the MK700 also claims to be spill resistant and although it is something I will not purposefully test, Logitech claims it has been tested with a 60ml spill under limited conditions).

The mechanism behind each key feels solidly responsive on every stroke with no wobble side to side (some keyboards do tend to feel like the keys are balancing on springs) and also they have included the bumps on the F and J keys in the home row to assist with touch typing which (often too discreet or omitted from other keyboards) have been slightly exaggerated which will possibly also benefit visually impaired users.

The standard US-104 key layout includes the numeric keypad, cursor and function keys spaced apart in the usual way and not compacted to fit on a smaller computer desk makes it perfect for an office environment.

I have a personal pet hate for two keys that are standard on every keyboard – the Caps Lock and the Windows key will likely always be included by manufacturers and I eventually would like to see a keyboard with no Caps Lock and the Windows logo being changed to something more suitable (like a house to indicate ‘home’ or similar) for people that use Mac or Linux.

Keys, keys and more keys – placed neatly between the right ALT and CTRL keys sits a FN key which enhances the standard Function keys – simply hold FN and press a F-key to launch applications, zoom, display menu’s and even put your computer in sleep mode but again this requires SetPoint to be installed.

Eject key – wow, they have gone all out – eject your CD-ROM/DVD/BluRay from your keyboard – unfortunately you still have to bend down to remove the disc from the drive (also requires SetPoint)!

Calculator button – conveniently placed above the numeric keypad is a key to instantly open your calculator application which is a real time-saver when you want to do a quick calculation for your Tax refunds.

Across the top of the keyboard you will find Media keys located either side of a central LCD display that enables you to skip playback of media back and forward, pause and play as well as control volume (louder, quieter and mute) which can also be useful if you use your PC for presentation of media or as a HTPC.

The LCD display shows Battery, Caps Lock, FN, Scroll Lock, Num Lock and Mute status but it is not backlit possibly due to enhancing battery life. This sets the finishing touch to the overall look and looks great but is something I would hardly use unless checking the battery status.

As with the mouse, the keyboard comes with an on/off switch and although it also has a sleep mode when not in use – switching it off is handy for those occasions when you are moving from one workstation to another or going to a LAN party.

Unifying Receiver

It is important for me to include a little detail about this tiny device as it is a key component – if you buy another Logitech product that supports unifying, then it will use the same receiver - fantastic if you accidentally drop your mouse down the stairs or throw your keyboard out of the window or simply want to add a trackball or stand alone numeric pad to your desk.

I would like to see more devices with unifying support, such as graphics tabletspresenter devices and remote controls with IR and wireless capabilities.

As with anything that uses wireless technology, signals can easily be intercepted by a 3rd party which can mean that keystrokes could be read by someone outside. Unifying devices use a frequency of 2.4GHz for increased range and speed as well as industry standard 128bit AES encryption.

Range – we only tested indoors and ran out of room when we reached 16 meters distance but both keyboard and mouse still worked fine – this will benefit users with huge projector screens used in home entertainment or classroom presentation (or even selecting the next mp3 in your collection while outside at the BBQ).

SetPoint Software

Although the software is great, easy to install and allows for total customisation of all your buttons and keys, the only downside is that it is for Windows only. As I am not a Mac user, I was able to test on Ubuntu Linux and was glad that practically everything worked (including volume controls/mute, Power Off and calculator).

Conclusion

Although we own several Logitech keyboards and mice, we were very impressed by the professional feel of this keyboard and mouse combo.

The durability of this particular combo is definitely a win given it is being used not only by established geeks, but an ickle geekette who is continually providing challenges for mummy and daddy in rectifying the results of her exploration when using the computer.

Logitech have certainly managed to deliver on all priorities when it comes to purchasing gadgets with this particular Wireless Desktop Combo.

More than happy to give it a 8.5/10.

 

Using the WordPress database class within your own scripts

Every now and again you want to write a simple PHP script, either for use in real cron or maybe for your ajax requests that uses your existing WordPress tables without having to load or even partially load the WordPress core.

There are a multitude of ways to achieve this and one method I have used in the past requires the use of ezSQL which is in fact what the WordPress database class is based on.

ezSQL is a class that makes it ridiculously easy to use mySQL, Oracle8, SQLite (PHP), within your PHP script. Includes lots of examples making it very easy to understand how to work with databases. ezSQL has excellent debug functions making it lightning-fast to see what’s going on in your SQL code. ezSQL can dramatically decrease development time and in most cases will streamline your code and make things run faster.

Chances are that if you have WordPress installed, there is no reason you cannot make use of its wp-db.php and wpdb class without loading in a large portion of the WordPress core.

// If we want to be like WordPress, we must set a few things so edit these as required

// MySQL settings - copied from your wp-config.php
define('DB_NAME', 'db_name');    // The name of the database
define('DB_USER', 'db_user');     // Your MySQL username
define('DB_PASSWORD', 'db_passwd'); // ...and password
define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

$table_prefix  = 'wp_';   // Only numbers, letters, and underscores please!

// Set this to a particular blog ID if you use WordPressMU or MultiSite
$blog_id = false;

// ABSPATH is useful to use within our own code for the path to WordPress, do not forget the trailing slash!
define('ABSPATH', '/home/mysite/public_html/');

// WPINC is also useful to set
define('WPINC', 'wp-includes');

// Done editing - but feel free to make changes below

// Fix for WP3.0, it is safe to leave this in for other versions
function is_multisite() {
    if ($blog_id) {
        return true;
    } else {
        return false;
    }
}

// Stop the automatic creation of the $wpdb object
$wpdb = true;

// Here comes ezSQL - ahem - wpdb from WordPress
require_once(ABSPATH . WPINC . '/wp-db.php');

// Create a new wpdb object
$wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );

// Either comment this out or set to null if you are using a stand alone WordPress install
if ($blog_id) $wpdb->blogid = $blog_id;
// now we need to setup the table prefix so wpdb can reference tables
// i.e $wpdb->postmeta
$wpdb->set_prefix($table_prefix);

Now you can use the $wpdb object in your stand alone scripts. If I have missed anything out, please feel to leave me a comment.

Tips for Likewise Open on Linux

Likewise Open makes it very easy to authenticate users on a Linux machine using Windows Active Directory Domain Services and in today’s mixed Operating System environments it is possible to integrate assorted services across your network.

Once upon a time I was 100% Linux but got frustrated with the ever complicated setup of LDAP for authenticating a few users on my network. I now use Citrix XenServer to host a mixture of Windows and Linux virtual machines and found Windows Server 2008 Active Directory Domain Services to be a good replacement for other authentication services (as a Linux fanboy, that statement was hard to admit for some time).

Here follows a short list of useful tips for using Likewise Open:

  1. Windows DNS Server

    Make use of the Windows DNS Server by using its IP and domain within your /etc/resolv.conf or assigning it within your DHCP service.

    # /etc/resolv.conf
    # replace yourdomain.tld with your Active Directory domain
    # replace XXX.XXX.XXX.XXX with your Windows Servers IP address
    domain yourdomain.tld
    search yourdomain.tld
    nameserver XXX.XXX.XXX.XXX

    This makes it easier to use domainjoin-cli or domainjoin-gui to get your Linux machine connected to the Active Directory.

  2. Username Formatting and Location of Home Directories

    When logging into your Linux desktop, make sure you use the format YOURDOMAINusername but if you are logging into a shell, remember to escape the backslash with another backslash as YOURDOMAIN\username.
    Also Make note that not only uid/gid are different but also the location of home directories (/home/YOURDOMAIN/username or /home/local/YOURDOMAIN/username, although this can be changed).

  3. POSIX Friendly Groups


    Do feel the need to create a group for any users you add to the active directory, for example:
    I am user ‘martin’ and my Primary Group is ‘martin-group’.
    Doing this is more POSIX friendly and enables you to still have a very secure Linux system when your home directory is chmod rwxrwx--- and chown YOURDOMAIN\username:YOURDOMAIN\username-group.

  4. Do Things as root

    Missing sudo access?
    Make sure you are a member of ‘Domain Admins’ within the Active Directory and add the group to your /etc/sudoers file:

    # replace YOURDOMAIN with your Active Directory domain
    %YOURDOMAIN\domain^admins ALL=(ALL) ALL

    Notice that the backslash is escaped with a backslash, Domain Admins is lower-case and space has been replaced with a ‘^’.
    This could also be done by creating a ‘sudo’ group in the active directory, assigning users and adding %YOURDOMAIN\sudo ALL=(ALL) ALL.
    Referenced from ‘Ubuntu Forums – Re: Likewise-Open User with Sudo permissions?

  5. Avoid Local Password Errors

    Changing local passwords results in ‘Authentication token manipulation error’!
    I have only tested this in Ubuntu so far and found out that it should be fixed in Ubuntu Lucid (Bug #302026).
    For me (On Jaunty), the following fixed the issue:

    sudo apt-get install libpam-cracklib
  6. Use a Samba Server

    I did not get on too well with Windows NFS server or Windows File Sharing for Linux clients, a few days of messing about sent me running back to Linux for a solution.
    I decided to use CentOS for my file server and combine NFS and Samba for both Windows and Linux clients.
    Using this method allows Linux client machines to mount the home directory via NFS as normal (and already well documented) and other windows client users will automatically connect the share via Samba onto the specified device.
    For CentOS, I followed reply #3 in the ‘CentOS forums – Setting up a folder share using Likewise over an Active Directory Network‘ so that Samba played nicely with Active Directory and then I added the following to /etc/samba/smb.conf.

    # replace YOURDOMAIN with your Active Directory domain
    [Users]
    path = /home/local/YOURDOMAIN
    writeable = yes
    browseable = yes
    guest ok = yes
    create mask = 0660
    directory mask = 0770
    admin users = YOURDOMAINadministrator

    Then you can simply edit your users profile within Active Domain to automatically map Z: to use \CENTOSUsersusername whenever and wherever they log on and for Linux users, just use NFS (NOTE: YOURDOMAINAdministrator will still get access to all the home directories in the Samba share, but I am still unsure how to make this play nicely when you install software as a user with ‘Domain Admins’ privileges on a Windows machine when the install wants to use Z:WINDOWS).

If you have something to add or you feel I have missed some elegant tip out, please leave a your thoughts in the comment section below!

Compiling the Realtek RTL8111 driver on XenServer

I have been using Citrix XenServer for a short while now and it has become my virtual(is/iz)ation solution of choice.
Things were going great until I started to have problems after upgrading… It seems my onboard Realtek network interface (Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)) was not officially supported in XenServers HCL and became subjected to known driver problems.

RX packets:97840 errors:0 dropped:1203654335 overruns:0 frame:0

Although the network interface is still usable, as you can imagine – things are incredibly slow… especially if you rely on Remote Desktops/VNC/Terminal Services etc…
The solution was to use the Citrix XenServer Driver Development Kit (DDK) to compile the kernel module for the network interface card.

First we need to download the DDK VM, burn it to disk and then import it using XenCenter (this may seem an odd way of deploying a virtual machine – and although you could equally add the ISO to a CIFS or NFS ISO Storage Repository, It is always handy to have this ISO on a CD just in case).

Using XenCenter, you then need to import the DDK VM (Templates > Import Template… > Import type: Exported VM). When you browse the DDK CD, you need to select ‘XenServer Virtual Appliance Version 1 (ova.xml)’ and then you can set up a network interface, CPU(s) and memory for the Virtual Machine.

Once the DDK VM is up and running, you can use XenCenter to access its Console.

NOTE: Check the Realtek Drivers page for the latest version before proceeding.

wget ftp://WebUser:2mG8dBW@202.134.71.22/cn/nic/r8168-8.016.00.tar.bz2
tar vjxf r8168-8.016.00.tar.bz2
cd r8168-8.016.00
./autorun.sh

Using the autorun.sh script makes the compiling of the driver nice and easy but it does install the driver into the DDK VM root, so now we simply copy the driver for use in our XenServer installation.

NOTE: The following assumes that the kernel release is the same on both the XenServer and the DDK VM. Please replace ’192.168.1.1′ with your own XenServer IP address.

scp /lib/modules/$(uname -r)/kernel/drivers/net/r8168.ko 192.168.1.1:/lib/modules/$(uname -r)/kernel/drivers/net/

Next we can use XenCenter to access the XenServer Console and prepare the system to use the new driver.

cd /lib/modules/$(uname -r)/kernel/drivers/net/
mv r8169.ko r8169.ko.bak
insmod r8168.ko
depmod -a

Next we can edit /etc/modprobe.conf and change any reference of r8169 to r8168.

alias eth0 r8168

Everything is now ready to go, you need to reboot your XenServer for changes to take effect.

Installing Gentoo using Stacklet Xen3 images on to Citrix XenServer

There are many ways you can actually accomplish the installation of VM’s (DomU’s) on Xen and XenServer – from the extreme and complex howto’s to simply using pre-built images and templates.

This Howto is a mixture of both and has been written for the following reasons:

  • I found a great site called Stacklet that builds bootable images for virtualization software such as Xen.
  • I like using XenCenter for XenServer management (yes it is Windows only but OpenXenCenter is available for Linux although not 100% complete at the time of writing).
  • I used to use Gentoo a lot in the past when I ran my own small beowulf cluster and really wanted a Gentoo VM to play around with.
  • A completed Gentoo VM can be created from start to finish using XenCenter from a Windows computer on your network (anyone who knows me also knows I am not a Windows fan – but to keep things fairly simple, this is how I did it).

Notes:

  1. This Howto may or may not be right for you and I will take no responsibility for anything you do on your own servers. I would also like to state that this method could be done from within the XenServer using the CLI tools or programmatically using the XML-RPC based API (SDK’s available for C, C#, Java, PowerShell, and Python on the Citrix Community site).
  2. In this Howto we are creating a Paravirtualized Gentoo VM for XenServer using the image provided by Stacklet, there is no reason why this method will not work with any other Xen3 distro available from Stacklet.

Prerequisites

  • Centos XenServer installed with Linux Templates (available from the optional 2nd install CD for Linux Guest Support)
  • XenCenter on Windows somewhere on your network
  • A Linux VM running on the XenServer (I used Centos 5.3 which can be installed using the Linux Templates)
  • A XenServer Generic PV VM Template void of Virtual Disks which I provide – but you can create your own if you wish.

Create the Gentoo Virtual Machine

  1. XenCenter - Add New DiskSelect your running Linux VM and click the Storage tab. We want to create a new disk of a suitable size for our Gentoo to live so click  ‘Add’ and create a disk the size you require (I created an 8 GB disk of which 1GB will be swap). Give it a name and description so you always know what it is (I named mine ‘Gentoo 2010.0 i386′ and added the description ‘Gentoo root and swap’). Once you click ‘Add’, make a note of its device path (I already have several virtual disks so my path was /dev/xvdf).
  2. XenCenter VM ConsoleThe disk will now be instantly available within your Linux Virtual Machine and now you can enter the console by clicking the ‘Console’ (log in to your VM as root). To make sure the Virtual Disk has been detected, you can type cat /proc/partitions (notice that I have also mounted the xs-tools.iso within the Virtual DVD drive as we will need that shortly). We can now use our Linux VM and prepare our Virtual Disk for the Gentoo installation.
    # Type the following (or copy and paste) into your console
    # and replace [*] with your drive letter
    # Make sure we are in our home directory
    cd ~
    # Create partitions using fdisk
    # I created 7GB for / and 1GB for swap
    # use 'm' for help while in fdisk
    # to quit, use 'q' or to write changes and quit, use 'w'
    fdisk /dev/xvd[*]
    # create an ext3 filesystem for the Gentoo root
    mke2fs -j /dev/xvd[*]1
    # create a swap partition
    mkswap /dev/xvd[*]2
    # Make a directory and mount the ext3 partition
    mkdir /mnt/root
    mount /dev/xvd[*]1 /mnt/root

    Notes:

    • The above steps could be done using the Graphical Console if available within your XenCenter from your Linux VM, just install a GUI parition editor (gparted for gnome etc).
    • You do not need to partition in the way I have, as long as the 1st partition contains grub (for pygrub to work) then you can use whatever layout you like.
    • The CLI application ‘cfdisk’ did not like the Virtual disks – I am not sure if that was just the version I had installed or if it will be the same for every distro.
  3. Now we download the prebuilt Xen 3 Gentoo 2010.0 from Stacklet (I am using the 32bit version – but this should work with any of the Xen3 ready distros available on the site) and then we just copy it onto our newly created Virtual Disk.
    # Type the following (or copy and paste) into your console
    # Get and mount the Stacklet Gentoo image
    mkdir gentoo
    cd gentoo
    wget http://stacklet.com/sites/default/files/gentoo/gentoo.2010-0.x86.20091128.img.tar.bz2
    tar -xvjpf gentoo.2010-0.x86.20091128.img.tar.bz2
    mkdir /mnt/loop
    mount -o loop gentoo.2010-0.x86.img /mnt/loop/
    # Copy everything to the new disk
    rsync -avP /mnt/loop/* /mnt/root
  4. Our Gentoo root is now almost ready to be used, we just need to install the XenServer xe-guest-utilities and optionally change the default root password to something other than ‘password’. This step is optional at this time and can be done once the Virtual Machine has been booted (feel free to skip to the next step if you want to do this part later – especially if you are creating a template to distribute). If you are following this Howto to install a different Stacklet Distro, then skip to the next step.
    # Type the following (or copy and paste) into your console
    # create a place to mount the Virtual DVD drive
    mkdir /mnt/cdrom
    mount /dev/xvdd /mnt/cdrom
    # copy resolv.conf into our chroot
    cp /etc/resolv.conf /mnt/root/etc/
    # copy the RPM into our gentoo root
    # NOTE: there are 32bit and 64bit versions
    cp /mnt/cdrom/Linux/xe-guest-utilities-5.5.0-464.i386.rpm /mnt/root/
    # We can now chroot into our Gentoo root and install it
    chroot /mnt/root
    # a watched emerge never compiles
    # only joking - Gentoo humour - compile!
    emerge rpm2targz
    # convert the RPM into a tar.gz
    rpm2targz /xe-guest-utilities-5.5.0-464.i386.rpm
    # untar into Gentoo
    # NOTE: This will not run on boot but demonstrates it works
    # (although it does not correctly recognise the distro)
    # The init.d script needs editing (I have had no time to get that far)
    # for now, just manually run it when you start your Gentoo VM
    # (/etc/init.d/xe-linux-distribution start)
    tar -xvzf /xe-guest-utilities-5.5.0-464.i386.tar.gz
    # Set your new root password
    passwd
    # type in your new password (twice) and we are done
    exit

    Also during this stage, you could set your timezone, your hostname and domain name as done within the Gentoo Linux Quick Install Guide (code listing 2.17 and 2.18). It would also be a good idea to edit /etc/fstab and put in our swap partition.

  5. Deactivate Virtual DiskWe can now finish up in our console and unmount the Gentoo image ‘umount /mnt/loop‘ and Gentoo Virtual Disk ‘umount /mnt/root‘. The next step is to use our newly created Virtual Disk, but first we have to Deactivate and Detach it from our Linux VM by simply clicking ‘Deactivate’ and then ‘Detach’ from within our Linux Virtual Machines ‘Storage’ tab in XenCenter. Our Virtual Disk is now ready.
  6. XenServer Import TemplateFor this step we need to use a template and Attach our newly created Virtual Disk. I used the XenServer ‘Debian Etch 4.0′ template and then let it install without booting up, I then deleted its Virtual Disks and added  the new Gentoo one.
    To save you doing this step, I have created a XenServer Generic PV VM Template (3.4KB) that contains no Virtual Disks (DO NOT use the XenServer ‘Other Install Media’ template as it will not work for paravirtualized setups), simply unzip then install from within XenCenter – select ‘Templates’ from the top menu and ‘Import Template’ (Import Type is an Exported Template).
    Once you have Imported the template, you can create a new VM from it.
    Change the Name, Description, VCPU’s, Initial Memory and anything else you wish to alter – You do not need to add any Virtual Disks as you have one to use.
    On the last option, untick the ‘Start VM automatically‘ box as we do not want to start it yet – Then click ‘Finish’.
  7. XenServer Attach DiskWe can now select the VM and use its Storage tab to attach our Virtual Disk. Just boot up and use!
    Do not forget to edit your /etc/fstab and add the swap partition and any other adjustments you want to make that I have not mentioned in Part 4 of this howto.
    Once you have made your changes, you can make a template from your running Virtual Machine. Simply create a Snapshot by right clicking the Virtual Machine then select the VM’s ‘Snapshot’ tab. Right Clicking the snapshot will give you several options where you can create a VM from the snapshot, create a template from the snapshot and even export a template from the snapshot.

Conclusion

There we have it, a Paravirtualized Gentoo on XenServer using images from Stacklet. I would ultimately like to use my Gentoo VM to automatically create more images programatically, but that would depend on how much time I can spare towards the project. I would also like to create an ebuild of the xe-guest-utilities, but again – if I have the time I will.
This howto may look lengthy and complex… but the whole process is really simple… I hope this Howto helps someone.

New lease of life for our D-Link Wireless Router

Since upgrading our wireless network with our new Netgear RangeMax Next Wireless-N Router Gigabit Edition (see my post ‘Belkin Wireless Router is just rubbish‘ explaining our upgrading path), our humble D-Link DIR-300 Wireless G Router seemed to be doomed into a life of gathering dust along side many other bits and pieces that I may have a use for one day.

D-Link DIR-300 Wireless G RouterThen I stumbled upon a forum post that stated it is possible to flash new firmware onto the device which not only un-restricts the hardware, but also enables a host of other goodies into the D-Link Wireless Router.

I followed the link to DD-WRT.com and it became apparent that doing this will add new functionality into the D-Link Wireless Router – I was particually interested in using the Wireless Router in client mode.

DD-WRT is a Linux based alternative OpenSource firmware suitable for a great variety of WLAN routers and embedded systems. The main emphasis lies on providing the easiest possible handling while at the same time supporting a great number of functionalities within the framework of the respective hardware platform used.
Taken from the DD-WRT-  About page.

Following the DD-WRT install instructons for the DIR-300, I set upon the task of breathing new life into the Wireless Router.

Prerequisites

  1. Plenty of patience (taking your time will ultimately save you time in the long run)
  2. Ubuntu Desktop with *wine and putty installed (you can use any OS, but this is how I did it)
  3. All the required files as well as the instructions available on your desktop (NOTE: This is D-Link DIR-300 Consumer Stable DD-WRT.v24 SP1, please check for newer versions if available)

* I had some difficulty using tftpd-hpa and atftpd (although it appeared to work intermittently) so I used tftpsrv.exe which can be downloaded from the required files link above.

Basic Install Guide

The following closely mirrors the actual install process mentioned in the DD-WRT wiki.

I found this script to be very useful in accessing the router and it is almost exactly the same as the one found on the DIR-300 DD-WRT installation page, so use the editor of your choice to create a file called redboot.sh on your desktop and make it executable (chmod 770 ./redboot.sh).

#!/bin/bash
# requires putty (sudo apt-get install putty)
echo
echo ""
echo "Enter hostname or ip address: "
read host
while true
do
   if eval "ping -c 1 -s 1 $host" > /dev/null; then
  echo "Router Awake"
       putty telnet://$host 9000
       #-m redboot.txt
       break
   else
       echo "Waiting for Redboot to boot. Press CTRL + C to quit"
    sleep 1
   fi
done

Now plug your computer into the internet port on the router and configure Network Manager to use the static IP address of 192.168.20.80.

NOTE: Network manager is sometimes not fast enough coming back online when the router is powered off and back on, so you can either take your chances, assign an IP the old fashioned way by removing Network Manager and editing /etc/network/interfaces or use a switch/hub to connect between the devices (like I did).

Unzip tftpsrv.zip to your desktop and right click the resulting tftpsrv.exe file selecting Open With “Wine Windows Program Loader”, all the required files on your desktop will now be available via the TFTPd service.

Now run the redboot.sh script you created earlier and type in the IP address of 192.168.20.81 when asked, then unplug your routers power for 5 seconds – then plug it back in while holding the reset button for 5 seconds – if all goes well, putty will open after a short wait.

On the RedBoot within putty, you can now type the following commands:

load ap61.ram
go

If the load ap61.ram command takes a long time, then double check the TFTPd service is running (if you run a firewall on your computer, you can temporarily disable it).

If all went well after typing the go, putty will now seem to be doing nothing and your router will now be using a temporary boot loader, it is now safe to close putty.

Reconfigure your IP again, this time set it to 192.168.1.2 and unplug the network cable from the routers Internet port and into the LAN port.

Run the redboot.sh script once again and this time give it the IP address of 192.168.1.1 when prompted, putty should now appear once again.

The next part is a direct copy and paste from the DD-WRT wiki, please note that you MUST take care and be patient with all the following steps highlighted in bold.

IMPORTANT: while doing the following steps. never plug off the lan cable or the power cord!

fis init
About to initialize [format] FLASH image system - continue (y/n)? y
*** Initialize FLASH Image System
... Erase from 0xbffe0000-0xbfff0000: .
... Program from 0x807f0000-0x80800000 at 0xbffe0000: .
ip_address -h 192.168.1.2
IP: 192.168.1.1/255.255.255.0, Gateway: 0.0.0.0
Default server: 192.168.1.2
fis init
load -r -b %{FREEMEMLO} ap61.rom
Using default protocol (TFTP)
Raw file loaded 0x80080000-0x800a8717, assumed entry at 0x80080000
fis create -l 0x30000 -e 0xbfc00000 RedBoot
An image named 'RedBoot' exists - continue (y/n)? y
... Erase from 0xbfc00000-0xbfc30000: ...
... Program from 0x80080000-0x800a8718 at 0xbfc00000: ...
... Erase from 0xbffe0000-0xbfff0000: .
... Program from 0x807f0000-0x80800000 at 0xbffe0000: .
reset

If the above went well, your router should be restarting and will have a new permanent boot loader waiting for you to log into, so now close putty and run the redboot.sh script again using the IP address of 192.168.1.1 when prompted.

After another short wait, putty will be ready for the next step – installing the DD-WRT system image.

fis init
ip_address -h 192.168.1.2
load -r -b 0x80041000 linux.bin
fis create linux
fconfig boot_script true
fconfig boot_script_timeout 4

Now all that is left to do is make sure the linux image is always started at boot, so type fconfig and accept all the options until you get to the bootscript part.

fis load -l linux
exec

Once the configuration has been saved, you can type reset and close putty.

DD-WRT screenshotThe router will take a short while to boot back up and will be ready for you to log in via its web interface on 192.168.1.1 where you setup the username and password for administration.

You are then left with simple to use web administration pages to configure and customise to your hearts content with AP, Client, Client Bridge, Adhoc, WDS Station and WDS AP wireless modes supported.

So thats it – all done – well, it wasn’t quite finished for me, I wanted to put the router into client mode and followed another howto on the DD-WRT wiki.

I currently have one of my spare computers plugged into the newly configured D-Link DD-WRT client and wrote this entire post using it connected to our main wireless network. As the D-Link has 4 Lan ports (there is a setting to turn the Internet port into a 5th LAN port – but I have not tried it yet), this method is a great way to get network devices (network storage, HTPC devices and wired computers) onto the wireless network.

Belkin Wireless Router is just rubbish

For a while now we have been configuring our network to suit our needs – we have a wired segment for our main server and client PC’s and we have 2 small computers we use for all our multimedia – one is currently hooked up to our HDTV and the other is in the process of being converted to do the same.

D-Link DIR-300 Wireless G RouterWe have been using a D-Link DIR-300 Wireless G Router and it has been superb, it works great sharing our media content from our home server and watching DVD iso’s over wireless while sitting in front of our HDTV.

Problems started to occur when we realised that our new home was big enough to support two of these set ups… playing 2 DVD’s at once on a wireless G seems almost possible – if you ignore the odd frame skips and occasional jitter – then things are still perfect (we also use our media putes for regular Desktop log ins too and occasionally add an old wireless enabled laptop into the equation).

I have always prefered cables for all my PC’s, but a larger home and not wanting to lay them loose around the place (channeling cables into the walls was not an option either – although would be nice) and seeing how well we have utilised our Wireless G, an upgrade of our trusty D-Link Wireless Router was needed.

Belkin N1 Wireless Router So why did we choose Belkin? …well for one – while doing some impulse shopping, we saw the Belkin Wireless N1 Wireless Router and not only did it look nice, it also offered:

Intelligent MIMO (Multiple Input Multiple Output) spatial multiplexing techniques build upon the widely deployed 802.11g standard by greatly increasing speed, range, and faster speeds of up to 300Mbps*.

*NOTE: The standard transmission rate–300Mbps–is the physical data rate. Actual data throughput will be lower.

As with all Belkin products, they come with a Lifetime Warranty – even though opening our shiny new Belkin N1 MIMO Wireless Router and finding the wireless part didn’t actually work, we phoned customer support and were told to take it back to the store for a replacement .

We opened our second one and promptly set it up and connected 2 computers wirelessly with security disabled and although at this point I had not tested any speeds or media playback wirelessly, We saw the signal strengh was strong.

After enabling WPA/WPA2 security, we tried to connect our wireless computers once again and it soon became apparent after reading the computers log files and testing various wireless security levels that the Belkin N1 MIMO Wireless Router was refusing to issue a local IP address via DHCP.

Setting a local IP address manually on each of our wireless computers we were able to connect – it was now time to playback a DVD’iso to one of the wireless computers.

  1. Opened our shared media directory from our home wired server and waited.
  2. Made a coffee and then checked signal strength (the coffee and signal strength was strong).
  3. Our media directory eventually appeared, so I right clicked a DVD iso and selected ‘Open with VLC’ and waited.
  4. Checked signal strength, log files and finished my coffee.
  5. Eventually, we have media playback on one computer and playback seems to jitter and freeze.
  6. 10 minutes into watching the DVD iso, the whole lot froze.

Still not detered, we figured that maybe we have set something up wrong so back into the settings, I removed all security on the router and set it to use a fixed unused wireless channel rather than relying on auto channel selection (at least DHCP works again now).

We then repeated steps 1 to 6 above on one PC, then the other PC, then both and achieved the same results.

At this point, I decided to search Google for ‘Belkin Wireless Dropouts’ and discovered I was not alone and the blame for this was varied and dependent on who answered the questions.

  • No, the unit is not close to a microwave or a cordless phone
  • No, the unit has not been placed behind any walls (we were testing and setting up) – the unit is in direct line of sight between our PC’s
  • Yes, I have disabled all security, but I am refusing to drop the Wireless settings down to B then G because the box says it is a N1 MIMO wireless router (If I wanted G, then I would have got a second D-Link)

On the Whirlpool Forums, the question of ‘Are Belkin Routers Good?‘ was asked and  opinions are varied but it seems a lot of people are having problems. My personal favourites are:

I just purchased one to replace a DLink G604T and it seems fine – a breeze to set up for ADSL2+ and for wireless and security. But then anything that works must be better than what I had before.
posted by bboraj on 2008-Sep-1, 3pm AEST

Great, they got a Belkin Wireless Router and it works!

Hmm spoke too early on merits of Belkin – its been behaving badly and may be banished back to where it came. The wireless seems pretty unstable.
posted by bboraj on 2008-Sep-2, 7pm AEST

Oh dear, a day later and now they are not happy! So whats the best answer?

Just change the unit!! Two cans and a piece of string might be better!!! at least if string breaks you know where problem is!!
posted by grabman on 2008-Sep-2, 9pm AEST

NETGEAR RANGEMAX NEXT WIRELESS-N ROUTER GIGABIT EDITION WNR854TWe headed back to the store for the third time (this time without bothering with phoning Belkin customer support) and demanded a different brand. For a little more money, we chose the Netgear RangeMax Next Wireless-N Router Gigabit Edition.

Exactly the same specifications and promises that Belkin have written on their boxes (wireless speeds of up to 300Mbps and advanced MIMO technology), but for the extra $26 we got 4 x 1GB (BASE1000) Wired ports where the Belkin only supplied 4 x 100MB (BASE100) ports.

It took me minutes to plug it in and set it up to use WPA/WPA2 security and shortly after, we were playing our DVD iso’s across the network once more but now using the Wireless N speeds we upgraded to.

Conclusion

If I had never had wireless before and maybe if I did not know too much about computers, I most likely would have just accepted the Belkin Wireless Router as doing its job but being able to compare with an older D-Link Wireless G Router and an equivalent specification Netgear Wireless router seems to suggest that out of the 3, Belkin came last in the performance stakes.

I have always thought highly of Belkin Products but now will only ever buy cables branded by them – even if their wired technology is solid, their wireless is not and as such I will choose different brands for those purposes from now on.

As for our Netgear Wireless N Router, it is now happily set up in the center of our house and has no problems with the demands we put on it (we can also connect our wireless enabled mobile phone and laptop from half way down the street).

Apt-cacher proxy, Translation index files and apt-get update errors

After setting up apt-cacher on our home server and setting all our other computers to use it as a proxy caching service, we found that apt-get update and Update Manager always fails while fetching Translations.

Get:5 http://au.archive.ubuntu.com intrepid/main Translation-en_AU [2734B]
Ign http://mirror.files.bigpond.com intrepid/restricted Translation-en_AU
Err http://mirror.files.bigpond.com intrepid/universe Translation-en_AU
  Error reading from server - read (104 Connection reset by peer)

According to the debian-bugs-dist, Bug#517761:

apt-cacher: Translation-en_US.bz2 fails when LANG on client not equal to LANG on server

To avoid this problem, you can run apt-get update and pass the LANG variable to it:

sudo LANG=C apt-get update

As a single apt-cacher service can handle requests for multiple apt based distros, it seems odd that it will not cross the LANG barrier and so I had a go at seeing what could be done to stop apt updates from failing.

Not wanting to try and configure every computer to avoid this error, I decided to look on the server for the apt-cacher config file and the very last section looked interesting.

/etc/apt-cacher/apt-cacher.conf

# Permitted Index files - this is the perl regular expression which matches all
# index-type files (files that are uniquely identified by their full path and
# need to be checked for freshness). 
#The default is:
#index_files_regexp = (?:Index|Packages.gz|Packages.bz2|Release|Release.gpg|Sources.gz|Sources.bz2|Contents-.+.gz|pkglist.*.bz2|release|release..*|srclist.*.bz2|Translation-.+.bz2)$

By un-commenting and editing the last line, we can tell apt-cacher that Translation index files are not permitted:

index_files_regexp = (?:Index|Packages.gz|Packages.bz2|Release|Release.gpg|Sources.gz|Sources.bz2|Contents-.+.gz|pkglist.*.bz2|release|release..*|srclist.*.bz2)$

I am unsure of the implications that may arise by not permitting apt-cacher Translation index files, but so far apt-get update and update manager are no longer complaining.

Hello world!

Hello once more to people that know me… I can hear you shouting…

“Why do you have a new blog?”

My personal Blog has not been touched for a while and since the usage of Facebook, my friends and family never really visit it… but still, I will hang on to the domain name and use it for something new one day!

I now feel that my life is too diverse sticking assorted Blog posts online within just one Blog and as such, there should be Blogs for different aspects and interests of my life.

“So what is this blog about?”

This Blog is all about what I get up to with programming, web design and Open Source software – my Journal of goings on with my favorite pass time to help create myself a decent profile of computing accomplishments and achievements for potential employers to review.

I hope to include problems I have encountered in projects, as well as success by providing Howtos for people within the same situation.

I will be using a stock theme from our IND-Web.com and XYZ Internet services because I think it is only fair to promote our own services capabilities and as such, no modifications will be made to this prebuilt stock theme!

Only time will tell if I actually get visitors to this site so here goes…