<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ukstokes.com &#187; Desktop Linux</title>
	<atom:link href="http://ukstokes.com/blog/category/desktop-linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://ukstokes.com/blog</link>
	<description>tech stuff from a tech bloke</description>
	<lastBuildDate>Fri, 02 Jul 2010 22:58:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>D-Link DWA-131 and Ubuntu</title>
		<link>http://ukstokes.com/blog/2010/05/12/d-link-dwa-131-and-ubuntu/</link>
		<comments>http://ukstokes.com/blog/2010/05/12/d-link-dwa-131-and-ubuntu/#comments</comments>
		<pubDate>Wed, 12 May 2010 21:50:46 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Desktop Linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=628</guid>
		<description><![CDATA[I recently bought this wireless-n USB adaptor for use with Ubuntu as I had read it was "Linux compatible", or at least as compatible as a wireless card can be with Linux. It proved tricky to get working, so this post may help others who are thinking of attempting the same thing. There are basically [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ukstokes.com/blog/wp-content/uploads/2010/05/nano-usb.jpg" rel="lightbox"><img class="alignleft size-full wp-image-668" title="D-Link DWA-131" src="http://ukstokes.com/blog/wp-content/uploads/2010/05/nano-usb.jpg" alt="" width="114" height="103" /></a>I recently bought this wireless-n USB adaptor for use with Ubuntu as I had read it was "Linux compatible", or at least as compatible as a wireless card can be with Linux. It proved tricky to get working, so this post may help others who are thinking of attempting the same thing.</p>
<p>There are basically 2 ways to make this usb dongle work, once you have overcome the first hurdle and discovered that this uses the Realtek 8192 chipset inside.</p>
<p><strong>The easy way</strong><br />
Easiest method is to use the Windows Realtek driver and a nifty program called ndiswrapper (or ndisgtk if you prefer to use a graphical interface). The drawback is this will only give you wireless-g capability, not wireless-n. Here's how (you can get the driver from <a href="http://members.driverguide.com/driver/detail.php?driverid=1689953&amp;action=filfo">here</a> if you don't have a driver disk):</p>
<pre class="brush: bash;">unzip UGL2430-U2H2_XP_Vista.zip
sudo ndiswrapper -i XP_Vista/88_91_92_SU_Driver/WinXP2K/net8192su.inf
sudo ndiswrapper -l
sudo ndiswrapper -m
sudo modprobe ndiswrapper
iwconfig</pre>
<p>Then you can manage your newly created "wlan0" or "wlan1" device using Network manager, or you can configure it manually if you like.</p>
<p><strong>The hard way (recommended)</strong><br />
To get the full wireless-n potential from this usb dongle you have to compile the Realtek driver from source. The drawback to this process is it is complicated, several prerequisite steps are required.</p>
<p>Download the driver files from here: <a href="http://www.opendrivers.com/modeldriver/RealTek_Network_RTL8191SU-driver-download.html">RealTek_Network_RTL8191SU-driver-download</a> and save it to ~/realtek</p>
<p>Assuming that your kernel version is 2.6.32 (check using uname -r) get the kernel source:</p>
<pre class="brush: bash;">sudo apt-get install build-essential linux-source-2.6.32 linux-headers-generic
cd /usr/src
sudo tar -xvjf linux-source-2.6.32.tar.bz2
sudo ln -s /usr/src/linux-source-2.6.32 /usr/src/linux</pre>
<p>If this was all fine, go back and unzip the driver file:</p>
<pre class="brush: bash;">cd ~/realtek
unzip rtl8191SU_usb_linux_v2.6.0006.20100226.zip
cd rtl8191SU_usb_linux_v2.6.0006.20100226/driver
tar fzxv rtl8712_8188_8191_8192SU_usb_linux_v2.6.0006.20100226.tar.gz
cd rtl8712_8188_8191_8192SU_usb_linux_v2.6.0006.20100226/</pre>
<p>Now for the crazy part. You now have to hack the source code of the driver to stop it from throwing build errors. Follow the instructions <a href="http://samiux.blogspot.com/2010/05/howto-realtek-8192su-usb-dongle.html">in this blog post first</a>, and then it will build successfully. Do the 'make' and 'make install' <strong>as root</strong> (sudo su -)</p>
<pre class="brush: bash;">make
make install
depmod -a
modprobe 8712u
iwconfig</pre>
<p>Now you should have full wireless-n networking on this device, iwconfig will show "IEEE 802.11bgn" if it was installed correctly.</p>
]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2010/05/12/d-link-dwa-131-and-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The thin client project</title>
		<link>http://ukstokes.com/blog/2009/09/12/the-thin-client-project/</link>
		<comments>http://ukstokes.com/blog/2009/09/12/the-thin-client-project/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 20:59:00 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Desktop Linux]]></category>
		<category><![CDATA[Citrix]]></category>
		<category><![CDATA[thin client]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=463</guid>
		<description><![CDATA[On our small remote sites we use HP thin clients to connect to applications using Citrix. The thin clients are Linux based, with 1Gb of flash memory for storage and running an HP customised version of Debian. The distro is basically a cut down Gnome desktop with Iceweasel (Firefox), and some HP branding and tools [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ukstokes.com/blog/wp-content/uploads/2009/08/100px-NewTux.svg.png" rel="lightbox"><img class="size-full wp-image-484 alignleft" title="Tux" src="http://ukstokes.com/blog/wp-content/uploads/2009/08/100px-NewTux.svg.png" alt="Tux" width="100" height="120" /></a>On our small remote sites we use HP thin clients to connect to applications using Citrix. The thin clients are Linux based, with 1Gb of flash memory for storage and running an HP customised version of Debian. The distro is basically a cut down Gnome desktop with Iceweasel (Firefox), and some HP branding and tools for backing up and restoring the client and for connecting to HP printers.</p>
<p>We've recently had some downtime with ADSL connections in these sites and wanted a contingency for network problems. We came up with the idea of 3G USB dongles and had bought a Vodafone one, but after testing it, the conclusion was this would not work without a lot of hacking about with the packages available in the HP Distro. However, after some testing in <a href="http://www.ubuntu.com">Ubuntu</a> we found it worked perfectly with the most recent version of Network Manager. With Network Manager you can basically just insert the key and after a minute right-click the tray icon, select 'Vodefone 3G' and you're off (yes, incredibly it really is that good). So ... the challenge was to reconfigure our thin clients, so that:</p>
<p>- It used Ubuntu and Network Manager<br />
- It could be easily deployed by a user from booting a USB stick<br />
- Had a system to allow IT to make changes to the image and re-image the USB stick<br />
- The USB sticks should be easily cloned to distribute to all remote offices.</p>
<p>I can't resist a good challenge, expecially when it involves tinkering with Linux.</p>
<p><strong>1. Installing a lean and mean Ubuntu machine</strong><br />
This step was a challenge in in itself - Ubuntu Jaunty would not boot into a live session on this computer, (kernel modules were failing to load right at the start) and doing a basic text based install (with no GUI elements) pretty much filled the entire drive, give or take a few Mb!</p>
<p>I had partitioned the disk with no swap partition, 100Mb for home and 70Mb for boot. I set off by removing unwanted locales from the system using 'locale purge':</p>
<pre class="brush: bash;">sudo apt-get install localepurge
sudo apt-get clean</pre>
<p>I decided I would go for <a href="http://www.xfce.org/about/screenshots">XFCE</a> for the Window manager, since it was impossible to install a Gnome desktop without hundreds of megs of bloat. All I really need is a desktop with a web browser so installing a Gnome desktop seems like overkill.</p>
<pre class="brush: bash;">sudo apt-get install xfce4</pre>
<p>This automatically pulls in all of the dependancies, like the X-Window system. Next to start reclaiming used disk space. To find out which directories were using the most space I used du:</p>
<pre class="brush: bash;">sudo du / -h --max-depth=1 | grep M</pre>
<p>The main culprets were /usr/share and /lib. Deleting items from /lib is not advisable, removing the dependant packages and then using an 'apt-get autoremove' will tidy them up the clean way. I prefer to use Synaptic to do this rather than apt-get, some things are just better and faster using a GUI.</p>
<pre class="brush: bash;">sudo apt-get install synaptic
xfce4-session</pre>
<p>From within XFCE, I launched Synaptic and removed everything that was unnecessary. Afterwards went back into /usr/share and used du to locate the large DIR's again. I removed gimp files and unnecessary locales:</p>
<pre class="brush: bash;">cd /usr/share
sudo rm -rf gimp
sudo mv locale/en .
sudo mv locale/en_GB .
sudo rm -rf locale/*
sudo mv en locale
sudo mv en_GB locale</pre>
<p>Removed unnecessary docs, myspell and redundant openoffice.org components. Have no idea why these were even installed in the first place since the openoffice suite was not installed ... totally unnecessary bloat!</p>
<pre class="brush: bash;">sudo apt-get remove myspell-en myspell-en-gb
sudo rm /var/lib/dpkg/info/openoffice* -f
sudo dpkg -r --force-remove-reinstreq openoffice.org-hyphenation-en-us
sudo dpkg --purge openoffice.org-hypnenation-en-us
sudo tar fzvc /home/docs.tgz doc --remove-files</pre>
<p>I deleted /home/docs.tgz after a reboot, since nothing stopped working. <img src='http://ukstokes.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Next got rid of unwanted XFCE themes:</p>
<pre class="brush: bash;">cd /usr/share/themes
sudo mkdir ../themes_OLD
sudo mv * ../themes_OLD/
sudo mv themes_OLD/Def* .
sudo mv themes_OLD/Xfce* .
sudo rm -rf themes_OLD</pre>
<p>Installed Firefox, usplash (pretty startup screen) and the all-important Network Manager:</p>
<pre class="brush: bash;">sudo apt-get install firefox usplash network-manager</pre>
<p>To get the Network Manager tray icon in XFCE, you just have to configure 'nm-applet' to start when XFCE is started. Tested Network Manager using the Vodafone 3G dongle and success, it worked first time! Citrix sessions actually run quite well over 3G too.</p>
<p>Once last package cleanup, for good measure:</p>
<pre class="brush: bash;">sudo apt-get remove synaptic
sudo apt-get autoremove
sudo apt-get clean</pre>
<p>This left me around 30Mb free on /, which is pretty much what I had started with on the HP/Debian distro.</p>
<p>Last few bits were configuring the user to auto login, installing printers using CUPS, installing the Citrix client (this goes into the users /home directory), setting desktop background, and a few other customisations, like configuring Firefox to automatically purge data when closed ... that 100Mb home partition would fill up pretty quickly otherwise.</p>
<p>The autologon to XFCE without a login manager was a bit tricky since Ubuntu uses Upstart to manage the startup sequence rather than the traditional Linux sysinit, since this is a bit unfamiliar to me I had to follow some guides on the <a href="http://ubuntuforums.org">Ubuntu forums</a> to get it working. The community support is excellent though, which is one other reason we chose it in the move away from the HP thin client distro. There always seems to be someone before you who has already had the same problem!</p>
<p><strong>2. User friendly imaging from a bootable USB stick</strong><br />
My weapon of choice for this initially was the Linux tool 'dd', which does block level duplication of partitions or sections of a disk quite easily. For example to clone the second partition on disk 'hda' to a file, you could use:</p>
<pre class="brush: bash;">dd if=/dev/hda2 of=/myimages/thin_client_hda2.img</pre>
<p>dd can also be piped into tar or zip to compress the output. One drawback is dd does also duplicate white space into the output file, so it's not the most efficient tool for the job. My tests with dd were not very successful, creating the image was fine, but writing the image back to disk always failed complaining it had run out of disk space.</p>
<p>I dumped dd and started looking into <a href="http://clonezilla.org/">CloneZilla</a>. It's an open source partition and disk imaging tool that boots from CD or USB and can dump a disk image locally, or to an NFS or Samba share. It is comparible to norton ghost in features but not quite as friendly in the GUI department, since the menus are all text based and keyboard controlled. Clonezilla can dump an image to usb attached or to windows or NFS shares and can even be set up as a PXE server to multicast images across a network and image multiple machines at once, but it's most common form is imaging a single machine in live mode. To dump a disk image locally I has to split my usb stick into 2 partitions : 500Mb for Clonezilla (formatted in fat32) and 1.5Gb for the partition images (formatted in ext3). This was necessary as you can't write images to the filesystem clonezilla has booted from.</p>
<p>I used <a href="http://unetbootin.sourceforge.net/">unetbootin</a> (awesome utility) to write the Clonezilla iso to the usb stick and make it bootable. You may notice unetbootin already contains a Clonezilla option, I did try using this but the stick that was created was somehow missing important files from /etc/ocs, so I'd advise downloading the latest iso from clonezilla first, and then just using unetbootin wo write the iso file.</p>
<p style="text-align: center;"><a href="http://ukstokes.com/blog/wp-content/uploads/2009/09/unetbootin.PNG" rel="lightbox"><img class="size-medium wp-image-513 aligncenter" title="unetbootin" src="http://ukstokes.com/blog/wp-content/uploads/2009/09/unetbootin-300x220.PNG" alt="unetbootin" width="300" height="220" /><em><br />
Unetbootin</em></a></p>
<p>Next boot from the stick but instead of going into an interactive session, choose the command line mode. Grant yourself root access by using:</p>
<pre class="brush: bash;">sudo su -</pre>
<p>Edit the syslinux.cfg file to customise the boot menu.</p>
<pre class="brush: bash;">vi /live/image/syslinux.cfg</pre>
<p>If you've ever created a Linux PXE server you'll recognise the layout of this file. By editing this and passing different options to the kernel at boot, you can launch custom clonezilla scripts without user interaction. My syslinux.cfg looked like this ... the top menu item becomes the default, so this configuration will automatically restore the thin client from the usb stick if there is no interaction for 10 seconds - perfect for sending to users on remote sites.</p>
<pre class="brush: bash;">default vesamenu.c32
prompt 0
menu title UNetbootin
timeout 100

label restore
menu label Restore image from USB stick
kernel /ubnkern
append initrd=ubninit boot=live union=aufs vga=788 ip=frommedia ocs_live_run=&quot;/live/image/pkg/custom-ocs-restore&quot; ocs_live_extra_param=&quot;&quot; ocs_live_keymap=&quot;NONE&quot; ocs_live_batch=&quot;yes&quot; ocs_lang=&quot;en_us.UTF8&quot;

label backup
menu label Backup image to USB stick
kernel /ubnkern
append initrd=ubninit boot=live union=aufs vga=788 ip=frommedia ocs_live_run=&quot;/live/image/pkg/custom-ocs-backup&quot; ocs_live_extra_param=&quot;&quot; ocs_live_keymap=&quot;NONE&quot; ocs_live_batch=&quot;yes&quot; ocs_lang=&quot;en_us.UTF8&quot;

label unetbootindefault
menu label CloneZilla Live Session
kernel /ubnkern
append initrd=/ubninit boot=live union=aufs    nolocales ocs_live_run=&quot;ocs-live-general&quot; ocs_live_extra_param=&quot;&quot; ocs_live_keymap=&quot;&quot; ocs_live_batch=&quot;no&quot; ocs_lang=&quot;&quot; vga=791 ip=frommedia</pre>
<p>The <strong>ocs_live_run </strong>parameter in each stanza points to the custom script you want to run. These scripts have to exist in /live/image/pkg and be marked as executable. They can be called anything you like. Some examples already exist on the live cd, can't remember the exact location but I found them using:</p>
<pre class="brush: bash;">find / -name &quot;custom-ocs*&quot;</pre>
<p>My backup and restore scripts looked like this:</p>
<p><strong>/live/image/pkg/custom-ocs-backup</strong></p>
<pre class="brush: bash;">#!/bin/bash

DRBL_SCRIPT_PATH=&quot;${DRBL_SCRIPT_PATH:-/opt/drbl/}&quot;

. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
. $DRBL_SCRIPT_PATH/conf/drbl-ocs.conf
. $DRBL_SCRIPT_PATH/sbin/ocs-functions

if [ -e /etc/ocs/ocs-live.conf ]; then   . /etc/ocs/ocs-live.conf; fi
ask_and_load_lang_set en_US.UTF-8

mkdir -p /home/partimag
mount /dev/sda2 /home/partimag

/opt/drbl/sbin/ocs-sr -q2 -c -j2 -z1 -i 2000 -p true savedisk &quot;maverick-img&quot; &quot;hda&quot;</pre>
<p><strong>/live/image/pkg/custom-ocs-restore</strong></p>
<pre class="brush: bash;">#!/bin/bash

DRBL_SCRIPT_PATH=&quot;${DRBL_SCRIPT_PATH:-/opt/drbl/}&quot;

. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
. $DRBL_SCRIPT_PATH/conf/drbl-ocs.conf
. $DRBL_SCRIPT_PATH/sbin/ocs-functions

if [ -e /etc/ocs/ocs-live.conf ]; then   . /etc/ocs/ocs-live.conf; fi
ask_and_load_lang_set en_US.UTF-8

mkdir -p /home/partimag
mount /dev/sda2 /home/partimag

/opt/drbl/sbin/ocs-sr -g auto -c -p true restoredisk &quot;maverick-img&quot; &quot;hda&quot;</pre>
<p>I got stuck in a few places, the project maintainer (Steven Shiau) helped me out on the <a href="http://sourceforge.net/forum/forum.php?forum_id=663168">clonezilla forums</a> (thanks Steven).</p>
<p><strong>3. Cloning the USB stick</strong></p>
<p>Gah ... well I've got this working using dd ... but I need a Windows tool that can do this since the IT Service Desk are all on Windows machines! Provided the partitions on the USB stick are the correct size, one can use:</p>
<pre class="brush: bash;">dd if=/dev/sda1 of=/dev/sdb1 conv=notrunc
dd if=/dev/sda2 of=/dev/sdb2 conv=notrunc</pre>
<p>What Windows tool can I use to do this ... don't really have the time to spend but I am thinking a 3rd option in the Clonezilla boot menu for duplicating the stick. Perhaps a 2nd part in the future to this already too long blog post!</p>
]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2009/09/12/the-thin-client-project/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Adventures in wine</title>
		<link>http://ukstokes.com/blog/2009/01/13/adventures-in-wine/</link>
		<comments>http://ukstokes.com/blog/2009/01/13/adventures-in-wine/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 22:24:29 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[Desktop Linux]]></category>

		<guid isPermaLink="false">http://ukstokes.com/blog/?p=117</guid>
		<description><![CDATA[I've been working a lot with Wine at the moment. No, that doesn't mean I've been getting sloshed at my desk at work. Actually for the last month or so I have been running Linux on my laptop - not dual booting - I've been using Linux as my sole operating system. Since time at [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-118" title="Wine (Is not an emulator)" src="http://ukstokes.com/blog/wp-content/uploads/2009/01/images.jpeg" alt="" width="77" height="124" />I've been working a lot with Wine at the moment. No, that doesn't mean I've been getting sloshed at my desk at work. Actually for the last month or so I have been running Linux on my laptop - not dual booting - I've been using Linux as my sole operating system. Since time at work is divided 50/50 between Windows and Linux administration, I wondered it if might be helpful to administer Linux, from Linux, and I also wanted to use it as an opportunity to learn more about the inner workings of the OS. Since we use Red Hat only at work I've gone for CentOS 5.2 (for those that don't know, it's a very close clone of Red Hat) as my distro of choice.</p>
<p>I do still need to run Windows software though. I tried just using Citrix for my WIndows apps at first, but it became annoying after a while for various reasons - mainly copy and paste not working, and not being able to browse my own filesystem from the Citrix server, for say adding an attachment to a message.</p>
<p>Instead I am running Windows apps in Linux by using Wine (which stands for Wine Is Not an Emulator). It's an open source implemtation of the Windows API that can run on Linux, Unix and Mac systems.</p>
<p>There are really 2 things that I want to mention in this post, and the first is winetricks. Presuming you have first installed Wine, using:</p>
<p>[lang="bash"]yum install wine[/lang]</p>
<p>Winetricks can can just be downloaded and run like this:</p>
<p>[lang="bash"]wget http://www.kegel.com/wine/winetricks<br />
chmod 755 ./winetricks<br />
./winetricks[/lang]</p>
<p>This presents you with a GTK menu where you can select the Windows apps you want installed. Winetricks then fetches the download and installs in your 'fake windows' for you. I found this especially handy for .NET Framework 2.0 and Windows Installer 2.0, which I wanted for the VMware Virtual Infrastructure Client. The VI Client then installed using Wine, but incidentally still would not run. Nonetheless winetricks is the best Wine helper-app I've seen so far.</p>
<p><center><a href="http://ukstokes.com/images/winetricks.png" rel="lightbox"><img class="alignnone" title="Winetricks" src="http://ukstokes.com/images/winetricks.png" alt="" width="298" height="222" /></a><br />
<em>winetricks</em></center><br />
I can't say that I'm completely happy still, I've given up on Outlook 2007 as it was too buggy and am now using Office 2003, it is still a bit ropey in places (my preview window quite often breaks) but I guess I can work around the problems as they are not showstoppers. I've tried using Evolution as an open source alternative to Outlook, but being a guy why has used Outlook every day for many years, it seemed inferior in almost every way, and of course the integration with Exchange is never going to be as good as Microsoft's own Exchange client.</p>
<p>By the way if you're going to use Crossover Linux, I would use it exclusively for managing your Windows apps, rather than using Crossover, winetricks, and installing your own stuff just by running <em>wine setup.exe</em>. I found mixing and matching caused Office to become even more buggy than usual.</p>
<p>The second thing I wanted to mention is <a href="http://www.codeweavers.com/products/cxlinux/" target="_blank">Codeweavers Crossover Linux</a>. Wine is actually not difficult to use, but the general consensus on the Internet is it's not possible to get Outlook 2003/2007 working on Linux using Wine. This is where Crossover Linux steps in and makes it possible, and also makes it very easy to do so using a nice graphical interface. Crossover Linux is not free (usually it's $44), but I was lucky to get in there a few months back when they were giving it away free for a day.</p>
]]></content:encoded>
			<wfw:commentRss>http://ukstokes.com/blog/2009/01/13/adventures-in-wine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
