Monday 22 December 2014

Monitor and Display Apartment Temperature using BeagleBone Black



As a project I wanted to be able to monitor the temperature in my apartment and display it on an LCD screen. I also decided that I would also like to simultaneously display the local city temperature.

Setup

In addition to the BeagleBone Black I purchased from AdaFruit


AdaFruit provide two Python libraries


For the OS I am running the latest version of Debian wheezy

# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.7 (wheezy)
Release: 7.7
Codename: wheezy

After following the wiring instructions from Adafruit and installing the two python libraries as mentioned above I could display the temperature from my Apartment on the LCD screen. The next step was to get the local temperature in Vancouver, Canada. I looked at a few options such as screen scraping using the Python Beautiful Soup library on the Environment Canada website. The screen scraping did work but not consistently. Looking around for some other options I found the fantastic OpenWeatherMap project, which for Canada uses Environment Canada as a data source. There is a Python library pyowm for OpenWeatherMap. This can be installed using pip :

# pip install pyown

From OpenWeatherMap you can register for free and obtain an API key. Using the pyowm library is relatively straight forward which then allows the data to be obtained and displayed on the LCD screen. 

I have a cron job that runs every 15 minutes during the hours I want the screen to display. I posted the Python script I used on my GitHub repository in case anyone finds it a useful reference.




Fix : Linux NTFS Error Mounting $MFTMirr does not match $MFT (record 0)




With an external USB hard drive that is used to share files between Windows and Linux computers you may get an Error on Linux similar to the following :

Error mounting: mount exited with exit code 13: $MFTMirr does not match $MFT (record 0). Failed to mount ‘/dev/sdd1′: Input/output error NTFS is either inconsistent, or there is a hardware fault, or it’s a SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows then reboot into Windows twice. The usage of the /f parameter is very important! If the device is a SoftRAID/FakeRAID then first activate it and mount a different device under the /dev/mapper/ directory

To resolve the issue is to use ntfsprogs which can be installed from most Linux distributions e.g.

Arch Linux

$ sudo pacman -S ntfsprogs

Ubuntu/Linux Mint/Debian

$ sudo apt-get install ntfsprogs

To fix the issue run the following command syntax

$ sudo ntfsfix <drive mount point>

Change the drive to be the same shown in the Error. For example in the above error the command is

$ sudo ntfsfix /dev/sdd1

Wednesday 17 December 2014

How to : Disable BeagleBone USR Heartbeat LED lights


The BeagleBone Black by default has 4 User LED's USR0, USR1, USR2 and USR3 that light up to show the board is alive. While useful it can be annoying.

There are 4 sub directories under /sys/class/leds which allow you to configure the LED behaviour. There is one directory per LED. Within each sub directory a trigger file details what triggers the LED e.g.

# cat /sys/class/leds/beaglebone\:green\:usr0/trigger
none nand-disk mmc0 mmc1 timer oneshot [heartbeat] backlight gpio cpu0 default-on transient

The [heartbeat] is what is showing the board is alive. This can be disabled via :

# echo none > /sys/class/leds/beaglebone\:green\:usr0/trigger
# echo none > /sys/class/leds/beaglebone\:green\:usr1/trigger
# echo none > /sys/class/leds/beaglebone\:green\:usr2/trigger
# echo none > /sys/class/leds/beaglebone\:green\:usr3/trigger

To light up the LED use the brightness file.

Turn USR0 on

# echo 1 > /sys/class/leds/beaglebone\:green\:usr0/brightness

Turn USR0 off

# echo 0 > /sys/class/leds/beaglebone\:green\:usr0/brightness

Reboot

The LEDs will be reset on after reboot which is useful for troubleshooting. The /sys directory on Linux is a RAM based File system. For ease you could create a simple bash script to run as the last file on boot.

# cat DisableUSRLEDs.sh
#!/bin/bash
echo none > /sys/class/leds/beaglebone\:green\:usr0/trigger
echo none > /sys/class/leds/beaglebone\:green\:usr1/trigger
echo none > /sys/class/leds/beaglebone\:green\:usr2/trigger
echo none > /sys/class/leds/beaglebone\:green\:usr3/trigger

Tuesday 16 December 2014

BeagleBone Black Debian image initial steps



This article details initial steps of a BeagleBone Black with a Debian image. For this setup I am using a 5V adapter for power and connecting the Ethernet port to my local LAN.

  • With power and Ethernet connected the BeagleBone is set to automatically run DHCP. You can ping the hostname of 'beaglebone' to show the connectivity

$ ping beaglebone
PING beaglebone.lan (192.168.1.155) 56(84) bytes of data.
64 bytes from beaglebone.lan (192.168.1.155): icmp_seq=1 ttl=64 time=0.964 ms
64 bytes from beaglebone.lan (192.168.1.155): icmp_seq=2 ttl=64 time=0.630 ms

  • Next ssh as root (there is no password set)


  • Set a password for root :

# passwd

  • Update to the latest builds

# apt-get update
# apt-get upgrade

  • Set the correct Timezone
# dpkg-reconfigure tzdata

  • Confirm correct date

# date

  • Check that the web server is listening on port 80

# netstat -an | grep -i 80
tcp6 0 0 :::8080 :::* LISTEN
tcp6 0 0 :::80 :::* LISTEN

  • In a web browser (not IE) open the IP address of your Beaglebone to display the default page
  • Enjoy your Beaglebone!

Monday 15 December 2014

How to : Delete files securely using shred from Nemo



The Linux command line tool shred is a fantastic way to securely remove files. It can be used from the command line e.g.

$ shred --force --remove --verbose --zero examplefile3
shred: examplefile3: removing
shred: examplefile3: renamed to 000000000000
shred: 000000000000: renamed to 00000000000
shred: 00000000000: renamed to 0000000000
shred: 0000000000: renamed to 000000000
shred: 000000000: renamed to 00000000
shred: 00000000: renamed to 0000000
shred: 0000000: renamed to 000000
shred: 000000: renamed to 00000
shred: 00000: renamed to 0000
shred: 0000: renamed to 000
shred: 000: renamed to 00
shred: 00: renamed to 0
shred: examplefile3: removed

Where

  • --force : change permissions to allow writing if necessary
  • --remove : truncate and remove file after overwriting
  • --verbose : show progress
  • --zero : add a final overwrite with zeros to hide shredding

The default is to overwrite the file 3 times but you can override this with –iterations=N, setting N to be the number of iterations.

Its useful to be able to quickly remove files securely using the File manager for Cinnamon Nemo. First its useful to review the Nemo Actions sample file :

$ vim /usr/share/nemo/actions/sample.nemo_action

Define the settings you require e.g.

$ cat /usr/share/nemo/actions/shred.nemo_action
[Nemo Action]
Name=Shred file
Comment=securely delete a file
Exec=/usr/bin/shred --force --remove --verbose --zero %F
Icon-Name=gtk-execute
Selection=S
Extensions=any;
Quote=double

  • Start nemo, right click on file and select 'Shred file'



    Note – Based on feedback I added 'Quote=double' which will delete files with spaces. 

How to : Password protect a zip file on Linux




Its useful to quickly password either one or a number of files on Linux. For example to transit some files between sites on a USB drive. The encrypt option on the zip command line tool will encrypt the contents of the zip archive using a password which is entered on the terminal in response to a prompt

Note : The Zip encryption is not very strong and could be cracked so use with caution

  • To encrypt a single file :

$ zip --encrypt Example.zip examplefile1
Enter password:
Verify password:

  • To encrypt a multple files :

$ zip --encrypt ExampleMulti.zip examplefile1 examplefile2 examplefile3
Enter password:
Verify password:

  • Tu uncompress the zip file :

$ unzip Example.zip
Archive: Example.zip
[Example.zip] examplefile1 password:

Sunday 20 July 2014

vrms (Virtual Richard M. Stallman)



I was intrigued by the sound of the vrms (Virtual Richard M. Stallman) program when I was surfing the web. It analyses the packages you have installed on your Linux machine and reports all of those that are non free. Originally developed for Debian you can get it on Arch from the AUR. If you use 'packer' you can simple install with :

$ packer -S vrms-arch

The program when run enumerates non-free packages which officially is "under licenses not considered by OSI, FSF, and/or the DFSG to be Free Software".

More info on the license categorization is found via

$ vi /usr/lib/python3.4/site-packages/vrms_arch/license_finder.py

List non-free packages and count 'ambiguously licensed packages that vrms cannot certify.'

$ vrms

Check all packages in locally synced package repositories (does not and cannot include the AUR), not just locally installed packages:

 $ vrms -g

The caveats with this method in Arch are because many packages in Arch, both free and non-free, use custom as the license field value. This means that it does not use an exact copy of one of the licences includes in the core licences packages which you can view under :

$ ls /usr/share/licenses/common/

Some common licenses like BSD and MIT are not included in the common licenses packages as they require to be edited for a specific project.

Desite these cavets I found it a useful tool to run on my various Arch systems!







Vim Awesome a great way to find vim plugins



Vim is a great text editor with many plugins that have been developed over the years and continue to be developed. One issue I have found is that its difficult to keep track of plugins. Fortunately there is now a great site called vimawesome.com that makes it easy. The data comes from GitHub, Vim.org and user submissions.

The entries are categorised on the site so you can find plugins in areas you are interested in.

The site also displays the star rating from GitHub as well as the number of GitHub users so you can get a good idea of how well used and thought of the plugin is.

Wednesday 16 July 2014

Combine bash history across multiple terminals



I use tmux (and many people also use screen) for multiple terminals. On slight down side is that by default the history command does not remember the commands between sessions on the same server. After some research and experimenting I found the following works really well in my .bashrc :

export HISTFILE=~/.bash_history
export HISTFILESIZE=500000
export HISTSIZE=500000

export HISTCONTROL=ignoredups:erasedups
shopt -s histappend
unset PROMPT_COMMAND
export PROMPT_COMMAND="history -n;
history -w;history -c;history -r;$PROMPT_COMMAND"

Using 'Ctrl + R' will have the previous entries.

Note - if you are on session A run a command and move to session B you must either just press enter or another command before the entry in session A appears

Here is each line with some comments

  • Define where the history file is saved
export HISTFILE=~/.bash_history
  • How many commands to save in the HISTFILE
export HISTFILESIZE=500000
  • How many commands to save in the current session
export HISTSIZE=500000
  • Do not save duplicate commands and erase any previous duplicates
export HISTCONTROL=ignoredups:erasedups
  • How the history list is written to the HISTFILE. The '-s' option sets the option to append the history list of the current session to HISTFILE
shopt -s histappend
  • Clear current value of PROMPT_COMMAND
 unset PROMPT_COMMAND
  • Contents of PROMPT_COMMAND are run just before Bash displays a prompt. This will save and reload the history after every command
  •  -n : Append the new history lines
  •  -w : Write history which will cause 'erasedups' to occur
  •  -c : Clear the history list
  •  -r : read the current history file 
export PROMPT_COMMAND="history -n;history -w;history -c;history -r;$PROMPT_COMMAND"


 Hope you find this as useful as I have :)

Monday 14 July 2014

Ubuntu/Arch Linux : USB Error Input/output error NTFS is either inconsistent, or there is a hardware fault


It can be quite common to use a USB drive on your Linux box and then have to copy file to a Windows computer. When you reconnect the USB drive to your Linux box you may get a similar Error to the following :

Failed to mount '/dev/sdd1?: Input/output error NTFS is either inconsistent, or there is a hardware fault, or it's softRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows then reboot into Windows twice.


This can seem a bit daunting but thankfully the solution is quick by installing 'ntfsprogs'. ntfsprogs is a suite of NTFS utilities based around a shared library.

Arch


$ pacman -S ntfsprogs

Ubuntu

$ sudo apt-get install ntfsprogs

Then run the command (note : change the drive to match the same as you get with the error) :

$ sudo ntfsfix /dev/sdd1

See the man file for full details.

$ man ntfsprogs             

Saturday 12 July 2014

Reasons not to kill -9 a process in Linux





Its something that is very common and we have all done it in our time. You have a process that is not running the way you want it or maybe it has hung. The solution seems obvious :

$ kill -9 <pid>

I had been told in the past this was a bad idea but why is this not good. There are a few reasons I have found out. When you just kill -9 a process it will not :

- Let its children know that it no longer exists

- Will not shut down its socket connections

- Temp files will not be cleaned up

In general kill -9 should only be used as a last resort as you could at some point end up corrupting an important program e.g. a database.

The recommend procedure to use is :

$ kill -15 <pid>

This allows the target process to try and clean up after itself. If that does not work in order :

$ kill -2 <pid>

$ kill -2 <pid>


And finally ;

$ kill -9 <pid>

Like anything it just takes a bit of getting used to and after 6 months on following this I believe this is a good personal practise to follow.

You can get a full list of the signals with :

 
$ kill -l

Sunday 13 April 2014

Firefox Aurora & Chrome Dev for Linux Mint : Preview upcoming features



I have been wanting to have the most up to date browsers for Linux Mint as its great to be able to see the cutting edge features before they are fully deployed.

This post shows how you can quickly setup Firefox Aurora and Chrome Dev builds on Linux Mint (will also work on Ubuntu as well).

Note : you cannot also run the Stable versions of Firefox & Chrome and the same time so they will be replaced.

Firefox Aurora

First update the repository from Mozilla to Aurora  :

$ sudo add-apt-repository ppa:ubuntu-mozilla-daily/firefox-aurora

Then update the repositories and install Firefox :

$ sudo apt-get update
$ sudo apt-get install firefox


Restart Firefox and you will now have the Aurora version. The Sotware Manager also recognized the change and updated to Aurora. All the bookmarks, settings etc will be the same as the stable Firefox version.

Chrome Dev Channel

The slight difference with Chrome is that you need to remove the installed package. First go to the Chrome Release Channels and download the Dev Channel unstable build for you OS architecture.

Next remove the current Chrome stable build :

$ sudo dpkg -r google-chrome-stable

Install the downloaded build :

$ sudo dpkg -i google-chrome-unstable_current_amd64.deb

Startup Chrome and enjoy being on the Dev channel builds!

Setup latest NVIDIA Drivers for Ubuntu or Linux Mint


  • If you need to install NVIDIA Driver's on either Ubuntu or Linux Mint the following three commands will update your system with the latest available drivers

$ sudo apt-add-repository ppa:ubuntu-x-swat/x-updates
$ sudo apt-get update
$ sudo apt-get install nvidia-current nvidia-settings

  • Reboot your system and the drivers should be applied
  • For more detailed configuration open the 'NVIDIA X Server Settings Applet'

Paint Format : Google Doc's most useful time saving tool

After moving to only using Google Doc's for content creation one of the few but vital things I found to be lacking was the support for applying the same format to multiple sections at a time in a document.

After some searching I found the solution was the Paint format icon :


To be honest I had never really noticed this icon before and had presumed it was related to images. In fact this turns out to be the most useful and underrated Google doc feature.

Example of  Paint Format usage

A typical use case is you have a document with lots of text in it but some of the text in various places requires to be different. For example below I would like every line with a command starting # to be 'Courier New' with Font size of 10 :



Its very time consuming (especially in very large documents) to go to each line individually and select 'Courier New' with Font size of 10 each time.

Fast Track Process - Single Change
  • Define the first line as you would like e.g. 'Courier New' with Font size of 10
  • Press the 'Paint format' icon once and it will be grey


  • Use the mouse to highlight the full line you want to be the same
  • The line will now automatically change to 'Courier New' with Font size of 10





 Fast Track Process - Multiple Changes

  • In the above example the change only occurs for one selection. 
  • In large doc's we need to be able to apply the same format for many lines
  • Press the 'Paint format' icon twice and it will be grey
  • Every line you now highlight will change  to the new format
  • Disable by a single click to the 'Paint format' icon




Crop Images easily in Linux using GIMP

Its great to have a quick but powerful tool to be able to crop images. On Linux GIMP (GNU Image Manipulation Program) is a powerful tool but potentially not immediately obvious way to crop images. This post outlines how you can quickly crop your images on Linux Mint or Ubuntu.

  • GIMP should already be installed but you can quickly check from the terminal :
$ sudo apt-get install gimp
  • Browse to the image, right click and select 'Open With -> GIMP Image Editor'



  • The picture will open in the main window and a second 'Toolbox' window to the left will also appear (as highlighted below)


  • If the Toolbox does not appear from the main GIMP window select 'Windows -> New Toolbox'
  • On the Toolbox select the 'Crop Tool' icon as shown  below or press 'Shift + C'


  • Select the area you want to keep then choose a corner of this box e.g. as shown below with the arrow


  • By selecting the corner box this crops the picture 




  • The default save format is GIMP XCF. To save as another format e.g. jpeg select 'File -> Export' and select the relevant format you want.

Capture Screenshots using terminal or script with Shutter

For screenshots my favorite Linux tool is 'Shutter' which has lots of features. It can be useful to capture a screenshot using the terminal or a script. This post details how you can quickly use it on Linux Mint or Ubuntu.

  • To install shutter
$ sudo apt-get -y install shutter
  • Also useful to install (details at end of post)
$ sudo apt-get -y install gnome-web-photo libnet-dbus-glib-perl libimage-exif-perl libimage-exiftool-perl
  • Capture the full screen :
$ shutter -e -f -o FullScreen.png
  • Capture active window :
$ shutter -e -a -o ActiveWindow.png

Syntax

-a : Capture the current active window
-e : Exit after the first capture has been made
-f : Capture the entire screen 
-o : Filename to save the screenshot

Note : You can save to jpeg, png, gif and bmp format

  • Using a sleep command with shutter enables you to setup the capture as required :

$ sleep 5 && shutter -e -f -o FullScreen.png

  • Then open the file e.g. my workspace 



  • A simple bash script is


  • This example will create a file called 'FullScreen.png' after 5 seconds under the directory '~/Pictures/screenshots/' 
$ CaptureFullScreen.sh FullScreen

Some Useful Things

  • You can add the script under the a bin directory in your home folder i.e. mkdir ~/bin/
  • Add your bin directory (insert your username for <username>) to your PATH within ~/.bashrc
Syntax 

export PATH=/home/<username>/bin:$PATH

Example

export PATH=/home/cwishaw/bin:$PATH
  • Give the file executable privileges
$ chmod +x CaptureFullScreen.sh
  • Using a fast access top down terminal like Guake is great to quickly start scripts with F12
  • Further details can be found with 'man shutter'

Additional Package details

  • gnome-web-photo: Create snapshot images and print web pages from the command line
  • libnet-dbus-glib-perl - extension for the DBus GLib bindings
  • libimage-exiftool-perl - Library and program to read and write meta information in multimedia files
  • libimage-exif-perl - Perl module to extract EXIF information from image files

Useful Android Network Console Commands

When dealing with network connectivity issues on computers the quickest and usually most productive troubleshooting tools involve opening a console and typing a few key but vital commands.

In the same way for Android I have found myself asking why not follow the same tried & tested method. I have found that the same commands exist and are outlined below. With these commands you will soon locate networking issues.

Note : Your device does not required to have root (super user) access as these as standard. You will require a console or network emulator to be installed which can be found free on Google Play.

Netcfg

  • This is really useful to find out what intefaces you have and the current IP's
  • I also find this a quick way to get the MAC address instead of having to navigate through the various Settings screens
  • The following screen shows an example (I have obfuscated my MAC addresses)


Ifconfig

  • This is similar to what you would use on any Linux machine (or ipconfig on Windows)
  • The main thing of note is 'ifconfig' on its own or 'ifconfig -a' will not work you need also to specify an interface 
  • A common example would be for the WiFi interface e.g. 
$ ifconfig wlan0

What are the DNS servers defined as?

  • If internet access is not working correctly you may have DNS issues
  • To check the DNS servers use 
$ getprop net.dns1
$ getprop net.dns2

Routing Table

  • Its important for networking issues to be able to view the routing table

$ show ip route


  •  The following screen shows examples of running the last three commands


Ping

  • The simplest yet very powerful tool is available
  • First ping the local gatway e.g. 192.168.0.1 then try an IP on the Internet  e.g. 8.8.8.8 (Google's Public DNS)



Buying an Android tablet for a non tech savvy relative

When buying a new tablet for ourselves its easy to know what must have features we want. Having to decide for a relative who is not technically savvy can be daunting. This guide gives a proven method to ensure the correct tablet is purchased. Top tip is making a survey for your relative (sample given at the end)!



Screen Size

  • The main options are either 7, 8 or 10 inch screens
  • Considerations
    • How do they feel about their current mobile phone size?
    • Is a larger screen size a preference?
    • Would they use it on a table or prefer to be hand held?
    • Does it have to fit into a particular bag size e.g. hand bag?

Weight


  • The larger screens inevitably lead to more weight
  • Considerations
    • Will the tablet be carried a lot e.g. for commuting?
    • If the tablet is to be used for reading is the preference to be able to hold the tablet like a book?

Cameras


  • Not all tablets have front and rear cameras
  • Considerations
    • Will the tablet be used for video calls (front camera required)?
    • Is there a need for taking good quality photos or apps that require back camera e.g. scanning bar codes for shopping apps?

E-Reader


  • One of the main functions of a tablet can be using it as an e-reader e.g. with Kindle or Kobo
  • Considerations
    • How often will the tablet be used as an e-reader?
    • Would the user prefer a large easy to ready screen, or a lighter, smaller tablet?

TV Connectivity


  • Connecting the tablet to TV can be great for sharing or playing content. Using an HDMI connection is easiest but there are adaptors available for tablets without HDMI connection e.g. USB and 30 pin to HDMI are available
  • Considerations
    • Does your current TV have any HDMI connections?
    • Are there sufficient available HDMI connections on the TV or will an HDMI splitter be needed?
    • Is there a location the tablet can be placed (e.g. a shelf) to connect to the TV?

Video Calls


  • One of the most common reason for buying a relative a tablet is for video calling using Skype or Google Hangouts so a forward facing camera would be required
  • Considerations
    • Is the quality of the video playback and sound good enough for video calls?
    • Does a particular application require to be supported e.g. Skype. Worth checking on reviews to see if other tablet owners have successfully used these apps.

3G or WiFi only


  • Wifi only is significantly cheaper. 
  • Considerations
    • Do they need 3G? 3G models also tend to weigh slightly more than their wifi only counterparts

GPS


  • If the tablet is to be used for maps outside the home GPS may be useful.
  • Considerations
    • Some GPS on tablets have "Assisted GPS" which relies on a data connection

Clumsy or Careful Owner


  • How rugged does this tablet need to be? 
  • Considerations
    • Will it be bumped, dropped or roll around in a bag? 
    • Models with Gorilla glass are tougher and less likely to be scratched but if you suspect rough treatment a good padded case and screen protectors are a must. 
    • Cheaper models may not have so good build quality. 
    • If possible feel them in store for flex and check out some reviews.

App Usage


  • What type of app's will your relative be interested in e.g. news, games, YouTube, music.
  • Considerations
    • Does the OS version matter. Are they familiar with a version of Android already? 
    • App compatibility with certain versions of Android.
    • Certain types of apps may display better on a larger screen and some apps were developed for mobile so look odd on a big screen.

Accessories


  • Accessories are important to most tablet owners
  • The person receiving the tablet might like to immediately accessory their latest tech gadgets with cases, screen protectors or speakers.
  • Considerations
    • While you might like to buy the latest model with great features for your own use bear in mind it might not be possible to buy accessories right away for new release models. 
    • The person receiving the tablet might like to immediately accessory their latest tech gadgets with cases, screen protectors or speakers.
    • Does the tablet have USB connections or bluetooth?
    • Do they want to use USB accessories or bluetooth keyboards and headphones? 

Getting the correct answers...the easy way!

  •  As there are so may things to consider speaking with a relative it can overwhelm them 
  • I would recommend taking 15 minutes to create a customized survey for your relative using something like SurveyMonkey which has a free service
  • With the survey approach the relative can think about what they really want on their own time & give you all the answers!

Sample Survey


1. Do you want to read e books?

Yes
No

Not sure

2. What size screen would you prefer?

7 inch
8 inch
10 inch
Other (please specify)


3. Do you want to use the tablet to take photos?

Yes
No
Not sure


4. Do you want to connect to tv via HDMI?

Yes
No
What is HDMI?


5. Do you want to make VoIP calls on tablet i.e. Skype or Google hangouts

Yes
No
Not sure


6. Will you want to use tablet for sudoku and crossword apps?  

Yes
No
Maybe


7. Is device likely to be used outside home?

Yes
No
Maybe 

Root access for Samsung Galaxy I9000 on Linux

This post explains how to root your Samsung Galaxy I9000 on Linux. I used Linux Mint 14 but the same process would work for Ubuntu.

One of the first hurdles you will fine when trying to root your Android Samsung Galaxy I9000 is that most post's recommed running 'Odin' which is a Windows only application.

For Odin I tried :

1. Using PlayOnLinux and this does not work with the Odin exe file

2. Using a Windows VM running on VirtualBox, running the Odin exe. I did have the VirtualBox extension pack installed and I could see the Samsung Galaxy I9000 within the VM when the phone was connected via USB when it was powered on. But when it was in 'Download' mode Odin could not detect the Phone in the VM.

The Solution I found was using the Linux posrt of Odin called Heimdall andthe process is :

1. From Heimdall GitHub site download the "Heimdall 1.3.1 command line tool - Debian 32 or 64-bit binary .deb file and install

# wget https://github.com/downloads/Benjamin-Dobell/Heimdall/heimdall_1.3.1_amd64.deb
# sudo dpkg -i heimdall_1.3.1_amd64.deb


2. Download the CF-ROOT kernel zip file

3. Unzip the file, then un tar the file so you are left with a zImage file i.e. you need to extract the archive twice

4. Enable USB Debugging on the phone via Settings, -> Applications -> Development -> USB Debugging option -> Select to enable

5. Power off your phone

6. Power on phone in Download mode (press Volume Down + Home Key +Power together. It will show a show a yellow icon saying "Downloading. Do not turn off Target!!!"

7. Connect USB cable from phone to laptop

8. Run command line tool to show its connected :

$ heimdall detect
Device detected


9. Flash image

$ sudo heimdall flash --kernel zImage
[sudo] password for clunky:
Heimdall v1.3.1, Copyright (c) 2010-2011, Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/

Initialising connection...
Detecting device...
Claiming interface...
Attempt failed. Detaching driver...
Claiming interface again...
Setting up interface...

Checking if protocol is initialised...
Protocol is not initialised.
Initialising protocol...
Handshaking with Loke...

Beginning session...
Session begun with device of type: 0

Downloading device's PIT file...
PIT file download sucessful

Uploading KERNEL
100%
KERNEL upload successful
Ending session...
Rebooting device...
Re-attaching kernel driver...


10. Reboot, phone and download a "Root checker" app from Google Play to check everything is correct.

11. You can also review the CWM and SuperUser new applications

How to configure a VPN on Linux Mint



  • Linux Mint (unlike Ubuntu) does not have VPN access installed by default
  • The following 'How to' will get your VPN running quickly
  • Install the following packages

$ sudo apt-get install -y openvpn openvpn-blacklist network-manager-openvpn network-manager-openvpn-gnome

  • Reboot your system
  • Open the Network applet
  • Click the + button
  • Select VPN for interface then click 'Create'
  • For 'Choose a VPN Connection Type' select OpenVPN then click 'Create'
  • Configure your VPN connection with the details given by your provider
  • Typical details required are :
    • Connection Name : Label that appears in Network Manager applet
    • Gateway : VPN access point
    • Authentication : Username, passwords and certificate details
  • Once configured test the VPN connection by selecting the 'Connection Name' now listed in the Network Manager applet 

Draw arrows in GIMP on Linux





Unlike most photo editing software GIMP does not come with draw arrow support by default. This post shows how to get this feature within GIMP and how to use it on Linux Mint & Ubuntu.
  • Close GIMP if its open
  • Go to the GIMP Plugin Registry 
  • Search for 'Draw arrow' + download 'arrow.scm'
  • Copy file from "Downloads" directory to the gimp hidden folder in your home directory
$ cp arrow.scm ~/.gimp-2.8/scripts/

Note : Your GIMP version may vary but will be ~/.gimp-<version>/scripts
  • Open an image in GIMP and under menu 'Tools -> Arrow' will now appear
  • Select 'Colour Tool' and on the bottom of the 'Toolbox' select the colour you would like the arrow to be :

  • Select Paths Tool
  • Next is a bit tricky (until you do it a few times). Select where the arrow head will be, press mouse once and a small square will appear


  • Select where arrow tail will be, press mouse once and a line appears


  • Right click on the line and go to 'Tools-> Arrow'



  • Modify how the arrow is defined in the options (you can play with this until its what your want)


  •  Press OK and the arrow will appear :)

Highlight area of image with rectangle in GIMP on Linux




GIMP is a great photo editing tool on Linux Mint + Ubuntu. This post shows how you can quickly highlight an area of any image with rectangle.
  • Open GIMP and select the 'Colour Tool' then scroll down to the bottom of the Toolbox and change to the desired colour.



  • Choose the 'Rectangle Select Tool'


  • Select the area you want to highlight

  • Go to the 'Edit -> Stroke Selection'




  •  Select the type of stroke (Solid color or pattern) and change the width then press OK


  • You now will have the image highlighted

  

Nexus 4 screenshot capture

Its useful to be able to quickly capture a screenshot on your Nexus 4 for many reasons. This post shows how you can quickly capture the phone screenshot.

  • Press both Power + Down Volume buttons at the same time


  • The screenshot will appear in the notifications window



  • You will have access to the screenshot under 'Gallery -> Screenshot'

Nexus 4 USB Connection Setup on Linux

Setting up USB transfer mode on my Nexus 4 was not as straightforward as I thought it would be. This post details how you can connect your Nexus 4 quickly to Linux Mint or Ubuntu. The solution involves using Go-mtpfs a simple FUSE filesystem for mounting Android devices as a MTP device.
  • Connect your Nexus 4 to your Linux box 
  • Under the 'Notification's window on the Nexus 4 it will show the USB options which you can select

 
  •  Ensure 'Media device (MTP)' is selected

  • Disconnect the Nexus 4 USB from the Linux box
  • From the terminal
$ sudo add-apt-repository ppa:webupd8team/unstable
$ sudo apt-get update
$ sudo apt-get install -y go-mtpfs
  • This will create a '/media/MyAndroid' directory
  • Connect your Nexus 4 vis USB
  • Create a simple mount bash script 'Nexus4MountUSB.sh'

  •  Create a simple dismount bash script 'Nexus4DisMountUSB.sh'
 

Some Useful Things

  • You can add the script under the a bin directory in your home folder i.e. mkdir ~/bin/
  • Add your bin directory (insert your username for <username>) to your PATH within ~/.bashrc Syntax

export PATH=/home/<username>/bin:$PATH

Example

export PATH=/home/cwishaw/bin:$PATH

  • Give the files executable privileges 
$ chmod +x Nexus4MountUSB.sh
$ chmod +x Nexus4DisMountUSB.sh
  • Using a fast access top down terminal like Guake is great to quickly start scripts with F12
  • FUSE (Filesystem in Userspace) allows non privilaged users to export a virtual filesystem to the Linux kernel
  • MTP (Media Transfer Protocol) is used from Ice Cream Sandwich to access the devices storage via USB
  • It allows access to the phone from the PC and the device simultaneously which the older USB Mass Storage did not