Ubuntu Chronicles Intrepid

From Some Wiki
Jump to: navigation, search

Contents

About this page

This is the update of the famed Ubuntu Chronicles for Dapper and Breezy for Ubuntu Intrepid and Jaunty. I have taken out a lot of stuff that's no longer valid, updated items that needed updates, and added a few more sections.

I'm still using my old Dell Inspiron 5150, which is 6 years old by now (bought in the summer of 2003), and besides having had to replace the motherboard, the video card, and the LCD backlight CCFL over the years, it's still going strong. Keeping tabs ot the temperature and blowing out the heatsink with compressed air once in a while helps, too.

Some major changes: I no longer do a dual-boot, instead I run WinXP in a virtual machine, VirtualBox, to be precise.

A lot of 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 Windows in a Virtual Machine

I have found that having Windows in a VM is a lot more useful than a dual boot, since you don't have to reboot to get Windows, you just fire up a VM, and there it is. I prefer VirtualBox, so that's what these instructions will be about.

First, there is a choice to make. VirtualBox OSE ("Open Source Edition") does not support USB passthrough. USB passthrough allows your windows install inside the VM to see the attached USB devices. If that is not important to you, you can go for VirtualBox OSE. If at some point later you find that you need this feature, you can always install the non-OSE edition on top, which is a quick and painless process.

VirtualBox OSE is in the Ubuntu universe repository, so all you need to do to install it is simply find the virtualbox-ose package in Synaptic and install it, or from the terminal

sudo apt-get install virtualbox-ose

The install of non-OSE edition involves only one extra step - and that is the addition of the official VirtualBox repository to your software sources. The full detailed instructions are available here on virtualbox.org. Briefly:

  • Add the repository to your sources.list.

Start the editor from the terminal:

 sudo nano /etc/apt/sources.list

Paste in the appropriate line. For intrepid, it would be this:

deb http://download.virtualbox.org/virtualbox/debian intrepid non-free
  • Add the repository signing key to your apt keyring, run this command:
wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O- | sudo apt-key add -
  • Install the appropriate virtualbox package, along with the dkms package:
apt-get install virtualbox-3.0 dkms

(check the website for latest available version of virtualbox.)

  • Finally, you should add yourself to the "vboxusers" group. Edit the /etc/group file with:
sudo nano /etc/group

and add your username to the line that begins with "vboxusers", so that it looks somewhat as follows:

vboxusers:x:125:yourusername

And that's all. VirtualBox should now be available in the Applications -> System Tools menu.

The process of installing a guest operating system, and any guest extensions, is left as an exercise for the reader. :)

Related links:

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 nano /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.

Note: the Ctrl-Alt-Backspace shortcut is disabled by default in Jaunty

Alternatively, switch to a virtual terminal using Ctl-Alt-F2, log in, and run command

sudo /etc/init.d/gdm 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", "killall", or "pkill" 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

Graphics and xorg.conf

The following only applies to the ATI Mobility Radeon 9000 (rv250) graphics card (and other related cards, using the open source ati driver).

Thanks to this ubuntuforums thread and this thinkwiki page, I have come up with an Xorg config that works quite well:

Section "Device"
	Identifier	"Configured Video Device"
	Driver		"ati"
	Option          "AccelMethod" "XAA"
	Option          "AGPMode" "4"
	Option          "AGPFastWrite" "yes"
	Option          "EnablePageFlip" "on"
	Option          "RenderAccel" "on"
	Option          "DynamicClocks" "on"
	Option          "BIOSHotkeys" "on"
EndSection

Section "DRI"
	Mode 0666
EndSection

Section "Extensions"
	Option "Composite" "Enable"
EndSection

Mounting drives and /etc/fstab

Note: it is now preferable to use a unique UUID instead of the device path to specify mount point. For more info on UUIDs, see here.

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 nano /etc/fstab". Here are some custom entries I had in my /etc/fstab in the old days of dual-booting:

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

Alternatively, you could always manually edit the file /etc/apt/sources.list, by issuing command:

sudo nano /etc/apt/sources.list

If you go this route, it's a good idea to make a backup, just in case you mess something up. Running the following command will make a dated backup of your sources.list:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.`date -Iseconds`

Here's my current Ubuntu Intrepid sources.list. Note a number of "custom" repositories added at the end.

   # deb cdrom:[Ubuntu 8.10 _Intrepid Ibex_ - Release i386 (20081029.5)]/ intrepid main restricted
   deb-src http://archive.ubuntu.com/ubuntu/ intrepid main restricted #Added by software-properties
   # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
   # newer versions of the distribution.
   
   deb http://us.archive.ubuntu.com/ubuntu/ intrepid main restricted
   deb-src http://us.archive.ubuntu.com/ubuntu/ intrepid restricted main multiverse universe #Added by software-properties
   
   ## Major bug fix updates produced after the final release of the
   ## distribution.
   deb http://us.archive.ubuntu.com/ubuntu/ intrepid-updates main restricted
   deb-src http://us.archive.ubuntu.com/ubuntu/ intrepid-updates restricted main multiverse universe #Added by software-properties
   
   ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
   ## team. Also, please note that software in universe WILL NOT receive any
   ## review or updates from the Ubuntu security team.
   deb http://us.archive.ubuntu.com/ubuntu/ intrepid universe
   deb http://us.archive.ubuntu.com/ubuntu/ intrepid-updates universe
   
   ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
   ## team, and may not be under a free licence. Please satisfy yourself as to 
   ## your rights to use the software. Also, please note that software in 
   ## multiverse WILL NOT receive any review or updates from the Ubuntu
   ## security team.
   deb http://us.archive.ubuntu.com/ubuntu/ intrepid multiverse
   deb http://us.archive.ubuntu.com/ubuntu/ intrepid-updates multiverse
   
   ## Uncomment the following two lines to add software from the 'backports'
   ## repository.
   ## N.B. software from this repository may not have been tested as
   ## extensively as that contained in the main release, although it includes
   ## newer versions of some applications which may provide useful features.
   ## Also, please note that software in backports WILL NOT receive any review
   ## or updates from the Ubuntu security team.
   deb http://us.archive.ubuntu.com/ubuntu/ intrepid-backports main restricted universe multiverse
   deb-src http://us.archive.ubuntu.com/ubuntu/ intrepid-backports main restricted universe multiverse #Added by software-properties
   
   ## Uncomment the following two lines to add software from Canonical's
   ## 'partner' repository. This software is not part of Ubuntu, but is
   ## offered by Canonical and the respective vendors as a service to Ubuntu
   ## users.
   # deb http://archive.canonical.com/ubuntu intrepid partner
   # deb-src http://archive.canonical.com/ubuntu intrepid partner
   
   deb http://security.ubuntu.com/ubuntu intrepid-security main restricted
   deb-src http://security.ubuntu.com/ubuntu intrepid-security restricted main multiverse universe #Added by software-properties
   deb http://security.ubuntu.com/ubuntu intrepid-security universe
   deb http://security.ubuntu.com/ubuntu intrepid-security multiverse
   
   # R packages repositories
   # gpg --keyserver subkeys.pgp.net --recv-key E2A11821
   # gpg -a --export E2A11821 | sudo apt-key add -
   # let's use the berkeley mirror
   deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu intrepid/
   
   # wicd
   deb http://apt.wicd.net intrepid extras
   
   # geany ppa https://launchpad.net/~geany-dev/+archive/ppa
   deb http://ppa.launchpad.net/geany-dev/ppa/ubuntu intrepid main
   deb-src http://ppa.launchpad.net/geany-dev/ppa/ubuntu intrepid main
   
   # chromium daily ppa  key:1024R/4E5E17B5
   deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu intrepid main
   deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu intrepid main
   
   # virtualbox nonfree
   deb http://download.virtualbox.org/virtualbox/debian intrepid non-free

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

Five (5) Button mouse

My five-button Intellimouse Explorer mouse now works out of the box with no required changes in configuration.

Synaptics Touchpad

The touchpad is working perfect with the default install, with side scrolling, tapclick, and everything. If you do not like the default settings, see this page on the ubuntu wiki, which has the details on touchpad configuration.

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

Works out of the box now. :)

Wireless Network

The default NetworkManager has gotten better over the years, but still annoys you with the password prompt on login to access your WEP/WPA keys, and also, I have found, sometimes has trouble reconnecting after a suspend/resume cycle, necessitating a restart of the whole service.

I have chosen to switch to Wicd network manager, and it works wonderfully. No asking for passwords on login, always reconnects on resume, and has extra features like easy configuration of static IP/DNS.

I highly recommend it. In Intrepid and later, wicd is available in the universe repository, so to install it, just run

sudo apt-get install wicd

It will ask to remove network-manager-gnome, just go ahead and do that (you can always switch back by installing network-manager-gnome).

If you want to run the latest version of wicd, you can get the .debs from the Wicd homepage.

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.

sudo apt-get install sensors-applet hddtemp

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 run:

 sudo modprobe i8k

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.

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.

Another useful package would be i8kutils, one interesting part of which is a little program called i8kfan, which will allow you to manually control your CPU fan speed. To install that, run

sudo apt-get install i8kutils

To set the fan speed to "high", try:

i8kfan - 2

(The first argument is a "-", since for some reason my CPU fan is the "second" fan. This may vary for you, so just try it and see.)

See the following section for another use of i8kutils.

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 a simple config file that I am using for my firewall.

   #!/bin/sh
   #
   # a simple iptables ruleset
   #
   
   iptables="/sbin/iptables"
   ip6tables="/sbin/ip6tables"
   
   # 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
   
   ######################
   # allow packets for specific protocols and ports
   
   # ssh example
   #$iptables -A INPUT -p tcp --dport 22 -j ACCEPT
   
   # bittorrent example
   #$iptables -A INPUT -p tcp --dport 49966 -j ACCEPT
   #$iptables -A INPUT -p udp --dport 49966 -j ACCEPT
   
   # IPv6 rules (just block everything)
   
   # flush any existing chains and set default policies
   $ip6tables -F INPUT
   $ip6tables -F OUTPUT
   $ip6tables -F FORWARD
   
   # set default parameters
   $ip6tables -P INPUT DROP
   $ip6tables -P OUTPUT ACCEPT
   $ip6tables -P FORWARD DROP

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, some pieces of GNOME may be unhappy. (It used to be the case that it would freeze on startup and shutdown, because some processes that GNOME runs communicated via the loopback. Not sure if this is the case anymore.)

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, 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

My current printer is a USB Samsung ML 2510, and it is detected straight out of the box when connected directly via USB.

I also have a Netgear PS121 Wired USB print server. It is very convenient to set the printer up in another room as a network printer, then anyone on the LAN can easily print to it. Here's what we do to set that up.

  • From the main menu, go to System -> Administration -> Printing, select Server -> New -> Printer, to run the "New Printer" wizard.
  • Choose printer type: LPD/LPR Host or Printer
  • For Host enter the IP address of the print server
    • To double check you have the right address, try to connect to it with a web browser - the print server management page should come up.
  • For Queue enter the serve name of the print server
    • You can get the queue name by connecting to the IP address of the print server with a browser, and looking in the Server Status page at the Serve Name item.
  • Proceed to choose the driver from the list. So happens that the Samsung ML 2510 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).

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. This nice Ubuntu wiki page will tell you more about font installation on Ubuntu.

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

  • 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

Some general instructions can be found here.

For an automated way to download and install the mozilla build, check out the Ubuntuzilla project site.

Install Official Mozilla Build of Thunderbird

For an automated way to download and install the mozilla build, check out the Ubuntuzilla project site.

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

First, add one of the official R repository mirrors to your sources.list:

deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu intrepid/

Then, add the package signing key:

gpg --keyserver subkeys.pgp.net --recv-key E2A11821
gpg -a --export E2A11821 | sudo apt-key add -

Then start up Synaptic, hit reload, and install r-base-core and r-recommended (or use apt-get from a terminal). 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, 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.

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 of this document.] Once you have that done, we can proceed.

Now, see instructions to install the client, and information on folding Team Ubuntu.

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.

Backups

I use rsnapshot to do my backups to a USB hard drive. It automatically backs up my system when I tell it to, saving disk space on files that haven't changed since last backup. It is much more featureful than my basic use case shows. Here's how I configured my rsnapshot. First, I install it with

sudo apt-get install rsnapshot

Now, we can configure it. It comes with a default template configuration file that lives in /etc/rsnapshot.conf. Let's make a backup of it, and edit:

sudo cp /etc/rsnapshot.conf /etc/rsnapshot.conf.default
sudo nano /etc/rsnapshot.conf

First, set up the snapshot_root to the directory where you want your backups to go. Change that line to something like:

snapshot_root		/media/ext3backupdisk/rsnapshot_backups_intrepid/

Then, scroll down, and uncomment cmd_cp, so that your line looks like:

cmd_cp		/bin/cp

Also, at your option, uncomment cmd_rm, cmd_logger, and cmd_du.

Then, enable the "weekly" backup interval, and set it to save 10 snapshots. (The number of snapshots, and the intervals you choose, are completely up to you, and are really only relevant when you have rsnapshot running automatically. Since I only run it manually when I connect my USB HD, I just chose a named interval of "weekly" at random.)

interval	weekly	10

Now, it doesn't hurt to enable the logger, just in case, so uncomment:

logfile	/var/log/rsnapshot

And the lockfile is a good idea, too:

lockfile	/var/run/rsnapshot.pid

Now we configure which paths we want to actually back up. First, I put in an "exclude" to exclude my Trash bin:

exclude	.local/share/Trash

Also, uncomment "link-dest", since rsync on Ubuntu supports it:

link_dest		1

Finally, under the "LOCALHOST" section, set up the directories you want to back up. Here's what I have:

# LOCALHOST
backup	/home/		localhost/
backup	/etc/		localhost/

/home is where all the user data and configuration files live. /etc is where the system configuration files live. There's really no reason to back up anything else, since it's just generic system files.

Once you have it all set up, and your target USB HD is mounted to the path you specified for snapshot_root, you can run your backup with the following command:

sudo rsnapshot weekly

This will automatically back up your files to a "weekly' snapshot, and, delete the oldest one, if you have more than the number you specified you want under the "interval weekly" configuration.

And there you go, easy semiautomated backups.

There is a lot more to rsnapshot - you can do automated backups, backups to remote servers over the internet, etc. See the rsnapshot homepage for details and documentation.

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.

See the Restricted Formats wiki page and the Medibuntu repository wiki page for information. I highly recommend the Medibuntu repository.

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

  • vlc (VideoLAN media player)
  • mplayer
  • w32codecs (a package with just about any codec you need to play any video/audio file - available in the Medibuntu repository)
  • flashplugin-nonfree (the adobe flash plugin)
  • mpg123 (commandline mp3 player)
  • audacious (winamp-like mp3 player)

Networking and Communications

  • gftp (graphical ftp/sftp client)
  • openssh-server (ssh server)
  • mozilla-thunderbird (email reader), (Note: this has been replaced with the official thunderbird version because the repositories version tends to get out of date. See #Install Official Mozilla Build of Thunderbird) with the following extensions. I tend to get them directly from addons.mozilla.org, rather than from the repositories, because the repositories get out of date very quickly on the extensions.
    • enigmail (email encryption)
    • attachment reminder (reminds you about attachments)
  • mail-notification (a nice tray-resident email notifier)
  • elinks (featureful text-mode web browser)
  • pigdin plugins (pidgin itself comes with Ubuntu by default):
    • gaim-otr
  • liferea (nice RSS feed reader)
  • dillo (a cool, fast, lightweight browser, just in case you need one)
  • wicd (a nice alternative to network-manager)
  • xchat-gnome (nice IRC client)

Coding/Hacking

  • scite (powerful coding text editor)
  • geany (a good light-weight IDE based on scite engine)
  • ghex (hex editor)
  • ethereal (network packet analyzer)
  • etherape (network monitor)
  • devhelp (documentation browser)
  • git-core (git is a cool distributed version control system)
  • meld (a good graphical diff viewer)

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)
  • 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)
  • texlive-latex-extra (will pull in all the dependencies for writing LaTeX documents)
  • kile (a nice latex editor, built with Qt)
  • 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)
  • wordnet (a good offline dictionary)
  • JabRef (bibliography manager - not in the repositories)
  • ktnef (to open those annoying "winmail.dat" attachments that some people keep sending with their microsoft outlook.)
  • workrave (to remind yourself to take breaks from the computer)

Mathematics

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)
  • gnome-device-manager (browse the device tree)
Personal tools