Archive for the ‘Debian’ 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.

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).

Installing Debian from a USB Flash Disk

Sunday, May 4th, 2008

It was time for a fresh install of Debian on my ThinkPad X31. After 3 years of filling it up with random programs and university related stuff I felt this was the easiest path to a nice clean, fast system. I was also at a point where I felt comfortable in totally obliterating my Windows partition (which I never used) which had been sitting there as a kind of security blanket.

Anyway, for those that don’t know, the X series of ThinkPads are the ultra-portable models and in most cases come with no optical drive (unless you have the docking station). Previously I had used a USB based DVD drive to install the OS’s on it, but that was currently in use on another system (and installing from a flash disk did seem like a slightly nicer solution).

Getting Started

All we really need to get going is a flash disk (anything from 256MB and up should do), a network connection and an existing Linux system. As I was using the netinst ISO (160MB) most of the OS will be downloaded over the network after the initial system has been installed. The other point to note is (because we are using the easy way), everything on the flash disk will be wiped so double check it and backup if necessary.

Getting the files

There are only two files that we need, both can be found from http://www.debian.org/distrib/netinst.

  • debian-XXXX-i386-netinst.iso
    This can be found by clicking on your architecture type (i386 for most) in the Small CDs section (replace XXXX with the current version).
  • boot.img.gz
    This can be found by clicking on your architecture type in the Tiny CDs, floppy disks, USB sticks, etc section. You then need to navigate to the hd-media folder.

Setup the flash disk

So now we need to setup our flash disk (remember, EVERYTHING WILL BE WIPED!!). Insert the flash disk and determine its location. The easiest way to do this is to execute ls /dev/sd* before and after you insert the disk and check what drive appears, or alternatively, a few seconds after plugging in, execute dmesg | tail. For me it was /dev/sdb. Now we need to put the boot image on the disk, this is done by executing:

zcat boot.img.gz > /dev/sdb

(zcat is a nice little program that rolls gzip and cat into one)
Once that’s done, we need to copy the ISO over to the disk as well. You might need to mount the disk if it isn’t done for you automatically. This can be done by executing:

mkdir /mnt/sdb
mount /dev/sdb /mnt/sdb

and then

cp debian-40r3-i386-netinst.iso /mnt/sdb

(Make sure you adjust for your version, architecture and disk location)

Boot Away

We are now all set to do the install. Just plug in your flash disk before turning on, and select it as the boot device when booting up. Make sure you have your network cable plugged in so you can get more than a very basic system installed. You now also have a convenient rescue and recovery tool.