Random Ubuntu Tips

about | archive

[ 2008-December-10 20:26 ]

I just installed Ubuntu on my desktop at work. This is the first Linux installation I've done in years, and it went much better than it has in the past. However, as always, there are little details that need work. This page is a random collection of stuff I did to my Ubuntu 8.10 system to get things working just right. Hopefully Google will help others with the same issues. For reference, my system is a Dell Optiplex GX620.

Visual Bell in gnome-terminal

By default, gnome-terminal will beep the system speaker. I want a visual indicator instead. This makes it flash the menu bar, which is not ideal but is much better than the audible beep.

  1. Be sure gnome-terminal has the bell enabled: Edit > Profile Preferences > Terminal Bell must be checked. Pressing backspace at a prompt should cause an annoying audible beep.
  2. Turn on window flashing: In System > Preferences > Sound, Change the "Visual alert" setting to "Flash window."
  3. Disable the audible bell. In the same panel, uncheck the "Play alert sound" check box.

Screen, Backspace and Mac OS X Terminal

Out of the box, if you ssh from Mac OS X into a Ubuntu box, then use screen, your backspace key will not work. The solution (from here):

  1. In Terminal on your Mac, Click Terminal → Preferences → Settings → Advanced.
  2. Change "Declare terminal as:" to "rxvt" instead of the default "xterm-color."
  3. Ensure "Delete sends Ctrl-H" is not checked.

Your backspace key should now work in screen, and in a normal terminal. However, now you won't get color when you ssh in. Ubuntu's default ~/.bashrc needs a small edit. Uncomment the line that reads: force_color_prompt=yes


I was stupid and moved my swap partition. If you do this, there are a number of steps you need to take, since the partition's UUID changes. The Ubuntu UUID documentation is a helpful reference.

  1. Add the new UUID to /etc/fstab.
  2. Add the new UUID to /etc/initramfs-tools/conf.d/resume. This is what broke hibernate on my machine.
  3. Update your initramfs so it can find the new swap UUID at boot: sudo update-initramfs -u
  4. (Optional) Get udev to regenerate /dev/disk/by-uuid: udevtrigger
  5. (Optional) Remove old unused entries from the blkid cache: blkid -g

To learn more about how Ubuntu/Gnome's hibernate and suspend menu items work, see Debugging Gnome Power Manager. This includes handy command lines for suspending and hibernating. Using these commands is better than using pm-hibernate directly because it permits applications like NetworkManager to take action before and after the suspend.

Wake on LAN

Wake on LAN lets me save electricity while having access to my system at all times. I can shut my system down, then can wake it up when I want access.

  1. Enable wake on LAN in your system's BIOS.
  2. Add the following to the eth0 stanza in /etc/network/interfaces to enable wake on LAN on your adapter at boot: post-up ethtool -s eth0 wol g. After a reboot or ifdown eth0; ifup eth0, you can run ethtool eth0 and you should see:
    	Supports Wake-on: g
    	Wake-on: g
  3. Make sure your adapter is not turned off at shutdown by adding the following to /etc/default/halt: NETDOWN=no

Now shut down your system. Your adapter should still be active (check the activity light on the adapter or your switch). You can then wake it from another computer on the same network with: wakeonlan [MAC address]

The part I can't get working is if I suspend my system it does not wake up, but it seems like it should.

Dual Monitors

  1. System > Preferences > Screen Resolution
  2. Uncheck "mirror displays"
  3. This will appear to do nothing, but hopefully you should be able to drag the single display, and you will see there is a second one underneath. Position the displays the way you want.

Alternative procedure:

  1. Install the proprietary AMD driver (I have a Radeon X600).
  2. Use the following command: aticonfig --initial=dual-head --screen-layout=right
  3. Restart X and cross your fingers

Sadly, I can't get compiz to work, as it complains that the texture memory is too small for my screen resolution. However, there is a good compiz check script that is useful for determining if you should be able to use compiz or not.

MySQL in an Alternate Location

For development work, I prefer to use a MySQL instance running as my user in my home directory, rather than use the system wide MySQL instance, but I still use the system MySQL binary, because it is convenient. However, I was running into all sorts of error messages that made it looks like I did not have the right permissions:

Could not open required defaults file: /home/evanj/test/my.cnf

I finally found a blog post and a Ubuntu bug about the issue. The problem is that by default Ubuntu uses AppArmor to limit MySQL's access to the file system. This is intended to reduce the amount of damage possible if an attacker compromises the server. However, it also means that normal users can't run MySQL. To fix this, add the following line to /etc/apparmor.d/usr.sbin.mysqld, with the existing path permission lines:

  /home/** rwk,

Then restart AppArmor: /etc/init.d/apparmor restart.