• Home
  • About Me

ukstokes.com

tech stuff from a tech bloke

Feed
  • Connect Skydrive as a Windows mapped drive

    Jul 2nd 2010

    By: ben

    No comments

    Windows Live SkyDrive logoIt still remains to be seen how useful and popular Windows Live Skydrive will become, but if you happen to have an MSN account you automatically get 25Gb of free storage at your disposal, which in my case is enough to backup all of my important personal data - documents, photos, etc (the photos of which are the most valuable). There are several ways to connect Skydrive as a mapped drive ... some are better than others, but this is the best way I have found so far.

    Go and download SkyDrive Simple Viewer for WebDAV. Extract the files to your C: drive and run the command like so:

    dumpurls.exe <UserName> <Password>

    This should output a bunch of URL's representing the folders in your Skydrive.

    Open up My Computer, click on Map Network Drive. Copy and paste one of the URL's into the box and click OK. Enter your Windows Live credentials into the logon box when it appears, and hey presto, your 25Gb off-site storage box appears as a mapped drive in My Computer.

    Now you can back stuff up to it, manually or automatically (through home brewed scripts) and access your stuff from anywhere on the Internet. Just remember not to backup anything personal to the "Public" folder, as that is visible to everyone.

    Random stuff

  • D-Link DWA-131 and Ubuntu

    May 12th 2010

    By: ben

    No comments

    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 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.

    The easy way
    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 here if you don't have a driver disk):

    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

    Then you can manage your newly created "wlan0" or "wlan1" device using Network manager, or you can configure it manually if you like.

    The hard way (recommended)
    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.

    Download the driver files from here: RealTek_Network_RTL8191SU-driver-download and save it to ~/realtek

    Assuming that your kernel version is 2.6.32 (check using uname -r) get the kernel source:

    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

    If this was all fine, go back and unzip the driver file:

    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/

    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 in this blog post first, and then it will build successfully. Do the 'make' and 'make install' as root (sudo su -)

    make
    make install
    depmod -a
    modprobe 8712u
    iwconfig

    Now you should have full wireless-n networking on this device, iwconfig will show "IEEE 802.11bgn" if it was installed correctly.

    Desktop Linux

    networking, Ubuntu, wireless

  • Configure a non-enterprise Blackberry handset for Exchange

    May 11th 2010

    By: ben

    2 comments

    Some users in our organisation had purchased Blackberries from their favourite mobile phone retailers, with the expectation of them working with our Exchange email. Being retail BB's, they would not provisioned or licensed for our BES server, meaning we would not be able to remote wipe or do other useful stuff for them. Blackberry do allow connectivity to Exchange via OWA as per articles here, but some users were not able to get their work email configured because of the following error:

    Cannot connect to email server or invalid server name.
    Please verify the Outlook Web Access URL.
    If the error persists contact yourdomain.com (your email provider).

    The fields available for user input were:

    • Email address:
    • Password:
    • Web access URL
    • Username
    • Mailbox Name

    After some experimintation I discovered the working combination.

    1. Web Access URL had to include the /exchange at the end, e.g: https://your.owa.com/exchange
    2. Username had to be in the domain\username format
    3. Mailbox name had to be the first part of the email address, i.e everything before the @ sign.

    It was the mailbox name that took some guesswork. In a lot of organisations the 'mailbox name' would be the same as the username, but in our organisation we use a 6 digit number for usernames so the usual guessable combo was different. I wonder why this works though or why 'mailbox name' is even required. Seems a bit odd as it's not required by any other smartphone I've configured for ActiveSync.

    Blackberry

    BES, Blackberry

  • Upgrading bugzilla from 3.0.x to 3.4.6

    May 11th 2010

    By: ben

    No comments

    A few weeks ago I updated a 3 year old installation of Bugzilla to the most recent version, and made these notes along the way. The Bugzilla online documentation is pretty good and my plan was formed using their docs as a guide.

    • Send advance warning to users
    • Log on to site, edit params and enter some text under 'shutdown site'
    • Backup db using this commmand
    mysqldump --opt -u bugs -p bugs > bugs_backup_$(date +%d%m%y).sql
    • Download and extract bugzilla 3.4.6
    cd ~
    wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-3.4.6.tar.gz
    tar fvzx bugzilla-3.4.6.tar.gz
    cd /var/www/html/
    mv bugzilla bugzilla.old
    cp -r ~/bugzilla-3.4.6 ./bugzilla
    cp -r bugzilla.old/localconfig* bugzilla

    Later you will install the DBD::mysql perl module which requires mysql header files. So if you don't have mysql-devel, install it now. Also the Image::Magick perl module may fail to build from cpan (this is what happened to me), this can be installed by yum as an alternative.

    yum install mysql-devel ImageMagick-perl.i386
    cd bugzilla
    ./checksetup.pl

    checksetup.pl will tell you to install missing perl modules using cpan, however this requires an internet connection. I used ntlmaps to proxy through our MS ISA server as my bugzilla server doesn't have Internet access. I got ntlmaps from another server on the network:

    scp -r root@bugtest:/root/ntlm* .
    cd ntlmaps-0.9.9.0.1
    nohup python main.py
    export http_proxy=http://localhost:5865
    export ftp_proxy=ftp://localhost:5865
    cd /var/www/html/bugzilla

    Install optional updates:

    # failed  --> /usr/bin/perl install-module.pl Image::Magick
    # skipped --> /usr/bin/perl install-module.pl Authen::Radius
    /usr/bin/perl install-module.pl SOAP::Lite
    /usr/bin/perl install-module.pl TheSchwartz
    /usr/bin/perl install-module.pl Daemon::Generic
    /usr/bin/perl install-module.pl SOAP::Lite

    Install compulsary updates:

    /usr/bin/perl install-module.pl DBD::mysql
    /usr/bin/perl install-module.pl CGI
    /usr/bin/perl install-module.pl Digest::SHA
    /usr/bin/perl install-module.pl DateTime
    /usr/bin/perl install-module.pl DateTime::TimeZone
    /usr/bin/perl install-module.pl Template
    /usr/bin/perl install-module.pl Email::MIME
    /usr/bin/perl install-module.pl Email::MIME::Encodings

    I also needed these perl modules, even though they weren't listed by checksetup.pl:

    /usr/bin/perl install-module.pl DateTime::Locale
    /usr/bin/perl install-module.pl List::MoreUtils

    Finished with ntlmaps now, it can be stopped

    kill $(ps x | grep main.py | grep -v grep | awk {'print $1'})
    export http_proxy=
    export ftp_proxy=

    Run checksetup again, this bit can take some time while the db is upgraded:

    ./checksetup.pl
    • Fix any more problems, run again if required.
    • Once finished log into bugzilla, put maintenance page back up. This option has now moved to Administration
    • Run sanity check, fix any problems.
    • Change any css and templates that you lost in the upgrade.
    • Reopen the site for logons when you are ready.

    Enterprise Linux

    Bugzilla, Linux

  • Compile your own droid – Part 1a

    Jan 15th 2010

    By: ben

    2 comments

    android-logoHere's a confession. My inner geek woke me up the next morning at 3:00 wondering whether my android build had completed. In the end sanity took hold again, and I went back to sleep. Quite lucky really as when I checked in the morning, the java compiler had crashed with a meaningless error.

    An exception has occurred in the compiler (1.5.0). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
    
    java.lang.AssertionError: writePool E
    
    at com.sun.tools.javac.jvm.ClassWriter.writePool(ClassWriter.java:513)
    at com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1333)
    at com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1211)
    at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:325)
    at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:474)
    at com.sun.tools.javac.main.Main.compile(Main.java:592)
    at com.sun.tools.javac.main.Main.compile(Main.java:544)
    at com.sun.tools.javac.Main.compile(Main.java:58)
    at com.sun.tools.javac.Main.main(Main.java:48)
    make: *** [out/target/common/obj/APPS/VpnServices_intermediates/classes-full-debug.jar] Error 41
    make: *** Waiting for unfinished jobs....

    After trying the most recent update of Java 1.5 I made a cry for help in the XDA forums. The answer seemed simple enough, try JDK1.6. I installed it and modified /home/ben/mydroid/build/core/main.mk, commenting out the lines that checked for Java 1.5. Then after a "make clean", and another "make -j2" (-j4 made my laptop burn up ...) it was building again, and this time finished!

    I make a nandroid backup and wiped to factory settings (using Amon_RA's recovery image) flashed the resulting boot.img and system.img to my phone using fastboot:

    fastboot flash boot boot.img
    fastboot flash system system.img
    fastboot reboot

    Rebooted my device, and it worked! A very basic system though, no Market or Google Apps.

    Next steps ... getting root, creating an update.zip, making my own kernel with compcache ... the list is actually endless, it's nice just to get this far.

    In fact next step could be building from Cyanogen's Eclair sources. Will give it a go and post if it works...

    Android, Mobile

  • Compile your own droid (for HTC Sapphire) – Part 1

    Jan 13th 2010

    By: ben

    2 comments

    android-logoI thought I'd have a go at building Android 2.0.1 from source for the HTC Magic (AKA MyTouch 3G and HTC Sapphire). Mine is the 32B board from UK Vodafone - Google branded. Current most recent firmware from HTC for the device is Android 1.6, although Android 2.0.1 source code is available from Google. Android 2.0 roms are already available from xda-developers.com, but I wanted to see how hard it was to do it myself. Also if I'm successful this will be a place where all information will be in one place.

    This is not rocket science by the way - this is my experience in following the guides from Google and HTC on Ubuntu 9.10. All of this information is already out there, just not necessarily all in one place in this format or adapted for this environment.

    Building on Windows is not supported. I'm using Ubuntu 9.10 (32bit) on my laptop. Java JDK 1.5 is required, using 1.6 is supported but you have to make additional steps changing instances of "1.5" to "1.6" in makefiles. 64bit Ubuntu users may want to follow a different guide, not sure if any differences here could cause a build to fail.

    Setting up your environment ready for development, install the following packages (reference):

    sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zipcurl libncurses5-dev zlib1g-dev valgrind

    In Ubuntu 9.10 you can't get Java 1.5 using apt any more. I downloaded it from java.com and installed it in /usr/local/java/jdk1.5.0. Then:

    ln -s /usr/local/java/jdk1.5.0/bin/java /usr/local/bin/java

    If you try "java -version" it should tell you "Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)". Finally, edit your ~/.bashrc using vim and add the following to the end of the file:

    export JAVA_HOME=/usr/local/java/jdk1.5.0/
    export ANDROID_JAVA_HOME=$JAVA_HOME
    export PATH=$PATH:/home/ben/bin:$JAVA_HOME/bin

    Reload your .bashrc file using ". ~./bashrc".

    Setting up repo - a Google tool to manage your Android source code repository:

    cd ~
    mkdir bin
    curl http://android.git.kernel.org/repo >~/bin/repo
    chmod a+x ~/bin/repo
    mkdir mydroid
    cd mydroid
    repo init -u git://android.git.kernel.org/platform/manifest.git -b eclair

    Answer the questions where prompted and then fetch the source code using:

    repo sync

    This bit takes a while ... when finished:

    gpg --import

    Paste in the GPG key at the bottom of this page and then press ctrl+D. Now we need the HTC binaries and kernel source to build specifically for the Sapphire.

    wget --referer=http://developer.htc.com/google-io-device.html http://member.america.htc.com/download/RomCode/ADP/signed-google_ion-ota-14721.zip?
    
    # line commented -- wget --referer=http://developer.htc.com/ http://member.america.htc.com/download/RomCode/Source_and_Binaries/sapphire.hep-357975db.tar.bz2

    Now to do the final bit of setup and start the build (reference here):

    cd ~/mydroid/vendor/htc/sapphire-open
    ./unzip-files.sh
    cd ~/mydroid
    . build/envsetup.sh
    lunch aosp_sapphire_us-eng

    Yes that is supposed to say "lunch", not "launch". Now the build can be started! One final thing is required to stop the build from crashing (reference):

    cd ~/mydroid/external/webkit
    git cherry-pick 18342a41ab72e2c21931afaaab6f1b9bdbedb9fa

    Now we can start the build:

    cd ~/mydroid
    make -j4

    Bah, I've got an error: "Your version is: /bin/bash: javac: command not found.". There's a problem with my path (which I have corrected above already).

    export PATH=$PATH:$JAVA_HOME/bin

    Now it's building. The HTC website advises this is now a good time to make a cup of tea, or take a nap. I'll revisit this tomorrow I think!

    Android, Mobile

  • Google Wave invite, anyone?

    Nov 27th 2009

    By: ben

    5 comments

    Google_Wave_logoI just joined Google Wave this week and I have 8 invites if anyone wants one ... leave me a comment or get in touch via Twitter (@ben_stokes) with your email address and I'll send one over. Personally I am not that amazed with it, not sure if it will catch on ... I think it should handle SMTP mail as well as 'waves', it's a bit too exclusive in its current form.

    In other news there's been too much happening to have time to write about the interesting techy bits, I do have some new and useful bash and vbscripts which I'll probably post up in one big batch this week as I have some time off (woo). I've also been meaning to write some stuff about Android, yesterday I got Google Navigation working on my HTC Magic in the UK (currently it's only officially working in the USA). This was courtesy of xda-developers.com, see the link for details. It works really well, I feel sorry for anyone that bought CoPilot Live from the Market for £20 (ouch) ... as it looks like Google will be giving this out for free with Android 2.0 in the very near future.

    Random stuff

    Android, Google, Random

  • The thin client project

    Sep 12th 2009

    By: ben

    5 comments

    TuxOn 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.

    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 Ubuntu 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:

    - It used Ubuntu and Network Manager
    - It could be easily deployed by a user from booting a USB stick
    - Had a system to allow IT to make changes to the image and re-image the USB stick
    - The USB sticks should be easily cloned to distribute to all remote offices.

    I can't resist a good challenge, expecially when it involves tinkering with Linux.

    1. Installing a lean and mean Ubuntu machine
    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!

    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':

    sudo apt-get install localepurge
    sudo apt-get clean

    I decided I would go for XFCE 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.

    sudo apt-get install xfce4

    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:

    sudo du / -h --max-depth=1 | grep M

    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.

    sudo apt-get install synaptic
    xfce4-session

    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:

    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

    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!

    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

    I deleted /home/docs.tgz after a reboot, since nothing stopped working. :-)

    Next got rid of unwanted XFCE themes:

    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

    Installed Firefox, usplash (pretty startup screen) and the all-important Network Manager:

    sudo apt-get install firefox usplash network-manager

    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.

    Once last package cleanup, for good measure:

    sudo apt-get remove synaptic
    sudo apt-get autoremove
    sudo apt-get clean

    This left me around 30Mb free on /, which is pretty much what I had started with on the HP/Debian distro.

    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.

    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 Ubuntu forums 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!

    2. User friendly imaging from a bootable USB stick
    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:

    dd if=/dev/hda2 of=/myimages/thin_client_hda2.img

    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.

    I dumped dd and started looking into CloneZilla. 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.

    I used unetbootin (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.

    unetbootin
    Unetbootin

    Next boot from the stick but instead of going into an interactive session, choose the command line mode. Grant yourself root access by using:

    sudo su -

    Edit the syslinux.cfg file to customise the boot menu.

    vi /live/image/syslinux.cfg

    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.

    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="/live/image/pkg/custom-ocs-restore" ocs_live_extra_param="" ocs_live_keymap="NONE" ocs_live_batch="yes" ocs_lang="en_us.UTF8"
    
    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="/live/image/pkg/custom-ocs-backup" ocs_live_extra_param="" ocs_live_keymap="NONE" ocs_live_batch="yes" ocs_lang="en_us.UTF8"
    
    label unetbootindefault
    menu label CloneZilla Live Session
    kernel /ubnkern
    append initrd=/ubninit boot=live union=aufs    nolocales ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_keymap="" ocs_live_batch="no" ocs_lang="" vga=791 ip=frommedia

    The ocs_live_run 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:

    find / -name "custom-ocs*"

    My backup and restore scripts looked like this:

    /live/image/pkg/custom-ocs-backup

    #!/bin/bash
    
    DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/opt/drbl/}"
    
    . $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 "maverick-img" "hda"

    /live/image/pkg/custom-ocs-restore

    #!/bin/bash
    
    DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/opt/drbl/}"
    
    . $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 "maverick-img" "hda"

    I got stuck in a few places, the project maintainer (Steven Shiau) helped me out on the clonezilla forums (thanks Steven).

    3. Cloning the USB stick

    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:

    dd if=/dev/sda1 of=/dev/sdb1 conv=notrunc
    dd if=/dev/sda2 of=/dev/sdb2 conv=notrunc

    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!

    Desktop Linux

    Citrix, Desktop Linux, thin client, Ubuntu

  • Managing multiple PuTTys

    Sep 9th 2009

    By: ben

    No comments

    I don't have any Linux cluster servers to look after but do manage 2 Linux server farms. They are similar to clusters in that they are both groups of RHEL servers that all have to have an identical config. The larger of these farms is 12 RHEL 5.3 servers, and to roll out changes to them all, I wanted to be able to make the change once, and after it was verified, make the same change on the other 11 servers. I started off by writing this script on server1:

    #!/bin/sh
    
    echo -n "Enter command to run (on one line): "
    read STRING
    
    for SERVER in server2 server3 server4 server5 server6 etc; do
    
    echo -e "\033[1;31m$SERVER says:\033[m"
    ssh $SERVER "$STRING"
    
    done
    
    echo -n "Do you want to run the command locally? (y/n) :"
    read ANSWER
    
    case "$ANSWER" in
    
    y|Y) echo -e "\033[1;31mlocalhost says:\033[m"; $STRING ;;
    N|n) exit 1 ;;
    esac

    For this to work I had to create ssh keys on each server using:

    ssh-keygen -t dsa

    And then install the newly generated key (~/ssh/id_dsa.pub) into the authorized_keys file on server1. This works for running simple commands one at a time.

    For other tasks its sometimes necessary to manage multiple ssh sessions at once, for example to monitor resources using htop or tailing log files. On Linux you can use ClusterSSH (cssh) but this turned out to be a royal pain in the butt to get working on CentOS or RHEL. It worked OK in an Ubuntu VM but was a bit clunky and I felt there would be a better way of managing multiple PuTTy windows, since I am using a Windows 7 laptop for my day-to-day stuff.

    There are quite a few goodies for this on the Links page on the Putty website and this is where I found Putty Command Sender. Quite simply you type your command into the command sender, and much like clusterssh, it sends it to all the putty windows you have open.

    puttys
    Putty Command Sender

    It's not so great for editing files in Vi on 12 servers at once but it is possible - you can send cursor movements as well as lines of code or single commands. The only thing you have to watch out for in PuttyCS is that all Putty windows have updated before you start typing your next command, otherwise the last window to update may miss the first few characters of the next command.

    Finally to launch my sessions in groups I'm using Putty Session Manager. Other alternatives are available but I found this one to be the best. It's lightweight nature fits in with Putty nicely.

    Enterprise Linux

    Enterprise Linux, Linux, Putty, SSH

  • I’ve had it with Vista.

    Aug 12th 2009

    By: ben

    4 comments

    My Vista computer is configured to automatically update every Tuesday at 5:00pm. Today it downloaded and installed the following patches:

    - Windows Malicious Software Removal Tool - August 2009 (KB890830)
    - Update for Windows Mail Junk E-mail Filter [August 2009] (KB905866)
    - Security Update for Windows Vista (KB973540)
    - Update for Microsoft Office Outlook 2007 Junk Email Filter (KB972691)
    - Security Update for Windows Vista (KB971557)
    - Security Update for Microsoft .NET Framework 2.0 Service Pack 2 (KB972594)
    - Security Update for Windows Vista (KB956744)
    - Security Update for Windows Vista (KB971657)
    - Security Update for Windows Vista (KB973507)
    • - Windows Malicious Software Removal Tool - August 2009 (KB890830)
    • - Update for Windows Mail Junk E-mail Filter [August 2009] (KB905866)
    • - Security Update for Windows Vista (KB973540)
    • - Update for Microsoft Office Outlook 2007 Junk Email Filter (KB972691)
    • - Security Update for Windows Vista (KB971557)
    • - Security Update for Microsoft .NET Framework 2.0 Service Pack 2 (KB972594)
    • - Security Update for Windows Vista (KB956744)
    • - Security Update for Windows Vista (KB971657)
    • - Security Update for Windows Vista (KB973507)

    One of these updates broke my network connectivity. The NIC was still available but DHCP was broken, and assigning a static address would not help. The device itself was functioning normally and nothing in the event log gave any clues. Looking in the update history in the Windows Update application, all of these security updates have the same description:

    A security issue has been identified that could allow an unauthenticated remote attacker to compromise your system and gain control over it.

    Microsoft, how about telling me what the hell is being patched, since I can't use the links to the technet articles as my network stack was broken. Not very helpful when I am trying to figure out which patch has wrecked the system.

    Cold light of day edit: I realise this is a Microsoft problem, not neccessilary a Vista problem.

    Luckily System Restore actually works, and returned me to where I started at 5:00 this afternoon, with everything working.

    One final thing. Why is Vista such a resource pig? This computer is a dual core AMD64 2.30Ghz but it runs like its been eating pastry all day. As I am typing this, I have 4 apps open, my CPU is boiling over and my memory usage is over 1Gb. Why?! This PC is only used for web surfing, email and music.

    Capture
    Vista ... why oh why

    OK - so ending the apps in my tray (Skype, Gladinet, MSN and Avast) have recovered a few hundred Mb, but I don't see why Vista is so bad at memory management compared to Windows XP, Windows 7 ... or for that matter any Linux distro ...

    Well thats it, I can't be arsed troubleshooting it. I'm through with Vista. Time to backup, wipe and move on.

    Rants, Windows Vista

    Performance, Rant, Windows Vista

    • 1
    • 2
    • 3
    • ...
    • 9
    • >
  • Subscribe

  • Recent Posts

    • Connect Skydrive as a Windows mapped drive
    • D-Link DWA-131 and Ubuntu
    • Configure a non-enterprise Blackberry handset for Exchange
    • Upgrading bugzilla from 3.0.x to 3.4.6
    • Compile your own droid – Part 1a
  • Spam Blocked

    12,952 spam comments blocked by
    Akismet
  • Recent Comments

    • Andrew Montague on How to purge an orphaned mailbox
    • Orval Eske on Configure automatic login on OCS 2007
    • ben on Vista: Run a script at shutdown
    • Jakob G on Vista: Run a script at shutdown
    • Jakob G on Vista: Run a script at shutdown
  • Categories

    • Android
    • Blackberry
    • Blogging
    • Desktop Linux
    • Enterprise Linux
    • Exchange
    • Messaging
    • Mobile
    • News
    • Nintendo
    • OCS
    • Random stuff
    • Rants
    • Scripting
    • Technology
    • VMware
    • Windows Servers
    • Windows Vista
  • Tags

    Active Directory Android Bash scripting BES Blackberry Bugzilla Cacti CentOS Citrix Desktop Linux DivX Dr DivX Enterprise Linux Google iptables K2 Wordpress 2.5 kickstart Linux Logical Volumes LVM Messaging Mobile N95 netfilter networking Open Source Performance Putty Random Rant Red Hat Red Hat Summit RHEL routing Scripting SSH thin client Ubuntu VBScript Video Encoding VMware Windows Windows Vista wireless
  • Tweets

    • @THErealDVORAK filezilla 2010/07/30
    • Office 2007 tip of the day. Ctrl+F1 hides the ribbon! Useful on a laptop screen. 2010/07/29
    • @Danielsaan what's demob? 2010/07/28
    • @Jedipottsy I haven't tried opendesire for about 3 weeks. Been using Pays froyo rom and it rocks. How about you? 2010/07/28
    • @Jedipottsy mythreed loads faster I think, there's not much in it though. Nice work btw! 2010/07/28

© Copyright ukstokes.com. All rights reserved.

Theme designed by Nischal Maniar