Ubuntu Chronicles Dapper

From Some Wiki
Jump to: navigation, search

If you are looking for the latest version of this document, see Ubuntu Chronicles Intrepid.

Contents

About this page

Note: a lot of this stuff is now quite outdated...

I have taken the plunge (on 01/10/2006) and created a dual boot system on my trusty Dell Inspiron 5150 laptop, with Windows XP Pro and Ubuntu Breezy 5.10. (This page has now been updated for Ubuntu Dapper 6.06 LTS.) After I tried Ubuntu on the LiveCD and found that all the hardware works, it was only a matter of time. :) This is where I will document my experiences playing with Ubuntu Linux. I will post tips and tricks that I have had to use to get it to do what I want.

Sometimes these tips will be taken directly from ubuntu forums or wiki - but I will repost the essential steps so that I do not forget them or lose them if the original source pages disappear.

Also check out my Ubuntu Forums FAQ - a list of the most frequently asked questions on the forums, and their answers of course.

Setting up the dual boot system

Here is the basic overview of how to set up your dual boot system.

  • You will have to install the Windows part first, because Windows wipes the MBR (master boot record), so that if you install it second, you will not be able to boot ubuntu (without taking the trouble to fix the mbr again).
  • When installing windows XP (this is what I was installing), use the Windows partition editor to create three partitions - one for the Windows install, one for the Ubuntu install, and one more as a shared data drive.
  • I have a 40g hard drive on my laptop, so I allocated 10g to Windows, 10g to Linux, and another 20g to the data drive.
  • Choose NTFS file system format for your Windows partition and install Windows on it.
  • Then, install Ubuntu to the second partition.
  • When the Ubuntu partition editor starts up, delete the 10g Ubuntu partition that you created, and then tell the partition editor to "automatically partition this space". This will automatically create a primary bootable ext3 filesystem as well as a swap partition.
  • Then you can tell the partition editor to format the data drive as Fat32, and set a mount point for it (I chose /data).
  • When Ubuntu later on asks you if you want to install GRUB (the boot loader) to the MBR, say yes (if it properly detects the windows install).

And there you are. :)

A few notes about this process:

  • The separate data drive is required since Windows cannot read ext3, and Linux cannot reliably read/write to NTFS. Now, you could just format everything with Fat32, but it lacks a lot of nice things that NTFS and ext3 have. Not to mention that Ubuntu refuses to install on Fat32. :)
  • Do not forget to back up all your files and data. Specifically, don't forget the application data such as your firefox and thunderbird application profiles, gaim profile, and other things like that.

If you want a more detailed step-by-step guide on how to set up your dual boot (with screenshots and everything), try this link.

Basic Ubuntu Usage Tips

User privileges and editing files

By default in ubuntu you are set up to be a regular user, not an administrator. The root user is disabled by default. So to edit any system files, you have to use the command "sudo" (which stands for "switch user do" or "super user do", depending on where you look). To use this command simply prepend it to whatever other command you are issuing. Probably the most common usage is to edit system config files. For example, if you want to edit /etc/hosts, you would issue this command:

 sudo gedit /etc/hosts

You will be asked for your password (your user password, not the root password - since root user is disabled, there is no root password), before the command is executed. For greater detail and an excellent tutorial on this issue, see this page on the Ubuntu wiki. Whenever you edit a config file or any other file outside your home directory, you will generally have to use sudo.

Tip: Run something as root without entering password

If you want to be able to run some particular program as root without having to enter your password (for example, if you want some root-only program to automatically start up on session startup, but don't want to enter the password every time it does), you can issue the following command from terminal:

 sudo visudo

and then add this line to the end:

 $username        ALL=(ALL) NOPASSWD: /usr/bin/program_name

Save and exit, and now you can run your program with sudo without entering password. (Of course, replace "$username" with your username, and replace /usr/bin/program_name with the full path of the program you want to run.)

For more details, you can refer to the (somewhat confusing) manual page for the sudoers file, by running command "man sudoers" from a terminal.

Tip: Using sudo with pipes and redirects

If you are trying to do something with sudo that involves a pipe (send output of one program to the input of another) or a redirect (send output of a program to a file), you will discover that it does not quite work. For example, running

 sudo foo | bar
 sudo foo1 > bar1

will result in bar running as regular user, and in bar1 being written to as regular user. So what do you do? For the pipe case, the solution is intuitive:

 sudo foo | sudo bar

will do the trick. For the redirect, you will have to trick it by using dd to write to disk as root, as follows:

 sudo foo | sudo dd of="bar"

(This tip sourced from here.)

Restarting X

To restart X, just log off, and press Ctrl-Alt-Backspace at the login screen. This will kill X (the GUI), and it will automatically restart.

Killing a hung application

If an program you are running is hung up, how do you kill it? Well, there is always the time-honored commandline way of killing the process with the "kill" command... Ubuntu provides a few more "user friendly" ways.

  • You could add a "Force Quit" applet to your panel (just right click on the top or bottom taskbar, choose "add to panel", and choose the force quit applet from the list), and then use it to terminate the offending program.
  • You could open the system monitor (Applications>System Tools>System Monitor) and right click on any process and choose "Kill".

Restarting Gnome Panel

The Gnome Panel is the thing that provides the top and bottom "taskbars", with your menus, and window lists, and "system tray" (to use some MS Windows terminology). Sometimes something goes wrong with it, or you need to refresh the menus with new entries, etc. How do you restart it? Simple: open up a terminal, and issue the following command:

 killall gnome-panel

Installing Applications

The easiest way to install applications in Ubuntu is to use the Synaptic Package Manager (which you can find in the menu in System>Administration>Synaptic Package Manager). This is the first place to go when you are looking for a program. Do not fall into the old Windows ways of going on the web and looking for an installer - most of the apps you will ever need are available in the Ubuntu package repositories. (See the section on repository configuration to really add some variety to Synaptic.) For an excellent visual guide to all the different ways of installing software on ubuntu, check this out.

System Configuration

Mounting drives and /etc/fstab

You can mount (dismount) drives and partitions with the mount (umount) command, from the commandline. If you want to have something mounted at boot time automatically, you have to add an entry to the /etc/fstab file. To edit, issue "sudo pico /etc/fstab". Here are some custom entries that I have in my /etc/fstab:

 /dev/hdc5       /data           vfat    defaults,sync,uid=1000,umask=0077    0       0
 /dev/hdc1       /mnt/win        ntfs    ro,nls=utf8,uid=1000,umask=0277    0       0

The /data drive is my FAT32 data drive, and the /mnt/win is my Windows install drive, which is formatted with NTFS. Note some important options here:

  • uid=1000 - this sets the owner of the files to my username (whose user id happens to be 1000 - this is the default first user id in Ubuntu)
  • sync - this makes the system write the data to disk at once (synchronously), rather than have the I/O buffered. async (asynchronously - the default state) increases speed, but since the fat32 filesystem has no journal, it can lose data if you have to hard-reset the system, resulting in filesystem corruption. Thus I recommend that you mount your fat32 filesystems with the sync option.
  • umask=0077 - this sets the default permissions for the files to full access for my username, and no access for everyone else. Umask is kind of the opposite of the chmod permissions ("man chmod" for help on chmod and permissions), as in, the files will have permissions of "7777 - umask", subtracting individual digits.
    • Note that FAT32 does not support unix-style permissions, so all the files on the drive will have the same permissions, as set here with the umask. You will not be able to change permissions on individual files with the chmod command. (Well, you might, but everything will revert back upon reboot.)
  • umask=0277 - notice this different umask for the NTFS partition - this gives my username the right to read the files/dirs, but nobody has permissions to write to the filesystem. This is because Linux drivers do not support writing to NTFS - if you do, you can screw up your Windows partition, so don't do it.
  • ro - this means "read only". Given the umask we set (one item above), it is probably redundant, but I have it here anyway just in case. :)
  • nls=utf8 - sets the character set for converting and displaying file names ("man mount" for more info)

For a detailed explanation of all the possible mount options in fstab, check out this excellent article.

You want to make sure that you are using the correct device for your drives. I know mine are /dev/hdc5 and /dev/hdc1. You can check where yours are if you fire up System>Administration>Disks from the Ubuntu menu, or issue command

 sudo fdisk -l

to list all partitions on all disks.

Now that you have found where your partitions are, and set your options in /etc/fstab, you can dismount and remount the /data drive (as you remember I had set it to mount by default during the install - if you have not, then you have to mkdir the /data directory at this point), and also mount the /mnt/win drive (after you create the actual /mnt/win directory). To do this, issue the following commands:

sudo umount /data
sudo mount /data
sudo mkdir /mnt/win
sudo mount /mnt/win

Ubuntu Repositories and sources.list

By default the Synaptic Package Manager (a nice GUI frontend to apt-get) comes with a fairly restricted collection of package repositories. First thing you might want to do is open up Synaptic, then through the menu go to Settings>Repositories, click the Add button, check the two checkboxes next to "Community Maintained (Universe)" and "Non-free (Multiverse)", and hit OK. This will vastly increase the amount of packaged software available to you.

Another thing you might want to do is check out the online sources.list generator. It will let you select various repositories for your sources.list. Once you get the output, simply replace the contents of your /etc/apt/sources.list file with it (have to do it as root, with sudo, of course).

Or, you can just use my sources.list (as generated by the above-mentioned generator), which is posted here (this one is for Ubuntu Breezy, 5.10. The Dapper 6.06 sources.list is below):

# Automatically generated sources.list
# http://www.ubuntulinux.nl/source-o-matic
#
# If you get errors about missing keys, lookup the key in this file
# and run these commands (replace KEY with the key number)
#
# gpg --keyserver subkeys.pgp.net --recv KEY
# gpg --export --armor KEY | sudo apt-key add -

# Ubuntu supported packages (packages, GPG key: 437D05B5)
deb http://us.archive.ubuntu.com/ubuntu breezy main restricted
deb http://us.archive.ubuntu.com/ubuntu breezy-updates main restricted
deb http://security.ubuntu.com/ubuntu breezy-security main restricted

# Ubuntu supported packages (sources, GPG key: 437D05B5)
deb-src http://us.archive.ubuntu.com/ubuntu breezy main restricted
deb-src http://us.archive.ubuntu.com/ubuntu breezy-updates main restricted
deb-src http://security.ubuntu.com/ubuntu breezy-security main restricted

# Ubuntu community supported packages (packages, GPG key: 437D05B5)
deb http://us.archive.ubuntu.com/ubuntu breezy universe multiverse
deb http://us.archive.ubuntu.com/ubuntu breezy-updates universe multiverse
deb http://security.ubuntu.com/ubuntu breezy-security universe multiverse

# Ubuntu community supported packages (sources, GPG key: 437D05B5)
deb-src http://us.archive.ubuntu.com/ubuntu breezy universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu breezy-updates universe multiverse
deb-src http://security.ubuntu.com/ubuntu breezy-security universe multiverse

# Seveas' packages (packages, GPG key: 1135D466)
deb http://mirror2.ubuntulinux.nl breezy-seveas all

# Seveas' packages (sources, GPG key: 1135D466)
deb-src http://users.lichtsnel.nl/~seveas breezy-seveas all

# Ubuntu backports project (packages, GPG key: 437D05B5)
deb http://us.archive.ubuntu.com/ubuntu breezy-backports main restricted universe multiverse

# Ubuntu backports project (sources, GPG key: 437D05B5)
deb-src http://us.archive.ubuntu.com/ubuntu breezy-backports main restricted universe multiverse

Bear in mind that the sources.list here is localised for the USA. If you are outside the US, you should look at alternative mirrors of the files. (I.e. change the "us" at the beginning of each URL to the code for a country closer to you. The sources.list generator mentioned above will ask you for your country code, so you don't have to do it manually if you don't want to.)

If you have added the Seveas repository (4th and 3rd from the end items in my sources.list above), you will need to import the corresponding GPG key for it, so that Synaptic can verify package signatures. You do that by following the instructions at the top of my sources.list. Namely, you execute the following two commandlines:

 gpg --keyserver subkeys.pgp.net --recv 1135D466
 gpg --export --armor 1135D466 | sudo apt-key add -

(note that there is a dash at the end of the second line)

And here is my Dapper sources.list, for reference:

# Ubuntu supported packages (packages, GPG key: 437D05B5)
deb http://us.archive.ubuntu.com/ubuntu dapper main restricted
deb http://us.archive.ubuntu.com/ubuntu dapper-updates main restricted
deb http://security.ubuntu.com/ubuntu dapper-security main restricted

# Ubuntu supported packages (sources, GPG key: 437D05B5)
deb-src http://us.archive.ubuntu.com/ubuntu dapper main restricted
deb-src http://us.archive.ubuntu.com/ubuntu dapper-updates main restricted
deb-src http://security.ubuntu.com/ubuntu dapper-security main restricted

# Ubuntu community supported packages (packages, GPG key: 437D05B5)
deb http://us.archive.ubuntu.com/ubuntu dapper universe multiverse
deb http://us.archive.ubuntu.com/ubuntu dapper-updates universe multiverse
deb http://security.ubuntu.com/ubuntu dapper-security universe multiverse

# Ubuntu community supported packages (sources, GPG key: 437D05B5)
deb-src http://us.archive.ubuntu.com/ubuntu dapper universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu dapper-updates universe multiverse
deb-src http://security.ubuntu.com/ubuntu dapper-security universe multiverse

# Ubuntu backports project (packages, GPG key: 437D05B5)
deb http://us.archive.ubuntu.com/ubuntu dapper-backports main restricted universe multiverse

# Ubuntu backports project (sources, GPG key: 437D05B5)
deb-src http://us.archive.ubuntu.com/ubuntu dapper-backports main restricted universe multiverse

Five (5) Button mouse

It was fairly simple to get the two extra buttons on my MS Intellimouse Explorer to get recognized. This page spills the beans:

Edit /etc/X11/xorg.conf, and

Replace:

 Section "InputDevice"
   Identifier "mouse.usb"
   Driver "mouse"
   Option "CorePointer"
   Option "Device" "/dev/input/mice"
   Option "Protocol" "IMPS/2"
   Option "Emulate3Buttons" "YES"
   Option "ZAxisMapping" "4 5"
 EndSection

With:

Section "InputDevice"
       Identifier      "Configured Mouse"
       Driver          "mouse"
       Option          "CorePointer"
       Option          "Device"                "/dev/input/mice"
       Option          "Protocol"              "ExplorerPS/2"
       Option          "Buttons"               "7"
       Option          "ButtonMapping"         "1 2 3 6 7"
       Option          "ZAxisMapping"          "4 5"
       Option          "Emulate3Buttons"       "false"
EndSection


Worked like a charm, after restarting X.

Note that the Identifier line could be different. Mine, for example, says "Configured Mouse". But this is just a label, don't worry about it. Just find the correct device based on driver and protocol.

Synaptics Touchpad

The touchpad is working perfect with the default install, with side scrolling, tapclick, and everything. Some people (not me) do not like the tapclick feature, however. It seems that Ubuntu uses this driver for synaptics, and on this page it mentions all the various touchpad features that are supported, as well as how to turn off tapclick (also know as tap-to-click). Specifically, you add the line

 Option "MaxTapTime" "0"

to your /etc/X11/xorg.conf file, to the section that looks like

 Section "InputDevice"
      Identifier      "Synaptics Touchpad"
      Driver          "synaptics"
      Option          "SendCoreEvents"        "true"
      Option          "Device"                "/dev/psaux"
      Option          "Protocol"              "auto-dev"
      Option          "HorizScrollDelta"      "0"
 EndSection

so that it becomes

 Section "InputDevice"
      Identifier      "Synaptics Touchpad"
      Driver          "synaptics"
      Option          "SendCoreEvents"        "true"
      Option          "Device"                "/dev/psaux"
      Option          "Protocol"              "auto-dev"
      Option          "HorizScrollDelta"      "0"
      Option          "MaxTapTime"            "0"
 EndSection

That will disable tapclick for you. (May have to restart X for that to take effect).

Another interesting thing: I discovered that two-finger tap will make a middle mouse button click, and a three finger click will make a right mouse button click. Cool :)

Suspend to memory

Breezy (5.10)

Edit the file /etc/default/acpi-support and uncomment the second line (it looks like this:)

#ACPI_SLEEP=true

(you comment/uncomment things by putting in/removing the # character.) Then, you want to restart the acpi daemon to load the new settings. You do this by issuing the following:

sudo /etc/init.d/acpid restart

The suspend shortcut (Fn + Esc) does not work, and I have not been able to make it work. So I did the next best thing - I went in System>Preferences>Keyboard Shortcuts, and set up a shortcut for the "Sleep" function to be (Ctrl + Esc). That is close enough to (Fn + Esc) for my purposes. :) You could also activate suspend through the menu, by going System>Log Out, and choosing the "Suspend the Computer" option.

To get back out of suspend, just press the power button, or close and open the lid (it is set to automatically wake up on lid open).

Dapper (6.06)

Under Dapper, I have chosen to install the proprietary ATI driver (package xorg-driver-fglrx). This has required some more extensive modifications to the /etc/default/acpi-support config file. My current file contents are as follows:

# Uncomment the next line to enable ACPI suspend to RAM
ACPI_SLEEP=true

# Comment the next line to disable suspend to disk
ACPI_HIBERNATE=true

# Change the following to "standby" to use ACPI S1 sleep, rather than S3.
# This will save less power, but may work on more machines
ACPI_SLEEP_MODE=mem

# Add modules to this list to have them removed before suspend and reloaded
# on resume. An example would be MODULES="em8300 yenta_socket"
#
# Note that network cards and USB controllers will automatically be unloaded
# unless they're listed in MODULES_WHITELIST
MODULES=""

##
# Add modules to this list to leave them in the kernel over suspend/resume
MODULES_WHITELIST=""

##
# Should we save and restore state using the VESA BIOS Extensions?
SAVE_VBE_STATE=false

# The file that we use to save the vbestate
VBESTATE=/var/lib/acpi-support/vbestate

##
# Should we attempt to warm-boot the video hardware on resume?
POST_VIDEO=false

##
# Save and restore video state?
#SAVE_VIDEO_PCI_STATE=true

##
# Should we switch the screen off with DPMS on suspend?
USE_DPMS=false

# Use Radeontool to switch the screen off? Seems to be needed on some machines
# RADEON_LIGHT=true

##
# Uncomment the next line to switch away from X and back again after resume.
# This is needed for some hardware, but should be unnecessary on most.
DOUBLE_CONSOLE_SWITCH=true

# Set the following to "platform" if you want to use ACPI to shut down
# your machine on hibernation
HIBERNATE_MODE=shutdown

# Comment this out to disable screen locking on resume
LOCK_SCREEN=true

# Uncomment this line to have DMA disabled before suspend and reenabled
# afterwards
# DISABLE_DMA=true

# Uncomment this line to attempt to reset the drive on resume. This seems
# to be needed for some Sonys
# RESET_DRIVE=true

# Add services to this list to stop them before suspend and restart them in
# the resume process.
STOP_SERVICES="mysql "

# Restart Infra Red services on resume - off by default as it crashes some
# machines
RESTART_IRDA=false

# Switch to laptop-mode on battery power - off by default as it causes odd
# hangs on some machines
ENABLE_LAPTOP_MODE=false

Then, I also made a change to /etc/acpi/wireless.sh (because i have Intel Pro Wireless 2200bg [ipw2200] wifi - you do not need to do this if you don't have it):

9c9 
< echo -n 2 > $DEVICE/device/power/state; 
--- 
> echo -n 3 > $DEVICE/device/power/state;

(this means replace "echo -n 2" with "echo -n 3")

Once you do this, restart acpid to reload the settings by issuing command:

sudo /etc/init.d/acpid restart

or just reboot.

For more information and discussion, see this UbuntuForums thread.

Multiple Wireless Profiles

Breezy (5.10)

The default wireless config only handles one wireless profile at a time. Since my laptop moves around between school and home, I wanted to set it so that it can automatically connect to one of a couple profiles. I have tried the wifi-radar package, but that acted all screwy, and sometimes prevented the wireless card from connecting at all.

Then I tried the promising network-manager package. That worked well with establishing the connection, but it installs a local bind daemon as a caching server, and that has its problems. First, that means you are running a world-exposed service which you do not really need - providing a potential avenue for exploits (though if you have it firewalled off, it does not really matter.) Second, and more importantly - it screws with your dns lookups - they sometimes just fail for no reason. So network-manager was a no-go as well, and I uninstalled it.

Then, I found a customized network-manager package, on this page, which removes the bind dependency. I installed the three packages provided on that page (network manager, libnm-glib, and dhcdbd), and the network manager works excellent! Not only that, but it also automatically chooses between wired and wireless connections, as well, so it will switch over to using the wired when it is available, and automatically fall back on the wireless once you unplug it. Great stuff.

I am mirroring these packages here, just in case they disappear from the original location.

To install these, just download them to your computer, then open up a terminal, cd to the directory where you stored these, then install them one by one with the command

 sudo dpkg -i <packagename>

where you replace <packagename> with the actual filename of your packages.

To start using NetworkManager, just run the program "nm-applet" from a terminal - it will show up in your gnome-panel. To make it show up every time you boot, add it to your session startup (go to System>Preferences>Sessions, go to the "Startup Programs" tab, and add nm-applet there.

Dapper (6.06)

Dapper has NetworkManager in the default repositories. So just install package network-manager-gnome and you are good to go. (Might have to manually add "nm-applet" to your startup programs under System > Preferences > Sessions, I do not recall whether that was done by the install or not.)

The following notes apply to NetworkManager on both Breezy and Dapper.

Further Notes about NetworkManager

If you want to modify/delete which networks NetworkManager will automatically connect to, you can see its list of preferred networks by opening up gconf (Applications>System Tools>Configuration Editor), and going to /system/networking/wireless/networks. All your preferred networks will show up there.

NetworkManager stores the wireless keys in an encrypted keyring, for security. If you want to manually manage the keys stored there, you can install package "gnome-keyring-manager", which you can then use to view/edit the keyring. To run keyring manager, either run "gnome-keyring-manager" from commandline, or go to Applications>System Tools>Keyring Manager).

Temperature and Fan Sensors

There is a nice gnome-panel applet called sensors-applet, that can display various hardware information in the panel, such as CPU temperature, Fan speed, hard drive temperature, and just about anything else you have hardware monitors for. It can read info from multiple modules. First, we have to install the sensors-applet package (and the hddtemp package, for good measure, so we can have the HD temp in the applet, too). Just find and install these packages from Synaptic.

I have a Dell Inspiron 5150 (as you already know if you read the intro), so for my sensors I have to load the i8k kernel module. (Note that the i8k module will only be useful for you if you have a Dell Inspiron Laptop. If you have something else, you might want to try the lm_sensors package.) To do that, I first tried

 modprobe i8k

but that gave me an error that it did not detect the right hardware. Next I tried

 modprobe i8k force=1

and that worked with no problems. Now, you can right click on any empty spot in your gnome panel, and select Add to panel, and choose the "Hardware Sensors Monitor". That will show the applet in your panel. Right click on the applet, and select "Preferences", select the Sensors tab, and place checkmarks next to whatever sensors you want displayed. One "folder" of sensors in the list should be called "i8k". Now, you are a proud observer of CPU temperature (and other stuff), right on your panel.

But we have to take care of one other thing before we are done. Namely, we have to make sure that the i8k module is loaded on reboot. To do that, we need to edit two files. First, we edit /etc/modules and add the line

 i8k

to the end. Then, we edit /etc/modprobe.d/aliases, and add the line

 options i8k force=1

to the end.

Now, when you reboot, the i8k module should be loaded without you having to do anything, and your sensors-applet will continue to display your information.

Setting custom temperature thresholds for your system fans

I find that my 5150 runs rather hot (the CPU fan doesn't even kick in until the temperature is 55C). That seems a little hot to me, so I wanted to have it run cooler. Now, there is a program in the i8kutils package (which was mentioned in the previous section) called "i8kfan" that can be used to manually turn the fan on and off. But that would mean I have to do it all the time and pay attention to the temp in my sensors-applet.

Luckily, there is an even better way - the same i8kutils package has "i8kmon", which can be run as a daemon (a system service), and control the fans automatically, as per your temperature settings. To do this, we first create an i8k config file, /etc/i8kmon (of course do it with sudo, since /etc is a system directory). Here are my contents of this file:

# Run as daemon, override with --daemon option
set config(daemon)      1

# Automatic fan control, override with --auto option
set config(auto)        1

# Temperature thresholds: {fan_speeds low_ac high_ac low_batt high_batt}
# These were tested on the I8000. If you have a different Dell laptop model
# you should check the BIOS temperature monitoring and set the appropriate
# thresholds here. In doubt start with low values and gradually rise them
# until the fans are not always on when the cpu is idle.
set config(0)   {{- 0}  -1  40  -1  45}
set config(1)   {{- 1}  38  50  40  50}
set config(2)   {{- 2}  45  55  45  55}
set config(3)   {{- 2}  50 128  50 128}

# end of file

The last four config lines with all the numbers set the temperature thresholds and fan speeds. Since the 5150 only has one controllable fan, and the one fan is detected as "fan2", notice the "-" for the first fan. On each line, first pair of temperatures is for when you are running on AC, and the second is when you are running on battery. For more details about the config file, see "man i8kmon".

Now, to start the daemon, just enter the command:

i8kmon

and you are good to go. Now, if you want it to be started automatically at boottime, we need to take care of another config file. First, as root, create the file /etc/init.d/i8kmon, using command

sudo nano /etc/init.d/i8kmon

and paste the following contents into it:

#!/bin/sh
#
# i8kmon 	initscript to control i8kmon daemon
#		This file should be placed in /etc/init.d, 
#		and linked to /etc/rcX.d directories using command update-rc.d
#
# Author:	nanotube <nanotube@users.sf.net>
#
# Version:	@(#)i8kmon  1.5  31-May-2006  nanotube@users.sf.net
#

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Hardware Monitoring for Dell Inspiron daemon"
NAME=i8kmon
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

# Read config file if it is present.
#if [ -r /etc/default/$NAME ]
#then
#	. /etc/default/$NAME
#fi

. /lib/lsb/init-functions

#
#	Function that starts the daemon/service.
#
d_start() {
    start-stop-daemon --start --quiet --background --make-pidfile --pidfile $PIDFILE \\
        --exec $DAEMON
}

#
#	Function that stops the daemon/service.
#
d_stop() {
    start-stop-daemon --stop --quiet --pidfile $PIDFILE
}

case "$1" in
  start)
    log_begin_msg "Starting $DESC: $NAME..."
    d_start
    log_end_msg $?
    ;;
  stop)
    log_begin_msg "Stopping $DESC: $NAME..."
    d_stop
    log_end_msg $?
    ;;
  restart|force-reload)
    #
    #	If the "reload" option is implemented, move the "force-reload"
    #	option to the "reload" entry above. If not, "force-reload" is
    #	just the same as "restart".
    #
    log_begin_msg "Stopping $DESC: $NAME..."
    d_stop
        log_end_msg $?
    sleep 1
        log_begin_msg "Starting $DESC: $NAME..."
    d_start
    log_end_msg $?
    ;;
  *)
    echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
esac

exit 0

Save and exit. Set the script to be executable with

sudo chmod 755 /etc/init.d/i8kmon

Finally, we need to update our startup directories with this new script. To do this, run command

sudo update-rc.d i8kmon defaults

And from now on, it should be started automatically on boot.

Firewall

By default ubuntu comes without a configured firewall. But the good news is, iptables (a firewall!) is already running by default. It is just set to allow everything to pass through. That's no good, is it now? You can search the web to find long and convoluted iptables config files. But here is one that I am using for my firewall.

 #!/bin/sh
 #
 # a simple iptables ruleset
 #
 
 iptables="/sbin/iptables"
 
 # flush any existing chains and set default policies
 $iptables -F INPUT
 $iptables -F OUTPUT
 $iptables -F FORWARD
 
 # set default parameters
 $iptables -P INPUT DROP
 $iptables -P OUTPUT ACCEPT
 $iptables -P FORWARD DROP
 
 # this is our main rule, to allow established connections in
 $iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
 
 # allow all packets on the loopback interface (so that gnome can function)
 $iptables -A INPUT -i lo -j ACCEPT
 $iptables -A OUTPUT -o lo -j ACCEPT

It allows you to make outbound connections, and accepts all already established connection packets. It also allows all communication on the loopback device. Make sure to let the loopback be - if you do not, GNOME will freeze on startup and shutdown, because some processes that GNOME runs apparently communicate via the loopback. When loopback is blocked, bam! dead GNOME.

If you want to allow subsequent connections in (for example, for bittorrent, or if you want to put up an ssh server or a web server, you would put in rules of the following type:

 $iptables -A INPUT -p tcp --dport 22 -j ACCEPT

where the "-p tcp" part specifies which protocol you want to pass through (for most applications you just want TCP, although bittorrent likes both TCP and UDP), and "--dport 22" specifies which port you want to allow connections on (port 22, as shown here, is the default port for SSH server).

Now, you take your nice ruleset, and save it in a file named something like "firewall.iptables", and put it in the directory "/etc/init.d". Then, you make it executable by issuing

 sudo chmod 755 /etc/init.d/firewall.iptables

and then you load it up into the firewall by executing it (again, as root, using sudo).

To make the firewall initialize by default on startup, you have to create a link to it in /etc/rc2.d directory (by default Ubuntu runs in runlevel 2). (This tip courtesy of this page). For example, you might issue the following:

 sudo ln -s /etc/init.d/firewall.iptables /etc/rc2.d/S13firewall

Alternatively (and probably more correctly), you could use the update-rc.d command to automatically create all the right links to your firewall script. For example, you might do:

 sudo update-rc.d /etc/init.d/firewall.iptables defaults 13

This will create symlinks to your firewall script in runlevels 2-5 (the "defaults").

As an alternative to all this, you could just install the package "firestarter" which will help you configure your firewall through a graphical interface. But I am a fan of the commandline.

Printer Setup

Contrary to what I expected, setting up a printer was very easy. I have an Epson Stylus C84, attached to a Netgear PS121 Wired USB print server. The manuals and the driver disks for the print server claim it only works on Windows. But, thanks to some help from this page, and of course the wonder that is Ubuntu, it was no problem.

Ubuntu already comes with CUPS (the cupsys package) preinstalled. All you have to do is choose System -> Administration -> Printing from the menu, run the "New Printer" wizard, and input the following settings:

These are the settings I used to add the Epson Stylus C84 via PS121 as a printer:

  • Printer Type: Network Printer -> UNIX Printer (LPD)
  • Host: the IP address of the print server
  • Queue: The serve name of the print server, you can get it by connecting to the IP address in a browser and looking at the Server Status page.
  • Driver: Choose the driver from the list. So happens that the Epson Stylus C84 is already in the list - no extra drivers to install!

Confirm your settings, and you will see a new printer icon. Now you can right-click on it, select properties, and send a test page to the printer. (Warning, the Ubuntu test page is very color intensive. If you want to save some ink, just print a little text file instead of the test page).

Note that by default the printer prints in color, and at somewhat high quality. I print most of my stuff at draft quality, and in black ink only. To do that, we have to change the printer properties.

  • Open up System>Administration>Printing, right click on your printer and select Properties.
  • On the first tab (General) change the Resolution item to whatever you want (I chose the lowest one, that said "Draft" in it).
  • On the Advanced tab, change the Output Mode item - I chose Grayscale.

And now, you wont be wasting any more color ink unless you want to. :) To simplify the process, so that you don't have to go through all this procedure every time you want to switch from color to grayscare, just create a duplicate printer (Select New Printer, and set it up again just as you did before), and leave the settings on high quality, color. That way, when you want to print in color, you can just select a different printer device. Nice. :)

Gnome Terminal default size

If you are running on a large screen resolution, you might want to increase the default size of the gnome terminal. I sure did. But it's not as easy as editing your terminal profile, because there is no setting there for that. Here we have to resort to using command line options.

Now, one great thing about gnome is the window placement. As in, if you open up a bunch of terminal windows on one desktop, it will automatically tile them for you, rather than have them one on top of the other. That's great. But, if your terminal window is too big to be tiled in its entirety, they will start overlapping. So we want to find the exact size of the terminal that would fit on the desktop either in duplicate (if you just want two side by side), or in quadruplicate (if you want four). Through simple experimentation, I have found that my optimal size would be 96x30, for quadruple terminals. Now, we just need to set that up. First, edit all your shortcuts to the terminal (in your applications menu, plus one directly on your panel if you have set one, plus one in your preferred applications panel), and add the option "--geometry=96x30". Now, whenever you start terminal, it will start with that size, rather than the default (smaller) size.

One thing to note is that in the case of the terminal, the geometry is specified not in terms of pixels, but in terms of characters, so do not go inputting 1000x1000 and then being surprised at how huge it turns out to be :).

Install Fonts

By default, Ubuntu comes without certain fonts that we all know and love (hate) from Windows. There is a package called "msttcorefonts" that you can install, and it will automatically download and install the free MS fonts. Unfortunately, just installing the package did not get the fonts recognized by the system. I had to go in and run some commands to update the fonts listings. Here is what I did:

 cd /usr/share/fonts/truetype/msttcorefonts
 sudo mkfontdir
 cd ..
 sudo fc-cache 

And that took care of it. You have to restart your programs before they see the new fonts, as well. This page has some more details on font installation.

Configuring Nautilus (File Manager)

View Hidden Files

Viewing hidden files in file chooser

To view hidden files in the file browser (aka Nautilus), it is easy to just go Edit -> Preferences and then select the "show hidden files" checkbox. But how to do it in the file chooser (the thing you get when, for example, you are about to upload a file on a web form and click "browse...")? The trick is simple, even though very counterintuitive - just right click on the file list, and you will get a menu, one of the items in which is "Show hidden files". See the screenshot.

Nautilus Scripts

Turns out you can use scripts to add things to your right-click menu on the desktop (and in Nautilus). To do this, create and add shell scripts to your ~/.gnome2/nautilus-scripts/ directory (By the way, '~' refers to your home directory, usually /home/username). The simplest script may be just to launch the terminal:

 #!/bin/bash
 gnome-terminal

Just create a file with the above contents in ~/.gnome2/nautilus-scripts/, name it something like "terminal", and chmod it to be executable, and now you can launch a terminal by right clicking on your desktop, and selecting "terminal" from the "Scripts" sub-menu. A couple more helpful scripts could be found in this forum thread.

Some other hard to discover features

(Why aren't these features documented anywhere?)

  • Dragging a file with middle mouse button will show a menu upon release, allowing you to select among "move", "copy", "link to" and "cancel". Similar to right-mouse drag in Windows.
  • Alt-left drag in any window will let you move that window, without having to hunt for the title bar. Just click anywhere in a window while the Alt key is pressed, and you can move the window.
  • Alt-middle drag allows you to resize a window without having to hunt for the edges of the window. Neat.
  • Alt-right click anywhere in the window will bring up the window menu (the one that is usually located by pressing on the top left corner of the title bar).
  • To add an item to your Places menu, as well as to the Places sidebar in Nautilus, navigate to that location in Nautilus, and choose Bookmarks>Add Bookmark.
  • You make the contents of a remote server (FTP, SSH, and a bunch of other protocols are supported) accessible as a simple folder on your desktop by using the File>Connect to Server menu item in a Nautilus window. It's really cool, try it!

Application Installation (and Configuration)

Generally, you can install any application through Synaptic from the Ubuntu repositories. These sections will only describe those installations that require some non-standard action to get them installed and working (most often due to them not being present in the repositories).

Install Official Mozilla Build of Firefox

The installnewfirefox.sh script has been popular enough that it has been moved off to its own site, under a new project together with the installnewthunderbird.sh script. Please check the Ubuntuzilla project site to get the latest.

Update Official Mozilla Build of Firefox

The installnewfirefox.sh script has been popular enough that it has been moved off to its own site, under a new project together with the installnewthunderbird.sh script. Please check the Ubuntuzilla project site to get the latest.

Install Swiftfox

Swiftfox makes linux builds of Firefox that are optimized for various CPU architectures. According to various testimonials, this increases the speed of the browser significantly. Additionally, if you want to install the freshest firefox on your AMD64 system, the only way to do it is to use Swiftfox, since the official Mozilla builds are only available for 32bit systems. So, there are a few reasons to give Swiftfox a try.

There are Debian packages available for Swiftfox that should work for Ubuntu. You can download one of those, and install as usual with "dpkg -i packagename.deb" command, or simply by double-clicking the .deb (Dapper and later only). There are also official swiftfox installer scripts available that you could use.

Alternatively, if for some unknown reason you don't like the .debs or the official installer, you can use the installswiftfox shell script that will automatically download and install the freshest release of Swiftfox for you. I created it in collaboration with Aysiu, who helped with testing, ideas, and motivation (and Xurizaemon helped with updates). It automatically detects the newest Swiftfox release, allows you to make a choice of CPU architecture, verifies the md5sum, and installs the Swiftfox in /opt/swiftfox. Here are the steps to take to use this script:

  • Get the script and save to your desktop as installswiftfox.sh
  • Open a terminal (how?)
  • Enter these commands:
cd Desktop
chmod +x installswiftfox.sh
./installswiftfox.sh

And, if no errors occur, your Swiftfox is ready for use!

Install Official Mozilla Build of Thunderbird

The installnewthunderbird.sh script has been popular enough that it has been moved off to its own site, under a new project together with the installnewfirefox.sh script. Please check the Ubuntuzilla project site to get the latest.

Install wxMaxima

Breezy (5.10)

wxMaxima is a GUI frontend to maxima, a nice open source computer algebra program (think mathcad or mathematica replacement). wxMaxima is not in the default repositories for Ubuntu, though, so you have to enable the breezy backports repository (see the repositories section in this document). Once you have that, find the wxmaxima package, install it, and it will automatically pull all the dependencies. You also will want to install the package maxima-share, because that contains a lot of extra functions that will come in handy (even something as basic as finding matrix eigenvalues requires maxima-share).

There are two little problems though. First, the entry for wxMaxima in the Applications menu has no icon. Trivial problem - and a trivial solution. Go to Applications>System Tools>Application Menu Editor, navigate to wxMaxima, click the icon button, and navigate to /usr/share/wxMaxima/icons, and choose the icon from that folder. Voila! :)

The other problem is that wxMaxima is not able to find its help files. This is a known bug, desrcibed here. Claims it is solved in wxMaxima 0.6.4. But what are we to do if we are stuck with the 0.6.2 from the repositories? Well, looking at the patch in that same bug report, we see that it is a simple error in the directory where it looks for the documentation. It looks for it in /usr/share/wxMaxima/, but the help files are actually in /usr/share/doc/wxmaxima/. So what do we do? It's obvious, we will copy the doc files (there is a docs.zip and an intro.zip) from one directory to the other, with the following command:

 sudo cp /usr/share/doc/wxmaxima/*.zip /usr/share/wxMaxima/

Restart wxMaxima (this step may not be necessary), and try the Help menu again (or press F1) - and it should work like a charm. :)

Dapper (6.06)

Under dapper, package wxmaxima is available in the universe repository, so all you have to do is install it with your favorite package manager from the repos.

Install R

R is an excellent statistical analysis software. There is a slightly older version of R available in the default repositories (package r-base-core), which could be just fine for you purposes. But if you want the latest version for whatever reason (and there are plenty - such as certain R CRAN packages that require latest version), it is pretty easy to do so. As it happens, the debian package for R works just fine for ubuntu (as per this mailing list thread.)

As per the R FAQ, all you need to do is add the following repository to your sources.list:

 deb http://cran.R-project.org/bin/linux/debian stable/

and then start up Synaptic, hit reload, and install r-base-core and r-recommended. To start R, simply type "R" (capitalized) in the terminal.

Install R CRAN packages

First, some packages from CRAN come in source form - to compile them you will need to install the following packages from the Ubuntu repositories (and all the necessary dependencies - Synaptic will select them for you by default):

  • g77
  • refblas3-dev

After that, if you want to install more packages for R, run R as root (because packages go into /usr directory), with command

 sudo R

and then use the built in R package installer by typing

 install.packages()

within R. Select your mirror, select your package, and off you go. :) It is not a bad idea to run

 update.packages()

first, to get the newest versions of whatever packages came with your R install, even if you don't want to install any new ones.

Install Sun Java Runtime Environment

Note: the following instructions are all for Breezy. For Dapper, package sun-java5-jre is available in the official multiverse repositories, so all you have to do is install it from the repos using your favorite package manager.

The default java environment that comes with Ubuntu is the open source GIJ. It is pretty good, but unfortunately is still missing features. Specifically, I was trying to run Pauker Flashcards, and GIJ gave me some errors and refused to run it. So it was time for the official Sun package. Unfortunately, it is not in the repositories, so you have to do some magic to install it. The ubuntu wiki page about restricted formats gives us some tips.

If you want a shortcut, scroll down to the bottom of this section and read :).

 chmod +x jre-1_5_0_06-linux-i586.bin
  • Install some packages required to create the .deb package for java (use this commandline, or use synaptic):
 sudo apt-get install fakeroot java-package java-common
  • Install the "build-essential" package too (I got some errors about absence of gcc without it. build-essential includes some important development packages, gcc among them.)
 sudo apt-get install build-essential
  • Make the .deb installer package out of the .bin file that you downloaded:
 fakeroot make-jpkg jre-1_5_0_06-linux-i586.bin

(we use fakeroot rather than sudo because otherwise the .bin package tries to write some files to some directories that we really don't want it to)

  • And now install that .deb file you just made:
 sudo dpkg -i sun-j2re1.5_1.5.0+update06_i386.deb
  • And finally, in order to actually use the sun java, use the following command to set the appropriate links:
 sudo update-alternatives --config java

(and select sun java from the list)

And that does it, now you should have sun java installed.

Sun JRE Install Shortcut

Alternatively, you can skip all those steps for making your own package, and just download the .deb package that I made for myself. Once you have it, run

 sudo dpkg -i sun-j2re1.5_1.5.0+update06_i386.deb

and then

 sudo update-alternatives --config java

and select sun java from the list of alternative java implementations.

Sun JRE Even Bigger Shortcut

If you have enabled the Seveas repository, as described in the Repositories section of this document, then you can just search for "sun" in your Synaptic, and the Sun JRE package will come up, and you can install it from there. As it happens, it is exactly the same package that I have mirrored right here. But the benefits of installing through Synaptic is that you get GPG signature validation on the package you install, and that you can completely avoid using the commandline.

Folding@Home [FAH] on a Laptop

Before you set up any distributed computing project on a computer, especially a laptop, you should make sure to set up temperature monitoring utilities so that you can make sure your machine does not die a premature death from overheating. [You should definitely see the Temperature and fan sensors section for of this document.] Once you have that done, we can proceed.

Even with a low process priority, a distributed computing client will attempt to take up all the idle CPU resources. Unlike a desktop machine, which usually has better cooling arrangements and an always-on CPU fan, a laptop's CPU fan is designed to turn on only on demand. 100% CPU load will very likely cause the CPU fan stay on all the time. Again, while this is not a problem per se, it may cause premature fan failure, so we want to avoid that. Thus, you would want to limit the CPU usage of the FAH process. The best way to do that on a linux machine is to use the cpulimit utility. So, let's set that up first.

cpulimit

On Ubuntu Edgy and later, cpulimit is available in the universe repository. So, enable that repository if you haven't already, and then just run

sudo aptitude install cpulimit

On Dapper and earlier, cpulimit is not available in the repositories, so you have to install it manually. Fortunately, that process is quite easy.

  • Get the cpulimit source archive from the cpulimit project page
  • Follow instructions on the project homepage (which basically involve extracting the archive, then running "make" to compile)

This will create the cpulimit binary, which you may want to copy to your /usr/sbin directory with the command

sudo mv cpulimit /usr/sbin/

Folding@Home Client

Now, we are up to installing the actual FAH client. Installing the console FAH client is easy - just download the latest linux executable from the FAH downloads page, and follow the instructions, more instructions, and some more instructions. All of the instructions basically boil down to: put the executable in its own directory, cd to it, then execute it from there and let it play.

The main "trick" comes in when you want to use cpulimit on the main computing process. You cannot just run the FAH binary with cpulimit, since that is not the process that takes up the CPU - it is rather one of the FAH cores that get spawned by the main FAH binary. To throttle that, we will use the PID [Process ID] feature of cpulimit. Also, since every time you launch FAH the main core will get a different PID, we have to be clever and pick it out automatically. Hence, I have created the following script that automatically picks up the PID of the running core, which is included below:

#!/bin/bash
/home/dfolkins/bin/cpulimit-1.1c/cpulimit -p `ps ax |grep -i fah |grep "RN+" |awk '{print $1}'` -l 50 &

Copy that into a text file, name it, for example, fahcpulimit.sh, place it, say, in /home/yourusername/bin directory (that's where I keep my miscellaneous scripts), and chmod it to executable with command

chmod u+x /home/yourusername/bin/fahcpulimit.sh

(obviously, replace "yourusername" with your actual username on your system) Now, to limit the CPU usage of the core process, just execute the shell script with sudo (because cpulimit likes root privileges, for the purposes of setting process priority), as follows:

sudo /home/yourusername/bin/fahcpulimit.sh

Prior to running the cpulimit script, you should have already started the FAH client, and waited for it to start the actual computing core - otherwise the cpulimit script will not be able to find the process to throttle.

Finally, note that you can safely suspend to ram and resume, without having to kill and restart your FAH processes. Not sure about suspend to disk (aka hibernate), since I do not have enough swap space to hibernate, but that should be OK just as well.

And that concludes our exciting distributed computing setup session. Enjoy your folding!

Install Azureus

Note: the following instructions are all for Breezy. For Dapper, package azureus is available in the official universe repositories, so all you have to do is install it from the repos using your favorite package manager.

Azureus is really the best BitTorrent client I have ever used. Unfortunately, it is not in the repositories. But, fortunately, it is pretty easy to get going even so. First, as it is a Java program, you need to install Sun Java (follow instructions in the section above). It will not work with the default java installation that comes with Ubuntu. Once you do that, download the latest Azureus jar (not the .tar.gz, but the .jar) file from the azureus website, and put it in your ~/bin/azureus directory (where ~ stands for your home directory.) First, you might have to create the appropriate directory. Do so with command

 mkdir -p ~/bin/azureus

Once your azureus jar file is there, download the latest stable linux SWT kit from here. Place that zip file in the same directory (~/bin/azureus), and extract it with the command

 unzip swt*.zip

Now, you are ready to try running Azureus. Try it with this command line:

 java -cp swt.jar:Azureus2.jar -Djava.library.path=. org.gudy.azureus2.ui.swt.Main

If it works (and it did for me), then you are ready to set up a shortcut in your Applications menu, so that you don't have to deal with that long java command all the time. First, we will create a simple shell script, in the same directory where you have all your azureus stuff. Open your favorite text editor (such as gedit), put the following contents into a new file:

 #!/bin/bash
 cd /home/username/bin/azureus
 java -cp swt.jar:Azureus2.4.0.0.jar -Djava.library.path=. org.gudy.azureus2.ui.swt.Main

replace username with your actual username, and save it as say, "startazureus.sh" in your ~/bin/azureus directory. Then, from a terminal, issue:

 chmod 755 ~/bin/azureus/startazureus.sh

to make the script executable. Now we are ready to set up the menu shortcut. To do that, go to Applications>System Tools>Applications Menu Editor. Select the "Internet" section, and click "New Entry" Button. Type anything in the Name and Comment fields ("Azureus" and "BitTorrent client" seem like good choices to me). In the Command box, input "home/username/bin/azureus/startazureus.sh", where you of course replace username with your own username. Click OK, close the menu editor, and now you should see a new entry in the Internet group, named Azureus. Click on it, and you will be happy to see Azureus come up. :)

Note: part of these instructions sourced from the Azureus FAQ.

Enable Downloads to FAT32 Drive

To enable downloading to a FAT32 partition with Azureus, you have to make a small configuration change. Open up Azureus, and go to Tools -> Options -> Files -> Check "Enable incremental file creation." Otherwise, if you try to set the target location to a FAT32 drive, you will get an error message and nothing will download.

Alternatively, I've found that you can get the download to start by right clicking the download, choosing "Force Re-check", waiting for the check to finish, and then re-enqueuing the download.

Sharing application profiles between two operating systems

The great thing about cross platform applications like Thunderbird and Gaim is that they can run on both windows and linux - a boon for dual boot systems such as one I have set up. The problem is to make them look at the same directory on the shared drive, so that email, chat logs, etc, is synchronized. In the end, it appears to be quite a straightforward affair.

Thunderbird

Your thunderbird profile directory, the one with all the email and settings and everything, is under WinXP usually located in

 C:\\Documents and Settings\\<Windows login/user name>\\Application Data\\Thunderbird\\Profiles\\<Profile name>\\

(See this page for details about other operating systems.) You should have backed that whole directory up before you wiped your drive, of course. Now, you want to place it on a shared drive that can be accessed from both windows and linux.

File:ThunderbirdProfileManager.jpg
Creating a Thunderbird profile

With your profile in the right place, you are ready to do the magic. The procedure is the same in both Windows and Linux. Run the thunderbird profile manager (the shortcut is usually placed in the start menu next to the regular thunderbird shortcut). This will bring up the profile manager, where you can create a profile, and point it to the directory where you stored your profile backup (by clicking Choose Folder), and make it the default profile (by selecting it). Now, when you start thunderbird, it will automatically pick up all your old emails and settings. I did have to delete my extensions directory (probably because it was a Thunderbird 1.0.2 profile, while the new version is 1.0.7) in order to make it work properly... but chances are you will not have to do that.

Here is a page with some more detail about moving your profile.

Note: to get the "mailto" links in firefox or other browser of your choice to automatically open a compose window for you, change the default mail reader in System>Preferences>Preferred Applications to

 mozilla-thunderbird -compose %s

(The default -mail switch causes the Thunderbird profile manager to pop up if an instance of Thunderbird is already running).

Gaim

With gaim, it is quite easy as well. This gaim faq page shows that the default location of the gaim profile under windows is

 C:\\WINDOWS\\Profiles\\username\\.gaim\\ (on Win ME)
 C:\\Documents and Settings\\username\\Application Data\\.gaim\\ (on Win 2k/XP)

First, of course, you have to back up your gaim profile and put it in a commonly accessible location for both of your operating systems. Then, you should modify your gaim shortcuts to add a commandline option. Under WinXP you right click on the shortcut, and select "Properties". Then you can edit the Target text box, so that it looks like this:

 "C:\\Program Files\\Gaim\\gaim.exe" -c "Path\\to\\your\\profile"

Note the exact positioning of the quotes - the path to gaim and the path to profile are in quotes, the -c command line argument is not. Also do not forget to edit both your desktop shortcut, as well as your start menu shortcut.

Under linux, you do the same thing - right click on your gaim shortcuts and add the command line argument. (To edit the shortcut in the Applications menu, use the "Applications Menu Editor" located under Applications -> System Tools.)

Calendar (Rainlendar and Evolution)

On Windows I ran this cool little desktop calendar app called Rainlendar. It is open source - but unfortunately, as of the currently latest version (0.22) the client is windows-only. So I had to find a calendar for Ubuntu+GNOME, and to find a way for it to be in sync with Rainlendar. So, let's see what we need to do.

First, in Rainlendar, go to Config -> Plugins and enable the iCalendar plugin. iCal is a popular open calendar file format, which Evolution (GNOME's calendaring app) uses by default - as do quite a few other calendars. Once you enable it, select it in the list, and click the Settings button. That will give you a dialog where you can add a .ics file. Create an empty .ics file in your shared data drive, and point Rainlendar to it. Make sure you leave it on read/write mode, so that Rainlendar can write its events and todo list to the file.

Now, you are ready to boot into linux, and fire up evolution. Evolution is a complete MS Outlook-like app, with email, contacts, and calendar. But since I am using Mozilla Thunderbird as my email client (to keep email in sync between Win and Linux), I will not be using any of those other features besides calendar. Evolution will still force you to create an "email account", which I will do by putting it some stuff. Now, you can close evolution, and open up a terminal. By default, evolution stores its calendar file in your home directory, under .evolution/calendar/local/system/ directory, in a file called "calendar.ics". Back up this file just in case, and then create a symlink to Rainlendar's .ics file and call it calendar.ics, using a command that looks like the following:

 ln -s /path/to/rainlendar/file calendar.ics

Now you can log out of GNOME, log in again, fire up Evolution, and find that it is seeing all your old Rainlendar events.

There was a problem though - somehow Evolution has copied the linked-to Rainlendar file, removed the symlink, and placed a copy in its profile directory. But... since I was not really planning on using Rainlendar in Windows anymore anyway, I didn't care, and let it be. But if you have any suggestions or ideas, feel free to let me know!

OpenOffice Tips and Tricks

Speed up Load Time

This tip will really improve the startup time of OpenOffice. Open up Writer, then go to Tools>Options>OpenOffice.org>Java, and uncheck the "Use a Java Runtime Environment" checkbox. You will notice that this makes OOo quite a bit snappier. According to this OpenOffice page, Java is really only used for the Base component, and possibly some macros, maybe? I personally find that I am not missing any useful features.

Regular Expressions and Back References

When trying to do a search and replace in OpenOffice, using regular expressions and back references, I have found that it does not work. That is, making a grouping in the Search field, and then using a back reference to it in the Replace field does not do what you would expect. Rather than replacing \\1 or \\2 with the referenced substring, it puts a literal \\1 or \\2 in there, wiping out the original string. The closest that OpenOffice comes to supporting this is the '&' character, which back references the entire matched string. Well, that's decent, but not good enough for many purposes.

Thus, what I ended up doing is using SciTE instead. This is a powerful editor with many features that ease programming tasks - and apparently also searching and replacing tasks. :) It is available as the 'scite' package in the repositories.

And of course, for complete power over your regexps, you can just whip something up quickly with perl or python - two interpreted languages that come installed with the default Ubuntu system.

Autosave

By default OpenOffice is set to Autosave your document every 10 minutes, which is a bit on the long side. To change it to a safer 5 minutes, open up Writer, and in the menu go to Tools>Options>Load/Save>General. There you will find a checkbox labeled "Save AutoRecovery information every..." and a box to enter minutes. Make sure the box is checked, and enter 5 (or whatever you like) into the text box. Click OK, of course.

Multimedia Configuration

DVD, Video, and Audio playback

By default, it seems that Ubuntu comes without decoders for DVD, mp3, and a lot of other video and audio codecs. In other words, out of the box, it will play a rare few of your media files. The Totem Movie Player and the Rhythmbox music player which come with Ubuntu fail to properly play just about anything. Well, Ubuntu Wiki Restricted Formats page shows some tricks (and more).

For DVD playback, looks like we need to get deCSS installed. We need to install the libdvdread3 package, and then run a script to install CSS:

 sudo /usr/share/doc/libdvdread3/examples/install-css.sh

To get everything else working really well, you better install MPlayer (mplayer-586 or mplayer-386 package, depending on your CPU type, just search for mplayer in Synaptic). You might also want to install VideoLan (aka VLC) media player, just in case (package wxvlc).

Both VLC and MPlayer come with quite a few codecs, but they are still frequently not enough. So, you will want to install a package containing a lot of codecs, called w32codecs. Unfortunately, you will not find this last package in the default Ubuntu repositories. To find it, you will have to add the Seveas repository to your sources.list the (see Repositories Section of this document). Once you add that repository, just search for w32codecs, and install it. This will really get your MPlayer humming. :)

Once you have your MPlayer installed, run it, right click and choose preferences, choose the Video tab, and select "Enable double buffering" and "Enable direct rendering" checkboxes, and also choose "xv" from the available drivers list. Why, use xv instead of the default x11, you ask? Well, for one - this makes the video resizing, and the "fullscreen" option work correctly. With x11, the window expands, but the video continues playing at its normal size. Also, from the words of "bennettp" on this page:

Everyone should use xv.

For the vast majority, x11 and xv will both work perfectly well; however full-screen video will be much faster with xv, since it uses hardware accelerated scaling and colourspace conversion. If you're unfortunate enough to have a card that doesn't support xv, then should you use x11.

While you are at it, you might want to install the mozilla-mplayer package, it is a plugin for firefox that will enable you to play a lot of embedded media files on the web with your firefox browser. (If you do that, you will have to change preferences for it as well, to xv and esd (right click on a window playing a video in firefox, choose preferences/configure, and you will find the settings.)

Another issue that comes up when you install mplayer is that you get the following error on startup:

 New_Face failed. Maybe the font path is wrong. Please supply the text font file (~/.mplayer/subfont.ttf).

Well, we can take care of that easily. We are going to just create a symbolic link to some other font in that location, so that MPlayer does not complain anymore. Open up a terminal and do the following:

 cd .mplayer
 ln -s /usr/share/fonts/truetype/freefont/FreeSerif.ttf subfont.ttf

And tada, no more irritating error from MPlayer.

I also installed ogle (a DVD player, package ogle-gui), as it never hurts to have another media player just in case.

And don't forget to check out the Sound section of this page to make sure all you new players play nice with your soundcard.

So far I like ogle best for DVD playback, XMMS (comes installed as a vlc dependency) for mp3 playback, and MPlayer for the playback of everything else.

Choppy DVD playback?

Well, it seems that there is still more tweaking to be done to get them DVDs to play right. This Ubuntu Wiki page tells us what's up. First, find which drive is your DVD/CD drive. To do this, run the following in a terminal:

 ls -al /dev/cdrom

and you will get output similar to the following:

 lrwxrwxrwx  1 root root 3 2006-01-25 15:31 /dev/cdrom -> hda

As you can see, my cd drive is /dev/hda. Now, you want to enable DMA on your drive, so run the following (make sure to use proper drive device, if yours is not hda):

 sudo hdparm -d1 /dev/hda

Try your playback now: should be perfectly fine, right? :) If so, now you need to set it up so that DMA is on at boot time by default. edit the file /etc/hdparm.conf, by running

 sudo gedit /etc/hdparm.conf

and add the following lines to it (again making sure you are using the correct device):

  /dev/hda {
  dma = on
  }

And you are all set.

Sound problems

Setting up Sound daemons (and XMMS, VLC, MPlayer, etc.)

Only one application can use the soundcard at a time in linux. To solve this problem, there are sound daemons that bind to the card, and then allow other applications to bind to them and output sound data, thus providing for 'software sound mixing'. These daemons are ALSA (Advanced Linux Sound Architecture) and ESD (eSound). By default, Ubuntu seems to be using ESD.

But sometimes, sound would just go away, or an application such as XMMS would throw an error saying something else is using the soundcard. So, what gives? Turns out, the problem is that some applications try to use the sound device directly (or in other words, using the Linux OSS driver), ignoring the running sound daemon. They steal the soundcard, and now nobody else can use it. To solve this problem, you want to configure your various media players to use the sound daemon rather than use the sound device directly.

For XMMS, right click the player and choose Options > Preferences, and on the first tab (named Audio I/O plugins), toward the bottom, in the output plugin dropdown, select "eSound Output Plugin".

For VLC, first, make sure you have the package "vlc-plugin-esd" installed. Then, select Settings > Preferences, then expand the Audio menu, and select Output Modules. Click the 'Advanced options' button on the right bottom corner of the window - this will display the Audio output module dropdown in the main part of the window. Select "EsounD audio output" in that dropdown, and save changes.

For MPlayer, right click and choose Preferences. In the first tab (called Audio), select "esd EsounD Audio Output", and click OK.

If you have installed any other media players, make sure to do the same. Now, your applications will stop hijacking your sound card, and everything will be nice. Just to make sure you are all set - you can try playing something in say, VLC, and at the same time, play something in XMMS - if all is good, you should hear both of them coming through at the same time.

The default players that come with Ubuntu (Totem, Rhythmbox, etc), are native GNOME applications, so they use the ESD by default, and you do not have to worry about them.

Sound, Firefox, and Flash

There were a couple of things that I needed to do to get sound working properly from firefox. First, thanks to this page, I edited the file

 /etc/mozilla-firefox/mozilla-firefoxrc

and changed the line

 FIREFOX_DSP="auto"

to

 FIREFOX_DSP="none"

That made sound work just fine when playing flash from the web, but when playing a .swf file from the harddrive, there was still no sound. This is where the trick from this Ubuntu forum post came in handy. It seems that the flash plugin looks for the ESD socket in /tmp/.esd/socket, but Ubuntu creates that file in /tmp/.esd-<uid>/socket (where <uid> is your user id). Since the /tmp directory gets cleaned on every reboot, we need to set up a boot script that will create the required path for the esd socket. We do the following:

  • Create a file named "flash-sound" (or anything else you like) in /etc/init.d
  • Put the following contents in that file:
 #!/bin/sh
 #Create symlink under /tmp for esd to get flash player working 
 mkdir /tmp/.esd 
 ln -s /tmp/.esd-1000/socket /tmp/.esd/socket

(Your default uid under Ubuntu is 1000. If yours is different, put yours there.)

  • Make the script executable:
 sudo chmod 755 flash-sound
  • Let the system know to execute it at startup:
 sudo update-rc.d flash-sound start 51 S .

(don't miss the dot "." at the end of the line above)

And that does it. Now, you can either reboot and make sure that everything works, or just execute the commands from the script on the commandline as root (the mkdir and the ln -s lines), if you do not want to reboot.

Non-native applications and eSound

As you may have read in the previous sections about sound, we need to set our applications to use the eSound daemon. Unfortunately, not all applications even support using ESD, and for those cases, there is this workaround (thanks to this page.

First, you will want to install the package esound-clients. This will install a number of little ESD-related programs, among them esddsp. To run an application that does not support ESD with esd, you can run it from the terminal by prefixing it with esddsp. For example, to run vectoroids (an Asteroinds clone) with sound, use the command:

 esddsp vectoroids

and you will hear it work.

Notably, one of the applications that do not support ESD is Mozilla Thunderbird, so you may want to edit your Thunderbird shortcuts to include esddsp.

Command Line Tips and Resources

Removing a large number of files

It so happened that I had to remove a really large number of files from a directory (a botched un-rar operation created a bunch of bogus files). Running rm from commandline with a wildcard, however, produced the following output:

 /bin/rm: Argument list too long.

Running

 find . -name 'blah*' -exec rm -rf {} \\;

produced a similar error for find. The solution (courtesy of this page) lies in the wonders of pipes. This command:

 find . -name 'blah*' -print0 | xargs -0 rm -rf

did the trick without complaining (because it sends the results of find to rm one by one, rather than in one large batch).

Other Command Line Resources

There are, as you might imagine, quite a lot of resources on the web about learning linux, learning the command line, shell scripting, and the like. Here I will list some links that you will find quite helpful if you are looking to learn your way around the command line.

Extra packages installed

While Ubuntu comes with quite a lot of software already preinstalled, there are also quite a few packages I have found useful and installed "after market", using the wonderful Synaptic package manager. This is a list of them so that I do not forget.

Multimedia, Video, Audio, Graphics

  • wxvlc (VideoLAN media player), plus:
    • vlc-plugin-esd for eSound support
  • mplayer-586 (media player) plus:
    • mozilla-mplayer (plugin for firefox to play embedded multimedia)
    • w32codecs (a package with just about any codec you need to play any video/audio file - available in Seveas repository)
  • ogle-gui (dvd player)
  • totem-xine (this replaces the default gstreamer totem, which can't play almost any file by default)
  • libdvdnav4, libdvdplay0, libdvdread3, libdvdcss2 (a bunch of stuff for playing DVDs)
    • Note that libdvdcss2 not available from default repositories - you have to enable the Seveas repository to find that package (Instructions here), or follow the instructions in the DVD Playback section.
  • gnomebaker (cd burner)
  • feh (powerful image viewer)
  • dia (diagram maker/editor)

Networking and Communications

  • gFTP (graphical ftp/sftp client)
  • openssh-server (ssh server)
  • proftpd (ftp server)
  • mozilla-thunderbird (email reader), (Note: this has been replaced with the official thunderbird version because the repositories version is now very out of date. See install script here) plus:
    • mozilla-thunderbird-enigmail (email encryption)
    • mozilla-thunderbird-offline (offline support)
    • moztraybiff (new mail notification in system tray - not in repositories, download the .xpi from here
    • withAttach extension (reminds you if it looks like your email should have an attachment)
  • elinks (featureful text-mode web browser)
  • gaim plugins (gaim itself comes with Ubuntu by default):
    • gaim-encryption
    • gaim-otr
    • gaim-extendedprefs
  • liferea (nice RSS feed reader)
  • dillo (a cool, fast, lightweight browser, just in case you need one)
  • network-manager-gnome (to automatically switch wireless networks. you don't need it if you are using a desktop.)
    • Note: For Breezy 5.10: NOT the repositories version. See info here on how to install a good version of network-manager.

Coding/Hacking

  • scite (powerful coding text editor)
  • ghex (hex editor)
  • ethereal (network packet analyzer)
  • etherape (network monitor)
  • devhelp (documentation browser)

System Utilities

  • sysv-rc-conf (easy runlevel startup scripts configuration)
  • checkinstall (use instead of "make install" when building source packages, to enable clean uninstall with synaptic)
  • smartmontools (monitor the health status of your hard drives using SMART technology) Tutorial
  • build-essential (gcc, make, and other tools for building things from source)
  • filelight (gui representation of disk usage - very cool, but slow)
  • i8kutils (to monitor and control CPU temperature and fans on Dells)
  • gnome-keyring-manager (if you want to see what's in your keyring, e.g. for wireless profiles from network-manager)
  • htop (a much better terminal-based process viewer than the default 'top')

Other Utilities

  • revelation password manager (securely manages your passwords)
  • emacs + auctex + preview-latex + tetex + etc (a bunch of stuff to create LaTeX documents - all necessary dependencies are installed automatically if you just select preview-latex for installation, and accept all the dependencies that Synaptic offers you. just make sure to also select tetex-doc - trust me, it will come in handy.)
  • kile (another latex editor, built for kde. i think i am liking it better than emacs+auctex...)
  • xpdf-reader (for those pdf files that the default document viewer cannot handle)
  • kpdf (an even better pdf reader.)
  • msttcorefonts (some free ms fonts like times new roman, courier, etc, that do not come with Ubuntu by default)
  • pdftk (some basic editing of pdf files)
  • abiword (a lighter implementation of a .doc compatible word processor)
  • gnumeric (a lighter implementation of a .xls compatible spreadsheet)
  • bzr (version control system - good idea to use for those long documents you are writing, just in case you ever want to go back to an older revision - not to mention if you do any programming.)
  • wordnet (a good offline dictionary)
  • JabRef (bibliography manager - not in the repositories)

Mathematics

  • wxmaxima (computer algebra system, will install the dependency "maxima")
  • R Project for Statistical Computing (package r-base-core)
    • (Note that the repositories version of R is getting out of date, so add the official R repository and install from there.)
    • I use the faster mirror for the R repository, which also hosts packages specifically for ubuntu. The following is my sources.list line:
deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu dapper/

Other potentially useful packages

These are some packages that I have come across that seemed like they could be useful/cool, but I did not install because I did not need them.

  • sleepd (make comp go to sleep after a period of inactivity)
  • gnome-power-manager (tweak various power-related events)
Personal tools