Ubuntu Lucid


I recently upgraded from Ubuntu Hardy (8.04) to Lucid (10.04). Similar to my list of tips for Fedora Core 3 on VMWare, here are some tips for Ubuntu Lucid. (I’m running it on a Thinkpad X201).

  • If you use VMWare, don’t bother with trying to build VMWare tools. Instead, use Open VM Tools, an open source version. There are lucid packages – open-vm-tools for console, open-vm-toolbox for X – that are built with the right kernel, 2.6.31, and work flawlessly. Thanks langui.sh!

  • If you want to remove GDM and boot to a console login prompt instead of an X splash screen, there’s yet another new incantation. This time, the recommended practice is to muck with grub itself:

    sudo sed -i -r 's/(GRUB_CMDLINE_LINUX_DEFAULT=)"quiet splash"/\1"text"/' \
    sudo update-grub
  • Sound has pretty much Just Worked, which was a pleasant surprise. Specifically, PulseAudio worked out of the box. Of course, I immediately broke it by running pactl set-sink-volume. I got error messages like shm_open(): Permission denied when I ran paplay and other sound applications. Argh. I reinstalled soon after, so I didn’t get the chance to debug farther.

  • There’s no more xorg.conf! It’s deprecated. Use other tools to configure X, e.g. xrandr to set resolution.

  • At first, all of my GTK apps had huge fonts. Readers Digest huge. Firefox, Pidgin, everything. I was using xrandr to set my screen resolution, since I use xinit and a non-standard window manager, ion, instead of a full desktop like Gnome or KDE, so I wondered if I was Doing It Wrong. It was only GTK fonts, so I dug into gconf. I tried using gconftool to change them:

    gconf-editor /desktop/gnome/interface/font_name
    gconftool -t int -s /desktop/gnome/interface/font_size 12

    …but that didn’t work, maybe because xrandr changes resolution but not DPI, or something similar related to scaling.

    I continued researching and experimenting. I tried running xrandr after starting the programs, in .xinitrc, and it worked! …but it didn’t last. As soon as I restarted a program, it had monster fonts again.

    After more wailing and gnashing of teeth, I finally struck on a solution. I reused my xorg.conf from Hardy, and that fixed it for good. Woohoo! Of course, when I later switched from VMWare to running on bare hardware, it fixed itself and I no longer needed the xorg.conf. Go figure.

  • Speaking of gconf, note how it’s different from the old school .gtkrc files! gconf is only really used if you’re running Gnome. Of course, more and more things are “part of Gnome” and use it, like PulseAudio, but others like Pidgin and Firefox don’t. They read .gtkrc-2.0 instead.

  • This Emacs 23/GTK bug (more details) annoyed the shit out of me. When server-based X frames are killed instead of closed nicely, the whole Emacs process hangs. This happens when I shut down X while any X emacsclient frames are still open. The symptom is that the next time I try to open an X emacsclient frame, it just hangs. Grr.

    I tried lots of workarounds, but I finally fixed this by switching to the emacs-lucid package, which is emacs with X windows support but no GTK. It uses Xaw as its windowing toolkit instead. Praise the lord!

  • If you’re using VMWare shared folders, and boot complains that /mnt/hgfs can’t be mounted and prompts to skip, it might be because mountall starts before open-vm-tools, so it doesn’t have the fs driver loaded yet. Try adding the nobootwait option in /etc/fstab.

  • The pm-utils package has command-line tools for suspend, pm-suspend, and hibernate, pm-hibernate, and even a hybrid of the two, pm-suspend-hybrid. Awesome.


  • Speaking of suspend, if you’re on a Thinkpad (I use an X201), and your laptop reboots when you resume from suspend, update your BIOS.

  • If your screen turns off after 10 minutes, or however long, check your X screen saver and DPMS settings:

    $ xset q
    Screen Saver:
      prefer blanking: yes  allow exposures: yes
      timeout: 600  cycle: 600
    DPMS (Energy Star):
      Standby: 600  Suspend: 600  Off: 600
      DPMS is Enabled

    Turn both off with:

    xset -dpms
    xset s off
  • To disable bluetooth, make sure /etc/rc.local is executable, then add this line to it:

    echo disable > /proc/acpi/ibm/bluetooth
  • If you’re getting logged out when your session goes idle, that’s because of timeoutd. To configure it, edit /etc/timeouts; to disable it, just truncate that file.

  • In earlier kernels, USB would stop working after suspend and resume. Rebooting or hibernating and thawing would fix it. Details in these bugs.

    This turned out to be an ACPI bug that was fixed in a later kernel, upstream aka Ubuntu 2.6.32-23-generic. You can get it with sudo apt-get update followed by either sudo apt-get install linux-image or just sudo apt-get upgrade.

  • Speaking of USB, when I plug in my USB keyboard, my xmodmap settings aren’t re-applied. See the launchpad bug. I haven’t yet figured this out. I first tried switching to xkb, but it’s too damn complicated.

    Then I tried a udev rule:

    SUBSYSTEMS=="usb", ATTRS{product}=="Goldtouch USB Keyboard", RUN+="/usr/bin/xmodmap /home/ryanb/.Xmodmap"

    but no luck. I noticed a comment in the launchpad bug that said a udev rule like this might run too soon, so I tried slowing it down by pointing it to this script (udev’s man page says that RUN doesn’t use a shell):

    sleep 15s && xmodmap ~/.Xmodmap &

    It definitely ran, but it didn’t actually work. Confusing. I finally gave up and added a key binding in my window manager to run xmodmap ~/.Xmodmap on demand, and I just press that after I plug in my keyboard.


  • If you’re on a laptop, you can use the tp_smapi kernel module to tune your battery charge thresholds and increase its lifespan. First, install the tp-smapi module, load it, and tell Linux to load it on boot:

    # as root
    apt-get install tp-smapi-dkms
    modprobe tp_smapi
    echo "tp_smapi" >> /etc/modules

    You can configure it with sysfs. For example, to charge the battery when it’s below 90% and never charge it above 95%:

    echo 90 > /sys/devices/platform/smapi/BAT0/start_charge_thresh
    echo 95 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh

    See the ThinkWiki article for more. To keep these settings across reboot, use sysfsutils:

    # as root
    apt-get install sysfsutils
    cat >> /etc/sysfs.conf << EOF
    devices/platform/smapi/BAT0/start_charge_thresh = 90
    devices/platform/smapi/BAT0/stop_charge_thresh = 95
  • On a related note, you can use acpid to warn you, or even automatically suspend or hibernate, when your battery gets low. See this article.

    I decided to automatically suspend when my battery drops to around 5%. First, use service acpid status to make sure acpid is installed and running. Next, add a new acpid event by creating a new file, /etc/acpi/events/low_battery_suspend, with these contents:

    action=/etc/acpi/low-battery-suspend.sh %e

    Finally, put this into /etc/acpi/low-battery-suspend.sh:

    CURRENT=`grep -E '^remaining capacity:' $PROC/state | tr -s ' ' | cut -d' ' -f3`
    LOW=`grep -E '^design capacity warning:' $PROC/info | tr -s ' ' | cut -d' ' -f4`
    CHARGING=`grep -E '^charging state:' $PROC/state | tr -s ' ' | cut -d' ' -f3`
    if [[ $CHARGING == "discharging" && $CURRENT -lt $LOW ]]; then
  • Last power saving tip: check out Intel’s powertop, a utility that acts like top for your battery. It shows you the biggest power consumers on your system and suggests remedies, e.g. USB power save mode (usually just for non-input devices), HD audio power save mode:

    echo 1 > /sys/module/snd_hda_intel/parameters/power_savep

    and SATA low power mode:

    echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
  • If you use anacron, and your anacron jobs aren’t running, and you see syslog messages like this:

    init: anacron main process (19514) killed by TERM signal

    …you’re running into either a sysvinit bug, or an ACPI bug, or maybe an interaction between the two. Or something. Whatever.

    In any case, I first tried this thread‘s workaround of adding a sleep before stopping /etc/init/anacron.conf, but that made it awkward to stop or restart anacron, and impossible to suspend or hibernate, since they try to suspend anacron first.

    I settled for simply removing /usr/lib/pm-utils/sleep.d/95anacron, the hook that suspends anacron when the machine itself suspends. So far that’s working nicely.

  • If you use postfix (the default) as your MTA, and you see syslog messages like this:

    postfix/postdrop[29372]: warning: unable to look up public/pickup: No such file or directory

    …you need to create the postdrop fifo, as described in this forum thread:

    sudo mkfifo /var/spool/postfix/public/pickup
    sudo service postfix restart
  • Every now and then, I lose all networking after a resume or restart. I’ve noticed this most often when I pm-suspend-hybrid, and the system eventually runs out of power and hibernates or dies, so that I later have to thaw it or reboot entirely instead of just resuming.

    When this happens, ifconfig only shows the loopback device, not eth0 or wlan0, and ifup doesn’t bring either of them back. lshw -c shows them, but says they’re both disabled. Restarting the networking service doesn’t help, nor does restarting NetworkManager, which is still running happily.

    I finally found a solution in this ubuntuforums thread. Run lshw -C network, find the configuration: ... driver=XXX section, then add this to /etc/pm/config.d/config:


    where XXX is the driver name. (Mine is iwlagn.) Then, suspend and resume; if that doesn’t work, reboot.

    Colleagues suggested this might be related to Launchpad bugs 524454 and 555571. I’m not convinced, since they’re both about NetworkManager, which is higher level than the symptoms here, but who knows.

  • Seeing this error when you try to take a screenshot with ImageMagick‘s import?

    import: unable to read X window image `':
    Resource temporarily unavailable @

    The program you’re trying to screenshot may have multiple windows open with the same window id. Try temporarily closing the other windows.

    Alternatively, try the -frame flag, which tells import to include the X window frame in the imported image. No clue why that works. More info in Launchpad bug 464031.

  • If you see this error when sending mail:

    postfix: fatal: /etc/mailname: cannot open file: No such file or directory

    Put your top-level domain name, or fully qualified hostname if you want, into /etc/mailname. Mine is:


    Then sudo service postfix restart.

  • NetworkManager not using connections you think it should be using? Check the file permissions in /etc/NetworkManager/system-connections/. If they’re group or world readable or writable, or not owned by root, that’s probably why. You can confirm that this is the problem by looking for lines like this in /var/log/syslog:

    Ignoring insecure configuration file '/etc/NetworkManager/system-connections/ABC'

    This should fix it:

    sudo chown root:root /etc/NetworkManager/system-connections/*
    sudo chmod 600 /etc/NetworkManager/system-connections/*
    sudo service network-manager restart
  • Here are some of the extra packages I installed:
    • apache2
    • apel
    • aumix
    • emacs-goodies-el
    • emacs23-el
    • emacs23-lucid (replaces emacs23-gtk)
    • flickcurl-utils
    • gcalcli
    • ion3
    • ion3-dev
    • ion3-doc
    • ion3-scripts
    • jnettop
    • lua-mode
    • lynx
    • mpg123
    • mysql-server
    • php-elisp
    • php5
    • php5-cgi
    • php5-cli
    • php5-curl
    • php5-mysql
    • pidgin
    • python-mysqldb
    • rxvt-unicode
    • subversion
    • sysfsutils
    • tkdiff
    • tp-smapi-dkms
    • udev
    • usbmount
    • xloadimage
    • xkbset
    • xscreensaver
    • yaml-mode

    I also downloaded, built, and installed cnetworkmanager from source, since it’s not in any Debian or Ubuntu repositories.

Enjoy Ubuntu Lucid!

3 thoughts on “Ubuntu Lucid

  1. To get rid of GDM startup at boot time, you replace “quiet splash” with “test” in the /etc/default/grub file. It should be “text” and not “test”.

  2. One other small detail with respect to the network loss on suspend/resume. In my case I was loosing both wireless and wired connectivity, so I had to put both drivers in the config. The format is:



Leave a Reply

Your email address will not be published. Required fields are marked *