Archive for May, 2009

Scanner Support

27, May 2009

First the bad news, although some scanners are supported in ubuntu/linux many are either not supported at all or only basic scanning is supported, in my case my Visioneer 4800u is not supported at all! As I wanted to move completely over to ubuntu I decided to buy a second hand scanner from eBay. I checked for compatible scanners on the SANE [Scanner Access Now Easy] project page here by checking out the Supported Devices listed my Manufacturer page. I then bid on a Canon CanoScan N650U Flatbed Scanner and got is for £12.31 including postage [result!]

If your scanner is supported then you may need to add the SANE front and back ends to your system as follows: Open the [Synaptic Package Manager] and add the the following packages;

sane, sane-utls, xsane & xsane-common

You can now plug in your scanner and open the [XSane Image Scanner] from the [Applications], [Graphics] menu and if all goes well your scanner name should show in the dialogue title bar and if you press Scan you should be up and running.

Ubuntu Gusty v7.10 and possibly older versions may need to have scanbuttond (yes there is a d at the end) running for the scanner operation to be detected. To add the scanbuttond type the following in a [Terminal];

sudo apt-get install scanbuttoned

To run the program manually type the following after the prompt;


To make this program run at start-up so you don’t have to do this each time you want to scan open [System], [Preferences], [Sessions] click on the [Start-up Programs] Tab then click the [+ Add] button. A new window will appear, add [Scanbutton] in the [Name] field and scanbuttond in the [Command] field [remember the “d” at the end of scanbuttond, then [OK] that and [Close] when you re start the PC scanbuttond will be running.

Some command line scanner options to try, type or copy and paste the following into the [Terminal] after the prompt;

This will produce a scan without using the XScane graphical interface

scanimage -x 210 -y 290 –resolution 400 –mode Color > /home/yourname/output.jpg

change [yourname] for the name of your [Home] folder and this should produce a scan called output.jpg.

These command line options will help identify your scanner for problem solving;

sane-find-scanner -v -v

scanimage -L

cat /proc/bus/usb/devices

redirect their output to a text file to make things easier by adding >> scanner_test.txt to the end of each line. The >> part appends the text to the end of the last so you will not overwrite the output from the last command.

sane-find-scanner -v -v >> scanner_test.txt

or use this script, create the script file using;


open the file with;


then copy and paste the text below into it.

## created by Martin Cooper 27 May, 2009 ##
echo “Scanner test script” >> scanner_test.txt
echo “sane-find-scanner -v -v output” >> scanner_test.txt
echo “*********************************************” >> scanner_test.txt
sane-find-scanner -v -v >> scanner_test.txt
echo “scanimage -L output” >> scanner_test.txt
echo “*********************************************” >> scanner_test.txt
scanimage -L >> scanner_test.txt
echo “cat /proc/bus/usb/devices” >> scanner_test.txt
echo “*********************************************” >> scanner_test.txt
cat /proc/bus/usb/devices >> scanner_test.txt

now save the file and make it executable with;

chmod +x ~/

and now run it by running this command


or double click on the file. The result will now be in the file scanner_test.txt in your home Directory.

Notes: Feisty v 7.04 onwards Gnome Desktop

Desktop launcher menu items

27, May 2009

Create a Gnome Desktop launcher for a program that does not create one of it’s own via the command line.

The basic format for a Desktop launcher is;

[Desktop Entry]
Comment=Media Player

Open a text editor and copy & paste the above text into it, changing the following options;

Name: The name you wants to see in the menu for the program.
Comment: The message the comes up when you fover over the menu item.
Exec: the command that start the program.
Icon: the path to an icon of your choice.
Terminal: leave as false to not open in a [Terminal].
Type: leave as Application.
Categories: listed below;
Internet is Network
Sound & Vision is AudioVideo
Games is Game
Office is Office
Accessories is Utility
Graphics is Graphics
Programming is Development
System Tools is System
System preferences is settings

save it naming it your_name-name_of_program.desktop i.e. martin-songbird.desktop

The first part of the file name can be anything you like but must be there as the file must have the format name-prog_name.desktop. You should now have a desktop icon in you home Directory which you can then click on to open the program. If nothing happens and you need to edit the file the easiest way is to open it from a [terminal] using the following command;

gedit martin-songbird.desktop

or by opening your favorite test editor and then opening the file from it as nautilus cannot open these files and does not display the full file name. You can now move this icon to your Desktop if you wish or add it to your Applications menu using the following command;

xdg-desktop-menu install ./martin-songbird.desktop

Notes: Ubuntu Jaunty Gnome Desktop

creating a symlink [symbolic link]

27, May 2009

Creating a symlink [symbolic link, known as a shortcut to Windows users] using the command line. To create a symlink to a file called test_file in /home/martin on the desktop we open a [Terminal] and because it defaults to the home directory create the test file test_file with;

touch test_file

and add some text to it with

echo “This is a test file” > test_file

now we create the link with

ln -s /home/martin/test_file ~/Desktop

this will create a symbolic link to the file on you desktop, open the file using it and you should see the text we added above. Note the ~/ option is a shortcut of /home/martin i.e. to your home folder. Now lets create the symlink again with a different name

ln -s ~/test_file ~/Desktop/”My Test File”

The same command can be used to create symlinks to Directories and symlinks can be removed with rm -f, so our last symlink can be removed with;

rm -f ~/Desktop/”My Test File”

Using Ubuntu Jaunty on the Gnome Desktop

My First Script

26, May 2009

This is not my first script but I was asked by a friend to start him off in the right direction so after writing this out I thought I should at least post it!

Ubuntu, for some reason unknown to me uses the Dash shell which causes problem with some scripts written in the standard Bash shell. To make things easier from the start it is better to swap over to do this open a Terminal [Applications], [Accessories], [Terminal] and type or copy & paste the following;

echo $SHELL

and press [Enter], you should get a response like this;


which is your current Shell, the [echo] means print the following to the screen. Now lets change it to the Bash shell, type the following in the [Terminal]

sudo rm -f /bin/sh

and press [Enter], you will then be asked to enter your password as the sudo option means you are working as the root [super user] and this requires a password to make it secure. now type the following;

sudo ln -s /bin/bash /bin/sh

the first command removes the symlink [symbolic link, which Windows users will know as a shortcut] which links Dash to the sh command and the second adds a link from the bash shell to the sh command. Now type this again;

echo $SHELL

your should now get;


Now lets set-up a folder in your home directory to store your scripts in and allow the system to locate them by adding the new directory to your path. Create a new folder by typing;

mkdir bin

as the [Terminal] starts up in you [home] directory the bin directory will be created there. you can list the contents of your home by typing;


and [Enter] which will list all the directories [in blue] & files [in black]. Now lets add the bin directory to your path, this is where the system looks for files you ask it to launch. To see your current path, type the following.

echo $PATH

which will give you something like;



and then repeating the command;

echo $PATH

will now give you;


Any executable scripts you place in your bin directory can run by typing their name in a [Terminal] as we will see later. We will now create our first script using the Touch command.

touch ~/bin/

the ~/ is short for the path to your home directory i.e. /home/martin/ and the rest adds the file called in the bin directory. We need to add some commands to the file so open it in gedit by typing;

gedit /home/martin/bin/

Then copy and paste the following into the file, save it and close gedit, the first line is know as the “shebang” and point the system at the shell you are using, the lines starting ## are comments and will not be run.

## created by Martin May 2009 ##
## say hello ##
## we give the variable today a value which represents ##
## day, date & time and prints it later by adding a $ to it ##
today=`date +%a%t%d%t%B%t%Y%t`
## ask your name and read it into a variable called name ##
echo -n “Enter your name: ”
read name
## clear the screen ##
## we now give the variable time the current system time ##
time=`date +%T`
## now lets print it all out to the screen ##
echo “Hello World!”
echo “Welcome ” $name
echo “Today is “$today
echo “and your logon time was : “$time

We can now try and run the script by typing it’s name in the [Terminal];


which will result in;

bash: /home/martin/bin/ Permission denied

This is because the script is not yet executable, so type the following;

chmod +x ~/bin/

and run the script again with;

It should then ask for your name and display the result with a welcome message including the time as follows;

Hello World!

Welcome Martin

Today is Tue 15 May 2009

and your logon time was : 22:33:24

Once you have this basic script running, you can start making changes and playing with the output.

Firefox crashing on flash sites

25, May 2009

Jaunty – Firefox – Gnome desktop

My Firefox constantly crashes when viewing flash based site such as BBC iplayer & Flickr. It was fine using Intrepid but the upgrade to Jaunty has done something and as it’s doing it on both my laptop and desktop both recently upgraded to Jaunty. First I closed Firefox then removed the installed plugins typing the following into a Terminal;

sudo apt-get remove –purge swfdec-mozilla mozilla-plugin-gnash flashplugin-nonfree

Then I installed the adobe flash plugin, with;

sudo apt-get install adobe-flashplugin

Tested and failed! so I downloaded Flash Player 10 .deb file for Ubuntu v8.04 from the adobe Web Site found here, Adobe Flash Player 10 then I closed Firefox and removed the adobe-flashplugin in a Terminal type;

sudo apt-get remove –purge adobe-flashplugin

now I navigated to my download and double clicked on the install_flash_player_10_linux.deb file which opens the [Package installer] and complained there was a newer version in the repositories. I [ok]’d the install and retested Firefox, so far all is well…

Auto mount USB Hard Drive at Boot

25, May 2009

To make my external USB Hard Drive auto mount at the same mount point on every boot [especially important if you use scripts to copy backups to it] then follow these instructions..

First create a mount point in the directory /mnt , open a terminal and type;

~$ sudo mkdir /mnt/USB-HD

replace USB-HD with whatever you want to see in the Places list as the name of your Hard Drive.

Now check where the HD is currently mounted, if you navigate to /media you should find that your USB HD is mounted as something like /media/disk, now open a Terminal and type;

~$ mount

You should see something like this, and need to search for the line which includes your disks mount point in my case /media/disk;

/dev/sda1 on / type ext3 (rw,relatime,errors=remount-ro)

tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)

proc on /proc type proc (rw,noexec,nosuid,nodev)

sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)

varrun on /var/run type tmpfs (rw,nosuid,mode=0755)

varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)

udev on /dev type tmpfs (rw,mode=0755)

tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)

devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)

fusectl on /sys/fs/fuse/connections type fusectl (rw)

lrm on /lib/modules/2.6.28-11-generic/volatile type tmpfs (rw,mode=755)

/dev/sdb1 on /home type ext3 (rw,relatime)

securityfs on /sys/kernel/security type securityfs (rw)

binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)

gvfs-fuse-daemon on /home/martin/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=martin)

/dev/sdg1 on /media/disk type ext3 (rw,nosuid,nodev,uhelper=hal)

As you can see my USB Drive is mounted on the last line at /dev/sdg1

Now make a backup of the fstab file which controls the mount points of your file system by adding a .bak to the end of the copied file with;

~$ sudo cp /etc/fstab /etc/fstab.bak

then open the fstab file with;

~$ sudo gedit /etc/fstab

and adding the new line at the bottom of the list as follows, changing the /dev & /mnt options to match your own above;

/dev/sdg1 /mnt/USB-HD auto auto,user,rw,exec 0 0

then re saving the file.

My HD is formatted as an ext3 but the 1st auto in this line checks to see what the disk is formatted as, but you can change it to the actual format if you wish. Now reboot your PC and [fingers crossed] your External HD will mount as USB-HD.

Jaunty : Enabling NUM Lock at boot & after login

20, May 2009

Enabling NUM Lock at boot

The Default behaviour is for the NUM Lock key to be off at boot up, but if you wish to have it enabled for entering your login password, follow these instructions.

From Synaptic Package Manager, search for and install numlockx or, from the Terminal type or copy and paste:

sudo apt-get install numlockx

To get it working, you now have to edit the appropriate startup file. First, make sure you have a working backup of the file, in a Terminal type or copy and paste:

sudo cp /etc/gdm/Init/Default /etc/gdm/Init/Default.bak

Next, modify the gdm/Init file. In a Terminal type or copy and paste;

gksudo gedit /etc/gdm/Init/Default

Scroll down to the end of the file, and above the line that says “exit 0” add the following:

if [ -x /usr/bin/numlockx ]; then
/usr/bin/numlockx on
Save the file then, next time you reboot, your NUM LOCK should default to “on.

Keeping Num Lock on afetr login:

Open [System], [Preferences], Startup Applications], click on add type numlockx in the 1st box numlockx in the 2nd box and keeps Num Lock on after login in the 3rd box, then click on [Add]. now restart your PC.

An Apt Server using apt-cacher-ng

17, May 2009

I decided that due the increasing number of PC’s and laptops in the house all requiring the same package downloads from Ubuntu that downloading them once to a server and then serving them onto the various other machines was a better use of my broadband bandwidth. I therefore decided to install apt-cacher following this post with some changes, the main one being I used the Debian version of apt-cacher called apt-cacher-ng.

The PC I used for this is a laptop with a missing screen [don’t ask] with a standard install of Ubuntu.

First install apt-cacher-ng by copying & pasting the following into a terminal after the prompt;

sudo apt-get install apt-cacher-ng

and test that the service is running by typing this to http://your_server_name:3142/apt-cacher-ng into your web browser changing the your_server_name to the name of your server or it’s ip address. When I installed Ubuntu on my server I called the PC bob during the installation therefore I used http://bob:3142/apt-cacher-ng. You can also use http://[localhost]:3142/ the page that gets displayed is an error page with info. and links to various web pages.

If you want to change any of the settings in the apt-cacher config file then, copy & paste the following into your Terminal;

sudo gedit /etc/apt-cacher-ng/acng.conf

I changed the location of the Cache directory so that it was outside my o/s partition and within my home partition as the folder get quite large. If you do this then you need to change the permissions on the folder to add the apt-catcher-ng user group.

sudo chown -R apt-cacher-ng.apt-cacher-ng /Path/To/Your/New/apt-cache-archive

you can now update the repository source list on the server & all the client PC’s or add the redirection in /etc/apt/apt.conf.d/.

Redirection Method

adding a file called 02proxy to /etc/apt/apt.conf.d/ to redirect apt/synaptic requests via server to apt-cacher.
In a Terminal;

touch ~/02proxy

this creates a file called 02proxy in your home folder.

echo ‘Acquire::http { Proxy “http://bob:3142”; };’ >> ~/02proxy

change bob to your server name, this adds the line Acquire::http { Proxy “http://bob:3142”; };  to the file

sudo mv ~/02proxy /etc/apt/apt.conf.d/02proxy

this moves the file from your home folder to /etc/apt/apt.conf.d/

now go to “continue from here” below.

The source.list Method

Backup first In a terminal copy & paste;

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

to make a backup of the list in the same directory, then there are a couple of options to amend the sources.list file;

Option :1

sudo gedit /etc/apt/sources.list

when this opens you need to insert your_server_name:3142 in every line, i.e.

deb Jaunty main restricted


deb http://your_server_name:3142/ Jaunty main restricted

which made mine look like this;

deb http://bob:3142/ Jaunty main restricted

you can use the search and replace option in gedit to make this a faster process then save and close it.

Option :2

Another option is to open a Terminal and type;

sudo sed -i ‘s/http:\/\//http:\/\/bob:3142\//g’ /etc/apt/sources.list

this uses sed to search for the string http:// in each line of the sources.list file and replace it with http://bob:3142/, you just need to replace bob with the name of your server.

continue from here;

now restart the apt-cacher-ng

sudo /etc/init.d/apt-cacher-ng stop

sudo /etc/init.d/apt-cacher-ng start

if you get a permissions error here check the permissions on your new apt archive folder.

and update the source list with

sudo apt-get update

to update the package list.

if you get errors it’s worth rebooting the PC and trying again especially if you changed any details in the conf file.

Once the update has run you should see that it has placed several directories and files in the Cache directory at /var/cache/apt-cacher-ng or wherever you moved it too.

Now go to your client PC and after updating it’s source list run the apt-get update command to make sure that works ok.

Now we need to import any existing packages in the servers apt-get cache into the apt-cacher-ng cache, so copy and paste into a Terminal;

$ test -x /var/cache/apt-cacher-ng/_import || sudo mkdir -p -m 2755 /var/cache/apt-cacher-ng/_import

change the path if you have moved the cache ddirectory, this creates a new directory called _import within it.

Now in a Terminal;

$ cd /var/cache/apt/archives

import the old packages with:

sudo  cp *.* /var/cache/apt-cacher-ng/_import

Now open the apt-cacher-ng info. page at http://your_server-name:3142/acng-report.html

scroll down to the bottom of the page and hit the import button. After a while the import should finish and you should notice an increase in the space in the disk space that the cache directory takes.

You can now remove the _import directory with;

$ sudo rm -fr /var/cache/apt-cacher-ng/_import

and the old apt cache with;

$ sudo rm -fr /var/cache/apt/archives/*.deb

to save space.

Now download a different packages on each of your PC’s so that you can check each PC’s downloads are going into the apt-cacher-ng cache on the server. The only way I found to do this was to check the number of files in the cache at /var/cache/apt-cacher-ng using properties then add a package and re check to see if the count increased.

The apt-catcher-ng service produces a report at http://your_server_name:3142/acng-report.html i.e. mine is at http://bob:3142/acng-report.html.

Ubuntu NBR – Asus Eee 701

17, May 2009

My Eee Pc is the 701 4GB version and I’m running Jaunty with a Gnome desktop on my PC

I downloaded the Ubuntu Jaunty J v9.04 img shortly after it was released in April 2009 and then burnt it to a USB stick using a program called USB-ImageWriter which I downloaded by adding it’s repository details from here to my desktop PC. There is currently no Jaunty version available but the Intrepid version works. In a Terminal type or copy and paste the following after the prompt;

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

This makes a copy of your repository list, now open the list with;

gedit /etc/apt/sources.list

at the bottom of the list add the following 2 lines for Intrepid from the site or update them for Jaunty when they become available;

deb intrepid main

deb-src intrepid main

now save the file and back in the Terminal window copy and paste:
sudo apt-key adv –recv-keys –keyserver 0x2f5e654186577485b7b4440290345e8d2fef0ce2
This adds the repositories authentication key to your system, no copy and paste the following

sudo apt-get update

This updates the source list and you will now find have packages usb-imagewriter is  available in the Synaptic Package Manager to be added to your system or you can add it using the following command;

sudo apt-get install usb-imagewriter

This application will now have an icon named ImageWriter in the [Applications], [Accessories] menu.

Make sure the .img file you are going to copy to USB stick is in your home folder and not within a folder which has spaces in it’s name and that the .img file also has no spaces in it’s name. If you run Imagewriter and nothing happens this is the first thing to recheck as it gives no error messages for this problem. Now insert the USB stick you want to add the .img to and open ImageWriter. select the .img file you wish to write then the USB stick you want to write it to and select [Write to device].

Now plug your USB stick into your Eee Pc and power it up, as it starts up hit the [Esc] key until a menu displays giving you the option to boot from the internal SD Card or the USB stick, select the stick and Ubuntu will boot. Select the Live version if you wish to try before installing or select install if you are good to go. Follow the on screen install insturctions, I let it do a standard whole hard drive install.

Install finished and PC rebooted you should now have a slighlty jerky version of Ubuntu to play with, get your WiFi or cable network connected then do the following to sort that out.

First go to this site and download the latest linux image & header files, i used the ones dated 21st April, but there may be new versions now,

linux-image-2.6.28-11-generic_2.6.28-11.43~lp349314apw5_i386.deb and


Now navigate to the folder you downloaded them to and douple click on them, [Package installer] should then open and give you the option to install. Install both and re boot the PC and you should now have a working PC.

It’s worth remembering that if your webcam does not work, check in the bios [press F2 on start up] that the installation is “finished” and that the webcam in enabled.

Check out this post if you want to change the size of some of the application screen, it work for me.

Update Manager – Jaunty

16, May 2009

Jaunty now notifies the user of available updates via a new popup notification window which appears every 7 days and nags the user to update. Security updates will notify as and when. If you would like to revert to the old version which places a reminder icon on the top panel when any update is available without opening the update manager, follow these instructions.

In a Terminal type the following;

martin@ubuntu:~$ gconf-editor

this opens the Gnome configuration Editor, then navigate to [Aps], [update-notifier] and untick the [auto-launch]  option, then change the [regular_auto_launch_interval] to zero, then [Quit] the application and reboot your PC.