Fix bad for loop variable canon linux driver
Fix bad for loop variable Canon linux driver
I got recently a help from a friend regarding a specific letter and it seems it was needed to have the Canon printer driver installed. It was the first time using it and I gave him the perfect chance to test it out. He was using a Canon mg2250, however the linux drivers appear to be working on a all mg2000 series. Also the process to install the driver appears to be the same on all other printer models, just needs the proper driver version.
Download Canon linux driver
In our case I found that the drivers needed could be downloaded from here:
http://bit.ly/16QKNCy
Using a link shortening service since its pretty long one. Anyway, you should just go here:
http://www.canon-europe.com/Support/Consumer_Products/index.aspx
and get the proper driver for your Canon printer.
Install printer driver on linux
Once we have our driver downloaded, we should normally untar it, you can use the below commands:
1 2 3 4 |
cd Downloads tar -zxvf cnijfilter-mg2200series-3.80-1-deb.tar.gz cd cnijfilter-mg2200series-3.80-1-deb sudo ./install.sh |
First issue 64 bits
Now normally you should not have any issues from here and the process to install your printer should be seen. However, if you are on a 64 bits linux, you will have to first edit the install.sh file and replace:
1 |
sudo dpkg |
with the following:
1 |
sudo dpkg --force-architecture |
This will allow you to install the drivers on your 64 bits system. The drivers by default are made to work only on 32 bits linux system.
Second issue bad for loop variable
Now if you are using Ubuntu, seems like they handle the for() constructor a bit different, if you do not make the file executable, the for loop will give an error:
1 |
install.sh: Syntax error: Bad for loop variable |
The solution to this is to either make the file executable and then run it:
1 2 |
chmod +x install.sh ./install.sh |
or to use the bash command to run the file:
1 |
bash install.sh |
You should be able to see at this point a similar result:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
: ----------------------------------------------------------- Target printers detected 1) Canon MG2200 series (/dev/usb/lp1) ----------------------------------------------------------- Currently selected:[1] Canon MG2200 series (/dev/usb/lp1) Enter the value. [1] #=========================================================# # Register Printer #=========================================================# Enter the printer name.[MG2200] Command executed = sudo /usr/sbin/lpadmin -p MG2200 -m canonmg2200.ppd -v cnijusb:/dev/usb/lp1 -E #=========================================================# # Set as Default Printer #=========================================================# Do you want to set this printer as the default printer? Enter [y] for Yes or [n] for No.[y] #=========================================================# Installation has been completed. Printer Name : MG2200 Select this printer name for printing. #========================================= |
Some of you may not be able to see the printer name when trying to print, however it should work if you choose the generic printer which should definately be present there.
That’s it for today, will see you again in another tutorial.