Logitech Quickcam Chat on Hardy Heron

[Update] – Intrepid RC onwards works better. Plus see tips on fine tuning brightness etc at http://p-s.co.nz/wordpress/?p=315

I needed a web camera for Ekiga/Skype and I chose the Logitech Quickcam Chat web camera because it was cheap and I expected I would be able to get it to work with Ubuntu. My selection process began with https://wiki.ubuntu.com/HardwareSupportComponentsMultimediaWebCameras. I looked at some known brands and tried to identify recent reports of products with “out-of-box” experiences reported. Logitech seemed to have at least one suitable offering (https://wiki.ubuntu.com/HardwareSupportComponentsMultimediaWebCamerasLogitech), namely the Quickcam Chat, and I knew I could source it locally at a good price. Logitech also seemed to be a good bet as a supplier for Ubuntu because it has a Linux support site http://www.quickcamteam.net/hcl/linux/logitech-webcams which is maintained by Logitech’s video engineering team.

In actuality, it was not quite “out-of-the-box” but installing xawtv
sudo apt-get install xawtv
and using V4L instead of V4L2 seemed to do the trick.

One of the comments for the Quickcam Express Plus gave a hint this might be worth a shot – “Camera is detected, but needs package xawtv installed to hook it to /dev/videox.”.

Images are good in Ekiga, a bit yellow in Cheese (except when taking a picture) and sometimes in Skype. This is probably nothing to do with the camera though as DVDs can have the same problem depending on whether gxine is used or not. Underlying cause unknown.

Still, the Logitech Quickcam Chat is a cheap unit and it is working. There are apparently problems running it with Intrepid but that may change soon.

A final touch was to install the Camera Monitor and add it to the tray. It announces when the camera is actually in use by a program e.g. Ekiga. It has a setting so that it launches on startup.

One link which could be of some use is https://help.ubuntu.com/community/Webcam.

MPG to AVI in Ubuntu Using mencoder

A friend had to get a 120 MPG file down to a smaller size so he could email a message to a friend for a celebration. Ubuntu to the rescue! I found the following:

mencoder INPUTFILE -ofps 25 -ovc xvid -oac mp3lame -lameopts abr:br=192 -srate 48000 -xvidencopts fixed_quant=4 -o OUTPUT.avi

http://ubuntuforums.org/showpost.php?p=4142023&postcount=2

The srate (sound) could be dropped to 16000 if necessary but the big savings were with framerate dropping from -ofps 25 to 15 and the size reduced by adding:

scale=160:128

There are likely to be much better ways of doing these things but it worked in this case and the file was 3MB instead of 120MB. The result could be played successfully in VLC (but not necessarily in Windows Media Player or Real Player).

Windows XP Infested, Replace with Ubuntu Hardy Heron

The nasty virus infestation was the final straw and my father-in-law wanted to switch to Ubuntu. He wanted better security and peace of mind.

Step 1 – Use live CD to check that Ubuntu works OK with hardware (monitor, printers, keyboard, mouse, scanner, soundcard)

Step 2 – Transfer ALL files (including malware) from windows PC to my Ubuntu notebook using ssh

Type into terminal sshd
Follow the (extremely simple) instructions to install ssh server on notebook so we can send it files
Connect PC and notebook with ethernet cable (NB modern network cards probably make it unnecessary to use a special crossover cable)
Set wired connection on PC to static IP
Reboot (not sure if always or even usually necessary but it can remove some problems
Set wired connection on notebook to a different static IP
Reboot (probably not necessary but doesn’t take long)
On PC ping self in terminal e.g. ping own_IP (Ctrl-C to interrupt)
On notebook ping self in terminal e.g. ping own_IP (Ctrl-C to interrupt)
Ping each machine from the other e.g. on notebook ping PC_IP
If all pinging works, run the following (NB assumes drive mounted as drive 1):
scp -pr /media/disk1 username_on_dest@notebook_IP:~/savedpc
(scp http://linux.about.com/od/commands/l/blcmdl1_scp.htm)
At the end check that the same number of files etc made it across.
Then set the permissions for the oldpc folder (and all its contents) to read only etc

NB wipe ssh server off notebook to reduce attack surface. sudo apt-get remove name_of_ssh_server_package

Step 3 – Perform guided installation of Ubuntu wiping entire hard drive

Step 4 – Set up Ubuntu (see http://p-s.co.nz/wordpress/?p=28
NB we need internet access so we can temporarily switch from static IP for the wired connection to DHCP.

Step 5 – Transfer all files back into a folder called oldpc

Type into terminal sshd
Follow the (extremely simple) instructions to install ssh server on PC being rebuilt so we can send it files
Run the following:
scp -pr name_of_folder_to_shift_back username_on_dest@PC_IP:~/oldpc
At the end check that the same number of files etc made it across.
Then set the permissions for the oldpc folder (and all its contents) to read only etc

Step 6 – Enable remote access into PC from notebook
NB initially we are setting this up with the PC in the same room sitting on the same network as the local notebook. Once everything is set up and we install the PC where it actually belongs we will need to use a different IP address. Vinagre’s Find method will no longer work because it works on the local network.

6.1 Set up ADSL modem to allow packets from obscure port through to ssh port (22). Some modems have it as a NAT rule, some as port forwarding (basic) etc.
6.2 On PC go System>Preferences>Remote Desktop and Allow other users to view your desktop and Allow other users to control your desktop (NB ignore command suggestion – we’ll just use Vinagre).
6.3 Create new user via Administration>Users and Groups. This user will be the only one we allow to ssh in. Give that user administrator rights
6.4 Change ssh settings to ONLY allow that new user access to the PC via ssh

sudo gedit /etc/ssh/sshd_config
add new line on end and a blank line after it. May need to reboot (may not). NB sshd not ssh.
The new line is AllowUsers new_user_name_here
6.5 Open ssh tunnel (port forwarding) on notebook. NB format is port:host:hostport. When you connect to that port on the notebook it is directly connecting you to the hostport specified.

ssh -L 5900:localhost:5900 new_username_on_dest@PC_IP

NB I will need to do this each time I wish to use Vinagre to connect to the PC. I open an ssh tunnel, and then use Vinagre to reach across it. I will also need the following on the end of the command:
-p obscure_port

6.6 Open Vinagre on notebook
Applications>Internet>Remote Desktop Viewer>Connect
Host: localhost
Port: 5900
This works because I am directed to port 5900 on the remote computer (via the port forwarding I just set up in the terminal) and localhost is localhost on the PC of the host port.

6.7 Do whatever is needed on the remote PC

6.8 Close Vinagre (NB F11 to toggle in and out of fullscreen)

6.9 Close ssh tunnel with
exit

Step 7 – Setup PC in actual location with ADSL modem etc
Having trouble connecting to the internet. Able to connect to the ADSL modem from the PC using http://gateway_IP_address_here/ so the ethernet connection, the power, and the modem are all working fine. But pinging out doesn’t work. Fixed that. Odd setting required. Printer and scanner installed extremely easily. Much better than competing OS’s ;-).

Step 8

8.1 Thunderbird files
Copied old thunderbird folders across from windows (it worked!). Use sudo cp … and copy and paste the location. To copy all contents of a folder use -r or -R and “path name/with gaps/”* Will find everything in Ubuntu in /home/user_name/.mozilla-thunderbird/gobbledegook.default/Mail. Ctrl H to see hidden folders etc.

Even if a folder does not have subfolders, you must use the -r. Otherwise you get something like cp: omitting directory yadda yadda. http://www.tuxfiles.org/linuxhelp/dirman.html

NB copy and paste the gobbledegook because it can be hard to get it exactly right just by reading it – example reason – Lowercase L (l) not = numeral one (1) even though in some fonts they are very similar!!!!!!! The windows location is Documents and Settings/user_name/Application Data/Thunderbird/Profiles/gobbledegook.default/Mail. It may be necessary to unlock the folders copied across so use sudo chmod 777 -R path_to_unlock_recursively

8.2 Thunderbird address book
Copy the file abook.mab from … oldpc … /Documents and Settings/user_name/Application Data/Thunderbird/Profiles/gobbledegook.default/” to /home/user_name/.mozilla-thunderbird/gobbledegook.default/

8.3 Firefox 2 bookmarks into Firefox 3
This only required opening Firefox 3, Bookmarks>Organise Bookmarks>Import HTML and importing the stored bookmarks.html file from … oldpc … /Documents and Settings/user_name/Application Data/Mozilla/Firefox/Profiles/gobbledegook.default/”. Restart Firefox.

ROUTINE USE:
open secure shell in:
ssh -L 5900:localhost:5900 new_user_name_on_dest@PC_IP -p obscure_port
The PC_IP address will frequently change so try the last one and then ask user to visit www.showmyip.com and tell you the new one. The obscure port was set in step 6.1.
First time with any new IP address will need to say yes (not y, Y etc) to RSA key creation.
Otherwise just need password for new_user_name_on_dest.
(NB to exit when finished)

NB can work from the CLI for file management tasks etc. Only open remote desktop viewer if seeing the screen (or user interaction) useful.

The open remote desktop viewer (Vinagre) Internet>Remote Desktop Viewer
Connect:
localhost
5900

NB performance not so good so use desktop when you have to and actual shell itself when you can.
To get cursor I think it is is Ctrl-Alt. NB fastest often to set desktop background to a colour while working on it and restore wallpaper at end.

F-spot problem with Canon Powershot G2

Will post more details of both problem and solution later. Solution – add Photo folder under /home/grant and away you go.

Update Oct 9th 2008 – Hmmm – software updates seem to have fixed the problem. Possibly had something to do with dbus.

Dual Monitor in Intrepid (At Last!)

The rest is redundant Intrepid Alpha 6 onwards :-). The standard interface works fine.

I have a VGA 19″ monitor and an LCD 19″. But how to get reliable dual monitor? The GNOME screen resolution interface has never been able to get dual monitor working properly. The closest I ever got on previous attempts was the screens the wrong way around!

A friend put me onto the following: HOWTO: Get Dual Monitors (“Dual Head”) to work on a Dell Optiplex 755 running Ubuntu 8.04 with Intel Q35 Chipset and Xorg RandR 1.2. And that did the trick in Ubuntu Intrepid Ibex Alpha 4 onwards.

Step 0 – No compiz sadly. It apparently doesn’t work above 2048 x 2048 and I want 2560 x 1024. So switch the effects to Off.

Step 1 – clean out /etc/X11/xorg.conf
sudo dpkg-reconfigure -phigh xserver-xorg

Step 2 – expand virtual desktop to size required for multiple desktops
Add the following subsection to the “Screen” section of xorg.conf:

Subsection "Display"
Depth 24
Modes "1280x1024" "1024x768"
Virtual 2560 1024
EndSubsection

I set Virtual to be twice the width of 1280 and the height of 1024. Now we are completely finished with xorg.conf. The rest is through xrandr.

The next steps were only required in alpha 4. In alpha 5 it worked with the two previous changes only.

Step 3 – Find out names of monitors
xrandr -q
I found my two monitors were designated VGA-0 and DVI-0. Use your own names as appropriate in the following steps.

Step 4 – Set up as cloned first:
xrandr --output VGA-0 --auto --output DVI-0 --auto --same-as VGA-0

Step 5 – Now setup one large virtual desktop:
sudo xrandr --output DVI-0 --right-of VGA-0

Step 6 – run script automatically on startup:
See AddingProgramToSessionStartup for very helpful instructions.
xrandr --output DVI-0 --right-of VGA-0

GRUB Menu – Putting Windows Back on List

The Problem – upgraded Ubuntu kernel and the GRUB menu no longer had a line for starting Windows.

Solution tried: Opened menu.lst for editing using command:

sudo /boot/grub/menu.lst

and added the following section (+ reset default – NB zero-based so item 1 is 0 etc)

title Windows 95/98/NT/2000
root (hd0,0)
makeactive
chainloader +1

Nope – hd0,0 not correct on the dual boot kids computer.

OK ran the following command to see what partitions there were:

sudo fdisk -l

(NB that is an L not an i)

This returned something roughly like:

/dev/sda2
/dev/sda3
/dev/sda4
/dev/sda5

where the sda4 was the Windows partition. So I changed (hd0,0) to (hd0,3) and dual booting worked again.

And to prevent Ubuntu from wiping the Windows entry again I only put Windows under the Debian automagical line.

Hasta La Vista Vista – Hello Ubuntu Hardy Heron

A friend was very dissatisfied with Vista on his new Compaq Presario C700 Notebook PC with 2GHz and 1Gb RAM.
Tux love
Wireless was Atheros AR5007 802.11b/g which is the same as in my Acer Aspire 4315. So I knew I could get that to work one way or another.

Step 1 – Tested using live CD. Check touchpad and mouse (cordless) works plus sound etc.
Step 2 – Total clean install using entire hard drive. Hasta la Vista Vista!
Step 3 – Get wireless working

Thanks to http://ubuntuforums.org/showpost.php?p=5146927&postcount=8

sudo aptitude update
sudo apt-get install build-essential
If you have problems with the last step, and you are asked to insert a CD, comment out the CD line in /etc/apt/sources.list
sudo gedit /etc/apt/sources.list
e.g. add # in front of line like deb cdrom:[Ubuntu 8.04 _Hardy Heron_ – Release i386 (20080422.2)]/ hardy main restricted
wget http://snapshots.madwifi.org/special/madwifi-nr-r3366+ar5007.tar.gz
tar xvf madwifi-nr-r3366+ar5007.tar.gz
cd madwifi-nr-r3366+ar5007/
sudo make
sudo make install
sudo modprobe ath_pci
If you change to the 2.6.26 kernel, you will need to blacklist ath5k (until they finally make it work reliably with ath 5007, in which case, forget the mad wifi drivers altogether).
sudo gedit /etc/modprobe.d/blacklist
add line: blacklist ath5k

System>Administration>Hardware Drivers – disable both wireless drivers. We are using the ones we installed from mad wifi.

sudo reboot

NB if you upgrade your installation and it changes the kernel you will need to follow the instructions here: Restoring Madwifi on Acer Aspire 4315 after Kernel Update

Step 4 – Get youtube, cds. DVDs working.

Medibuntu is your friend (media buntu). https://help.ubuntu.com/community/Medibuntu

sudo wget http://www.medibuntu.org/sources.list.d/hardy.list -O /etc/apt/sources.list.d/medibuntu.list

sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update

Add ability to view DVDs
sudo apt-get install libdvdcss2

The grab all the other stuff you need:
sudo apt-get install w32codecs

Open www.youtube.com and you will be prompted to install flash. Use adobe’s for now.

Step 5 – get Ekiga (VOIP softphone) account, download all other desired apps e.g. Inkscape (make your own clipart), KolourPaint (simple drawing), Thunderbird + Lightning extension (email plus calendar), Scribus (Desktop Publishing), VLC (media playing), Keep (backups).

[Extra – as at 14/9/2008] Can add rmvb support as per http://www.simplehelp.net/2007/07/27/how-to-play-rmvb-files-in-ubuntu/. Add compiz configuration manager and try out the rotating cube etc. Check the screensavers are OK with the video card/compiz combination.

Reset MySQL password in Ubuntu

A fresh install didn’t seem to let me set/reset the password and for some reason I couldn’t get in. So thanks to: http://ubuntu.flowconsult.at/en/mysql-set-change-reset-root-password/ for the answer (which worked in Hardy):

1. Stop the MySQL Server

sudo /etc/init.d/mysql stop

2. Start the mysqld configuration.

sudo mysqld –skip-grant-tables &

3. Login to MySQL as root.

mysql -u root mysql

4. Replace YOURNEWPASSWORD with your new password!

UPDATE user SET Password=PASSWORD(‘YOURNEWPASSWORD’) WHERE User=’root’; FLUSH PRIVILEGES; exit;

Note: This method is not regarded as the securest way of resetting the password. However it works.

Restoring Madwifi on Acer Aspire 4315 after Kernel Update

Thanks first to: Link at http://www.ubuntugeek.com/

Make sure you are using the latest wifi drivers:

http://snapshots.madwifi.org/special/

If so, you just need to get to the directory you have the madwifi-nr-r3366+ar5007 (or similar) file in:

e.g. cd ~/Desktop/storage/madwifi-nr-r3366+ar5007 in my case

Then:

sudo make

sudo make install

sudo modprobe ath_pci

sudo reboot

If not, you must do the following first:

wget http://snapshots.madwifi.org/special/madwifi-nr-r3366+ar5007.tar.gz

tar xfz madwifi-nr-r3366+ar5007.tar.gz