Archive for the ‘Ubuntu’ Category

PAE kernel breaks NVidia Drivers (Ubuntu)

Thursday, May 19th, 2011

I’m running on a ThinkPad T410 with 4GB RAM. I need to stay on 32-bit as I have some dependency on 32-bit applications that I couldn’t get running on 64-bit. Thus I’ve installed the PAE kernel to access all the RAM. Problem is, this broke the graphics.

After booting up the first time, I was presented with the option of running Ubuntu in low graphics mode – great.

Anyway, the fix is nice and quick. Go into the Hardware Drivers tool and disable the NVidia driver. Reboot – you should now be back to normal resolution, just no acceleration. Re-enable the NVidia drivers and reboot again and everything should be back to normal.

Fixing the aspect ratio on Canon camcorder *.MOD files

Saturday, April 2nd, 2011

I have a Canon FS200 digital video camera which creates MOD files.  These are playable on Linux by simply changing the file extension to “mpg”.  The only issue is that the video displays in 4:3 aspect ratio, whereas it should be 16:9.

On many players, you can override the display aspect ratio during playback and then the files display correctly.  The problem is when you want to edit these files or create overlay text/graphics, as the editing program will process them in 4:3 ratio, and then when displayed in 16:9, the overlays will look stretched (while the video looks correct).

Although I have tried to solve this a number of ways, the actual fix is remarkably simple and fast.  The clue to this fix was in the error message “ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.“.  Searching in the mencoder man page for “vprp” provided the solution.  Mencoder has a command line option “-force-avi-aspect” that can be used with the “-ovc copy” option, so you don’t need to re-encode (and potentially loose quality).  As this is only updating the meta data in the file, the fix is almost instantaneous.

The following command will perform the fix:

mencoder -oac copy -ovc copy -force-avi-aspect 1.777 input-4_3.mpg -o output-16_9.mpg

Ubuntu upgrade breaks LIRC

Saturday, January 8th, 2011

I recently upgraded my Ubuntu 10.04/XBMC based media center box (not a dist. upgrade, just a sudo apt-get upgrade).  After the update finished, I realised that the remote control (StreamZap) wasn’t working any more.

Quickly scanning the relevant files (i.e. /etc/lirc/* and /dev/lirc*) didn’t show up any obvious issues.

It turns out, all that is required is to run the following reconfiguration on lirc:

sudo dpkg-reconfigure lirc

Select your appropriate control and (if this doesn’t fix everything) then reboot and the remote should be working again.

UPDATE:

Unfortunately this seems not to be a permanent fix.  After rebooting, more often than not, the remote is not working again.  Performing the step above does seem to fix it for the current boot though.

A bit of further research found this post.  The post explains, that when the lirc_imon module is loaded (i.e visible when running an lsmod) the remote doesn’t work.  Performing the dpkg-reconfigure as stated above actually ends up removing the module lirc_imon – this is what actually fixes it.

So, to make the fix permant, you need to add lirc_imon to your modules blacklist.  The cleanest way to do this is to create another file called blacklist-lirc.conf in the /etc/modprobe.d/ directory with the following content:

blacklist lirc_imon

This will stop the module loading on boot, and your remote should remain working.

Connecting to MySQL database from OpenOffice.org Base

Sunday, January 2nd, 2011

Quick one here… if you want to connect to a MySQL database from OpenOffice.org Base, you need to install the openoffice.org-mysql-connector package:

sudo apt-get install openoffice.org-mysql-connector

After this is complete, make sure OpenOffice is completely restarted (i.e. not just the Base app, if you have a Writer window open, this needs to be closed too). Then just follow the prompts for connecting to an existing database (choose “MySQL” and “Connect directly” as you work through the wizard).

Running scripts on network connection (if-up.d, if-down.d,if-pre-up.d,if-post-down.d)

Friday, November 19th, 2010

On my previous post I described how to authenticate against web based logons after connecting to a particular SSID.  One of the problems I had was getting the script to actually run.  You should just be able to put a script in the /etc/network/if-up.d directory (on Debian based systems) and it should run when a network interface connects.  This wasn’t working for me and it seemed some other people were having issues too.

The solution to the problem turned out to be removing the file extension.  So the script that was named testscript.sh didn’t run, but the script named testscript did.  So if you are having similar problems you may want to try removing the file extension.

I am not sure if this is documented and expected behavior, or a bug.

Auto logon to web-authenticated wireless

Thursday, November 18th, 2010

At my current workplace I am using a guest wireless network.  After connecting, I need to open any web page and I am redirected to the login page and need to enter my provided username and password.  After submitting, I can browse any page and use the connection for email and other tasks.

Whilst this is only a minor inconvenience, it is definitely a candidate for automation.

A single line wget command is all we really need.  I have wrapped it up into a shell script below:

#!/bin/sh

username=XXXX
password=XXXX

wget -O /dev/null --no-check-certificate --post-data "username=$username&password=$password&buttonClicked=4&err_flag=0&redirect_url=google.com" https://1.1.1.1/login.html

-O /dev/null throws any downloaded content away, --no-check-certificate is fairly self-explanatory (wget wouldn’t connect to the https address without this), --post-data wraps up the various name/value pairs that the login form is expecting.

For most of these login forms, you only need a username and password, but I found with this one it also needed a few extra parameters.

So, the next step is to get this script to run automatically after connecting to the wireless network.  On Ubuntu (or any Debian based distro), there is a directory structure under /etc/network that includes an if-up.d directory.  Any scripts in here will be run after a network interface is brought online.  These scripts don’t have access to the SSID (as far as I know), but this can be obtained with the following command:

iwgetid --raw

Wrapping it all together, we can put the following script in the “if-up.d” directory:

#!/bin/sh

username=XXXX
password=XXXX
ssid=XXXX

if [  "`iwgetid --raw`" = "$ssid" ]
then
wget -O /dev/null --no-check-certificate  --post-data "username=$username&password=$password&buttonClicked=4&err_flag=0&redirect_url=google.com" https://1.1.1.1/login.html
fi

Remember to change the values of username, password and ssid.  Set the URL to the forms action value and add remove parameters as necessary.  Also, another point I learned the hard way is that the script can’t have a “.sh” extension, so name it “something” not “something.sh” (and remember to chmod +x it).

If you need to then connect to a VPN, this can also be added to the script.

Fixing ThinkPad Trackpoint scrolling on Ubuntu 9.04

Monday, May 11th, 2009

Recently after upgrading my Thinkpad R52 to Ubuntu 9.04 I had some trouble configuring the trackpoint scrolling (one of the Thinkpad features that is hard to live without once you get used to it).

There are a number of blog posts and a good article on ThinkWiki that explain the cause of this (a move away from Xorg based input configuration to evdev).  But these solutions didn’t work for me.

After poking round for a bit, I started to realise there were some inconsistencies in the solution offered for evdev.  This was mainly in relation to the “axis” settings.  So I tried taking the solution offered on ThinkWiki and changing the  “Y” axis mapping to “Z” axis mapping as shown below. This file should be saved as “/etc/hal/fdi/policy/mouse-wheel.fdi".

<match key=”info.product” string=”TPPS/2 IBM TrackPoint”>
<merge key=”input.x11_options.EmulateWheel” type=”string”>true</merge>
<merge key=”input.x11_options.EmulateWheelButton” type=”string”>2</merge>
<merge key=”input.x11_options.ZAxisMapping” type=”string”>4 5</merge>
<merge key=”input.x11_options.XAxisMapping” type=”string”>6 7</merge>
<merge key=”input.x11_options.Emulate3Buttons” type=”string”>true</merge>
<merge key=”input.x11_options.EmulateWheelTimeout” type=”string”>200</merge>
</match>

Problem fixed!

I’m not sure if I also need the “Y” axis line in the file also (or the “X” asix line for that matter), but everything seems to be working as expected.  On top of this, Firefox was also working exactly as expected with horizontal and vertical trackpoint scrolling working (without any changes on the about:config page).