Tuesday, May 27, 2008

Canon Drivers in Ubuntu

As I've discovered getting Ubuntu Hardy to print in colour to a Canon iRC 2880i can be a bit of a nightmare. Now that I've figured it out I thought I should put it here.
This guide should work for most Canon printers and most versions of Ubuntu.

If you only want to print in black & white then it is fairly straight forward.

1. Goto System->Administration->Printing
2. Create a new printer queue
3. Select the type of connection to the printer (mine is Windows Printer via SAMBA)
4. Input the printer settings eg: and authentication if needed
5. For drivers use Generic->PCL 5c->Generic PCL 5c Printer Foomatic/hpijs
6. Give it a name and you're set to go

If you would also like to print in colour then this is where the fun begins.

You will need the UFR Printer Drivers from Canon in Australia. The PostScript drivers are also there but I haven't tried them but I can't see why this guide won't work for them.
If you're using the iRC 2880 then you can go straight here


otherwise just go here and select your model


Once you have the drivers and have extracted them then follow these steps.
Note: If you are using a version of Ubuntu that is older than Hardy you should just be able to run the deb files in the Debian folder and if there are no problems then you can skip to step 6

1. If you try and run the deb file in the debian folder in Hardy it will give a dependency error regarding libcupsys2-gnutls10. So in that case...
2. Run sudo apt-get install alien
3. Go to the extracted drivers RPM directory in a Terminal
4. Run sudo alien -c *.rpm (The -c will include any scripts in the package)
5. Run your newly created deb packages. First the cups common one then the driver one.
6. Follow the instructions above for the setting up of only black & white printing up to and including step 4
7. For drivers use Canon->iR C2880/C3380 UFR II->iR C2880/C3380 UFR II (or whatever model you are using)
8. Give it a name and you should now be printing in colour

In case you were wondering why you get the dependency error in step 1, the reason is that the Debian package was converted from a RPM one, using alien. Alien picked up the dependencies that where present on the system that the package was initially created.

Like I said at the beginning, this should work for most Canon printers because I found the link for the Canon Australia on a forum explaining how to get a different model of Canon printer installed on Ubuntu Edgy.

Wednesday, May 21, 2008

Netbeans Formatting

Just a very quick note.

I tried to change my tabs size from the default 8 to 4 and it all seemed broken. My tabs became 2 spaces. I did some searching only to find that many developers have even reverted back to Netbeans 6.0.

My settings were changed as follows:

Tools -> Options -> Editor -> Indentation
I changed "Number of Spaces per Indent" to 4 and "Tab Size" to 4

The only way I got it to work was a complete shutdown of Netbeans. Simple enough but caused me loads headache (and I nearly replaced Netbeans 6.1 with an older version)

Friday, May 16, 2008

WARNING: HDD shortened life span under linux

Please note this is NOT my work. I have shamelessly copyied it from http://ubuntuforums.org/showthread.php?t=795327 so kudos to nicedude.

Due to APM constantly parking and unparking your hdd your hdd cycle count increases rapidly. As most drives are rated to 600 000 cycles the faster you get to these the faster your drive will wear. I tested my drive (Western Digital) and found I suffered from this very problem.

Basically you need to do the following - Install the disk monitoring tools

sudo aptitude install smartmontools

Then by running

sudo fdisk -l

and finding out how your drive is addressed (I.e. /dev/sda) you can run this

sudo smartctl -a /dev/sda | grep Load_Cycle_Count


NB: If in 15 mins the last number increased by more than 2-4 then you suffer from the same issue as I did.  Following the directions in the origional post I downloaded the shell script to my desktop made it executable and ran the following

sudo cp ~/Desktop/99-sda-load-count-fix.sh /etc/acpi
sudo cp ~/Desktop/99-sda-load-count-fix.sh /etc/acpi/start.d
sudo cp ~/Desktop/99-sda-load-count-fix.sh /etc/acpi/suspend.d
sudo cp ~/Desktop/99-sda-load-count-fix.sh /etc/acpi/resume.d

you could also create the shell script yourself it looks as follows

## Script by nicedude at Ubuntu forum 5-14-2008
## A fix to stop high hdd spin down counts from occuring thereby increasing hdd life
## The hdparm -B parameter can be adjusted between 200-254 should be sufficient for these purposes
## Using the value - B 200 should work fine if not enough then you could increase up to a max of 255
## which means no APM power management for the drive
## If your drive is called hda instead of sda then change it below
## You can find out by running sudo fdisk -l in a terminal and looking at whether it is called hda or sda

hdparm -B 200 /dev/sda

After a reboot run the following to get the Load_Cycle_Count

sudo smartctl -a /dev/sda | grep Load_Cycle_Count


You should only see a small increment.

Hope you are feeling a little more comfortable.. ;)

3G in Ubuntu

Getting 3G in Ubuntu to work is pretty straight forward for most people but there can be some minor issues that affect a few of us especially if you are running Hardy Heron.

Firstly you'll want to go to https://forge.vodafonebetavine.net/projects/vodafonemobilec/ to get the Vodafone Mobile Connect Card Driver. At the time of writing this the latest stable version is 1.99.17.

Go to where you have downloaded the Deb file and Right-Click on it then select Open with "GDebi Package Installer" and install the package. The Package Installer will download and install any dependencies that are required and then it will install the driver.

Once the install is complete plug in your 3G device and give it about 30 seconds to register itself with the system. Now go to Applications -> Internet and select Vodafone Mobile Connect Card driver for Linux and the application will start up. A warning message stating that Device setup not completed click close on the message and confirm that the device it discovered is correct then it will ask for your pin number. It will then start the Authenticating process.

Now for most people this should be working now if not carry on reading.

If after selecting your device you just have a window with a progress bar bouncing back and forth then click Cancel and follow these steps:
1. Remove your 3G device
2. Run sudo udevcontrol reload_rules
3. Plug your device back in and wait about 30 seconds
4. Run the Vodafine Mobile Connect application again

It should now start the Authenticating process and go through successfully. Just note that this can take up to 1 minute sometimes.

Howto: Disable IPv6 in Firefox 3

This tip will speed up the process of resolving DSN names. (I.e. web sites name resolution)

Open a new tab in firefox.
In the url/address bar type about:config
Click on the "I'll be careful, I promise" on the resulting screen that pops up.
In the Filter: field provided type ip
The list of configurable items is reduced to only contain entries with the ip string in them.
Look for the entry network.dns.disableIPv6
It will have a Status of default, Type of boolean and a Value of false
Double click on this entry it will change to bold
The Status will change to user set, Type will still be boolean however Value will now be True
What we have done is turn off IPv6 dns lookups
Restart Firefox and you should see an improvement in finding your web pages.

Howto: Disable IPv6 in Ubuntu

Disabling IPv6 in Ubuntu is a simple exercise.
Firstly to check that IPv6 is running run

netstat -an | grep udp6

If you get any results you still have IPv6 running

You need to edit the aliases file.

sudo vi /etc/modprobe/aliases

Look for the line that says the following

alias net-pf-10 ipv6

I commented this line out with a #

then added the following just below it

alias net-pf-10 off

I did the same for appletalk and ipxI also removed all IPv6 references from my hosts file. This isn't required but I like my system clean and I do use my hosts file so if I see those unused entries there it worries me.

After a reboot when you run

netstat -an | grep udp6

You should not see any results returned and IPv6 will be off.

Thursday, May 15, 2008

Evolution (and Other Apps) - SSH - Corporate Proxy

So I thought I'd kick off your idea with something I recently posted to the UbuntuForums. This has helps me stick with Ubuntu at a client where I am currently stationed. I know this looks like a lot of reading but it is not that difficult and well worth the effort.

I needed an SSH server as the Corporate proxy does not have socks enabled. If socks was enabled I would simply have configured tsocks to point to that server.

1.Get access to the ssh server.
2.Login using

 ssh acidhawk@

3.Test connection to my mail server from the ssh server (if this didn't work I would have asked the sysadmin to enable socks support on the corporate network proxy.... )

 telnet mail.acme.com 25 (smtp to send)
 telnet mail.acme.com 110 (pop3 to receive)

4.End ssh session
5.Download tsocks to my local machine

 sudo apt-get install tsocks

6.Change /etc/tsocks.conf to point to my local machine

 change server = to server =

6.From a local shell setup ssh tunnel

 ssh -D 1080 acidhawk@

This opens a shell connection to if you close this shell your ssh tunnel will also close 
7.From a new shell on your local machine run

 tsocks evolution &

I didn't like having to type my password every time I connected so I did the following (which I got from http://ubuntuforums.org/archive/index.php/t-30709.html ):

1.From a cmd shell on your local machine run

 ssh-keygen -t rsa

2.Change to your homedir and then go to the .ssh dir (you need to copy the generated key to the ssh server)
3.Copy the id_rsa.pub file to your homedir on the ssh server by typing
 scp id_rsa.pub acidhawk@

4.Connect to the ssh server 

 ssh acidhawk@

5.Run the following commands to add your public key to a file that will allow you kay access to the ssh server

 acidhawk@$ touch authorized_keys2
 acidhawk@$ chmod 600 authorized_keys2
 acidhawk@$ cat ../id_rsa.pub >> authorized_keys2
 acidhawk@$ rm ../id_rsa.pub

6.Exit from the ssh server and run the following

 ssh -l acidhawk

7.After you have entered your passphrase you will be connected. Next time you run ssh acidhawk@ you will not be asked for your password.
8.Next I didn't want the ssh shell to be opened (I wanted it to run in background) so now I run the following to setup the tunnel

 ssh -N -f -D 1080 acidhawk@

9.Check that ssh is still running 

 ps -ef | grep

(you should see the command you just ran)

My next trick is to automate the tunnel setup if I am at this particular office. I don't want to run this when I am at home so I investigated editing my .bashrc as well as looked at setting the tunnel up from a startup script. Neither of these seemd like a good idea as I would have to still open a shell to run evolution like so (tsocks evolution &). I decided to create a script to run all the apps I wanted to be able to go through this tunnel (Evolution, RapidSvn, Eclipse etc) The following is the first attempt at this script. What I will do now is change all my menu launchers to the following

  myLauncher evolution -or - myLauncher rapidsvn etc.

myLauncher look as follows

Update: Now check if my 3G is connected and determine if I need to use tsocks when launching an app


MYIP=`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}'`

if [ "$1" = "" ]; then
echo "Usage: $0 "
elif [ "$1" = "stop" ]; then
pid=`ps -ef | grep | grep -v grep | awk '{print $2}'`
if [ "$pid" != "" ]; then
kill -9 $pid
# Check if I am at ClientABC (My Address here is always
if [ "$MYIP" = "" ]; then
pid=`ps -ef | grep | grep -v grep | awk '{print $2}'`
if [ "$pid" = "" ]; then
echo "Setting up SSHTunnel for ClientABC..."
ssh -N -f -D 1080 acidhawk@

#Chech if my 3G is connected
PPP=`ifconfig ppp0 >/dev/null 2>&1`
if [ $? -ne 0 ]; then
echo "NO 3G detected - Launching $1 with \"tsocks\""
tsocks $1 >/dev/null 2>&1 &
echo "3G detected - Launching $1 without \"tsocks\""
$1 >/dev/null 2>&1 &

#I am not at any client so will not use tsocks
$1 >/dev/null 2>&1 &

Basically what I am looking to see if I am at a particular client (I do this by checkin my ip address). I then check if there is already a PID for my ssh tunnel if there is I will not setup the tunnel again. However , if I am at ClientABC I will launch my app ($1) with tsocks. I can use this script at home as my ip address is different and I will then launch my app as simply $1.

Hope this helps

Winix Has Landed

Welcome to Winix.
This blog has been created as somewhere to store all the hints and tips that we've discovered for the various operating systems and applications that we use.
If you happen to find anything on here that helps you out or if you've know of a better way to do something that we have listed here let us know.