UP | HOME

My Ubuntu 11.10 Eee 1011PX setup

Table of Contents

1 Description

This document presents the steps I have taken to set up my Eee 1011PX with Ubuntu 11.10 the way I like it. This document is meant as a reminder to myself, but hopefully at least one other person will find at least one useful fact in it.

Mainly, this document describes how to:

  • Set up fan control and CPU scaling for the Eee 1011PX on Ubuntu 11.10
  • Set up LXDE
  • Set up an Emacs, notmuch, offlineimap and Gmail email system (my current system)
  • Set up an Emacs, gnus, dovecot, offlineimap and Gmail email system (my old system)

2 News

  • 29 Jan 2012: Added description of use-cases to my notmuch email system.
  • 10 Jan 2012: Changed notmuch Emacs script to only remove relevant tags when moving messages.
  • 06 Jan 2012: Added notmuch-Emacs setup binding to automatically refresh message list.
  • 04 Dec 2011: Initial page.

3 Glossary

  • vk: my user name

4 Installing Ubuntu 11.10 on Eee 1011PX

  • Use unetbootin to set up a USB thumb drive as a bootable Ubuntu 11.10 disk
  • Press ESC at bootup to enable boot-selection-screen
  • Install Ubuntu
  • My partition table consist of
    • 50gb as resized initial windows installation
    • 100gb for Ubuntu
    • 150gb (rest) as a ext4 partition to be mounted in /media/data

5 Mount a data partition

sudo mkdir /media/data
sudo chown vk:vk /media/data
sudo mount /dev/sda4 /media/data

Add to /etc/fstab:

/dev/sda4 /media/data ext4 defaults 0 1

6 Set up Emacs

This is extremely specific to my system and .emacs

sudo apt-get install emacs23 emacs23-el
sudo apt-get install auctex wmctrl

ln -s /media/data/backup ~/backup
ln -s ~/backup/homevk/data/git/emacs/.emacs ~/.emacs
ln -s ~/backup/homevk/.emacs.d ~/.emacs.d

7 LXDE

sudo apt-get install lxde

7.1 Autostart LXDE

sudo /usr/lib/lightdm/lightdm-set-defaults -s gnome-shell

7.2 Keyboard layouts in LXDE

mkdir -p ~/.config/lxsession/LXDE

Create/add to file ~/.config/lxsession/LXDE/autostart:

@setxkbmap -option grp:switch us,dk

This means the us keyboard layout is active by default. And the danish layout is active while holding down the right alt button.

7.3 Virtual Desktops

obconf

Set desktops amount to 6.

Add to ~/.config/openbox/lxde-rc.xml inside <openbox_config><keyboard>:

<keybind key="W-1">
  <action name="Desktop">
    <desktop>1</desktop>
  </action>
</keybind>
<keybind key="W-2">
  <action name="Desktop">
    <desktop>2</desktop>
  </action>
</keybind>
<keybind key="W-3">
  <action name="Desktop">
    <desktop>3</desktop>
  </action>
</keybind>
<keybind key="W-4">
  <action name="Desktop">
    <desktop>4</desktop>
  </action>
</keybind>
<keybind key="W-5">
  <action name="Desktop">
    <desktop>5</desktop>
  </action>
</keybind>
<keybind key="W-6">
  <action name="Desktop">
    <desktop>5</desktop>
  </action>
</keybind>
openbox --reconfigure

7.4 Clear out bindings conflicting with Emacs

Remove everything from work spaces management from file ~/.config/openbox/lxde-rc.xml.

7.5 Start xterm on binding windows-key + t

Add to ~/.config/openbox/lxde-rc.xml inside <openbox_config><keyboard>:

<keybind key="W-t">
  <action name="Execute">
    <command>xterm</command>
  </action>
</keybind>
openbox --reconfigure

7.6 Panel date/clock string

%a %e %b %H:%M

7.7 Power button suspends

Add to /etc/acpi/sleepbtn.sh:

# just sleep
/etc/acpi/sleep.sh
exit 0

7.8 Disable double tap

Add to ~/.config/lxsession/LXDE/autostart:

@synclient TapButton2=

7.9 Disable screensaver and screen locking

xscreensaver-demo

8 Essential Ubuntu packages

  • ubuntu-restricted-extras
  • build-essential
  • git subversion
  • screen
  • graphviz
  • gnome-do

9 Eee 1011PX fan control and CPU scaling in Ubuntu 11.10

9.1 CPU scaling

sudo add-apt-repository ppa:webupd8team/jupiter
sudo apt-get update
sudo apt-get install jupiter jupiter-support-eee

I have my CPU scaling permanently set to Power Saver to decrease the fan noise.

9.2 Fan control

Edit appropriate line in file /etc/defaults/grub to:

GRUB_CMDLINE_LINUX="acpi_osi=Linux"
sudo update-grub2
sudo apt-get install lm-sensors fancontrol
sudo sensors-detect

Accept writing to /etc/modules in order to add CPU-cores temperature measurements.

sudo reboot
sudo pwmconfig

It caused errors when I used the CPU-core temperatures. Using the temperature hwmon0 works.

My /etc/fancontrol:

# Configuration file generated by pwmconfig, changes will be lost
INTERVAL=10
DEVPATH=hwmon0= hwmon2=devices/platform/eeepc
DEVNAME=hwmon0=acpitz hwmon2=eeepc
FCTEMPS=hwmon2/pwm1=hwmon0/temp1_input
FCFANS= hwmon2/pwm1=
MINTEMP=hwmon2/pwm1=60
MAXTEMP=hwmon2/pwm1=80
MINSTART=hwmon2/pwm1=150
MINSTOP=hwmon2/pwm1=0

The Eee 1011PX runs quite hot (compared to Eee 901), meaning the fan must always be turning. If I had known this, I would have just bought a new Eee 901.

10 Guile 2.0.3

wget ftp://ftp.gnu.org/gnu/guile/guile-2.0.3.tar.gz
tar xzvf guile-2.0.3.tar.gz
sudo apt-get install libltdl-dev libgmp-dev libunistring-dev libffi-dev libgc-dev
./configure
make
sudo make install

11 Gnubiff

I mainly use Gnubiff because it can run a command (offlineimap) when new messages are available on my Gmail account

Gnubiff is no longer an official Ubuntu package so download and install these:

New file ~/.config/autostart/gnubiff.desktop:

[Desktop Entry]
Encoding=UTF-8
Name=Gnubiff
Type=Application
Categories=GNOME;GTK;Network;Email;
Exec=gnubiff -n --systemtray
Terminal=false
StartupNotify=true  

The default system tray images are hard to read. I have switched to using the awake penguin when there are no unread messages and the animated dancing penguin when there are.

12 Send mail through Gmail using Emacs

sudo apt-get install gnutls-bin

Add to ~/.emacs:

(setq user-full-name "Dan Amlund Thomsen")
(setq user-mail-address "danamlund@gmail.com")

(require 'smtpmail)
(require 'starttls)
(setq send-mail-function 'smtpmail-send-it
      message-send-mail-function 'smtpmail-send-it
      smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil))
      smtpmail-auth-credentials (expand-file-name "~/.authinfo")
      smtpmail-default-smtp-server "smtp.gmail.com"
      smtpmail-smtp-server "smtp.gmail.com"
      smtpmail-smtp-service 587
      smtpmail-debug-info t)

Create/add to file ~/.authinfo:

machine smtp.gmail.com login [your name]@gmail.com password [your password]

C-x m

13 Emacs gnus gmail dovecot offlineimap starttls

This setup assumes you have followed the previous steps:

  • Send mail through Gmail using Emacs
  • Gnubiff

My process for reading new mail is:

  • Notice Gnubiff dancing tux icon
  • Open notmuch searching for mails tagged as 'inbox' (key: C-c c n)
  • Open each mail, read them, reply and archive them as:
    • personal (key: m p)
    • uni (key: m u)
    • deleted (key: m d)

    Archiving mails moves them from the gmail inbox directory to inbox/personal, inbox/uni or [Gmail]/Trash.

    Change archiving options by changing the variable 'my-notmuch-move-options'.

  • Go back to the inbox search (key: q)
  • When there are no more new mails, exit notmuch (key: q) This automatically runs offlineimap, which updates the mail moves to gmail. This also stop Gnubiff from showing the dancing tux, as there are no longer any mail in Gmail's inbox directory.

My process for reading old mail is:

  • Open notmuch main menu (key: C-c c g)
  • Write in search string. I also have have some saved searches consisting of 'from:foo@example.org'.

13.1 Gmail offlineimap dovecot-imap

sudo apt-get install offlineimap dovecot-imapd

Add to /ets/dovecot/conf.d/10-mail.conf:

mail_location = maildir:~/Maildir
sudo service dovecot stop
sudo service dovecot start

New file ~/.offlineimaprc:

[general]
accounts = Gmail
maxsyncaccounts = 1

[Account Gmail]
localrepository = Local
remoterepository = Remote

[Repository Local]
type = IMAP
remotehost = localhost
port = 143
remoteuser = your_local_username
remotepass = your_local_password

[Repository Remote]
type = IMAP
remotehost = imap.gmail.com
remoteuser = your_username@gmail.com
remotepass = your_gmail_password
ssl = yes
maxconnections = 1
realdelete = no
offlineimap

13.2 Setting up Gnus with local IMAP server

Download offlineimap.el into ~/.emacs.d.

Add to ~/.emacs:

(add-to-list 'load-path "~/.emacs.d")
(require 'offlineimap)

(setq gnus-select-method '(nnimap "local"
                                  (nnimap-address "localhost")))
(setq gnus-ignored-newsgroups "")
(setq gnus-permanently-visible-groups ".*")

(add-hook 'gnus-exit-gnus-hook 'offlineimap)

(define-key gnus-summary-mode-map (kbd "C-c m u")
  (lambda () (interactive) (gnus-summary-move-article nil "INBOX.uni")))
(define-key gnus-summary-mode-map (kbd "C-c m p")
  (lambda () (interactive) (gnus-summary-move-article nil "INBOX.personal")))
(define-key gnus-summary-mode-map (kbd "C-c m DEL")
  (lambda () (interactive) (gnus-summary-move-article nil "[Gmail].Trash")))
(define-key gnus-summary-mode-map (kbd "C-c m C-d")
  (lambda () (interactive) (gnus-summary-move-article nil "[Gmail].Trash")))

Create/add to file ~/.authinfo:

machine localhost login [your name] password [your password]

14 Emacs notmuch offlineimap gmail

This setup assumes you have followed the previous steps:

  • Send mail through gmail using Emacs
  • Gnubiff

14.1 Initial setup

14.1.1 offlineimap

sudo apt-get install offlineimap

New file ~/.offlineimaprc:

[general]
accounts = Gmail
maxsyncaccounts = 1

[Account Gmail]
localrepository = Local
remoterepository = Remote

[Repository Local]
type = Maildir
localfolders = ~/mail
sep = .    

[Repository Remote]
type = IMAP
remotehost = imap.gmail.com
remoteuser = your_username@gmail.com
remotepass = your_gmail_password
ssl = yes
maxconnections = 1
realdelete = no

14.1.2 notmuch

Install from git:

cd ~/emacs.d
git clone git://notmuchmail.org/git/notmuch
cd notmuch
sudo apt-get install libxapian-dev libgmime-2.4-dev libtalloc-dev
./configure
make
sudo make install
notmuch setup

Specify Maildir location as ~/mail.

notmuch new

I then tag mails to match my Gmail folders. I only have two tags: INBOX/personal and INBOX/uni.

notmuch tag +uni folder:inbox/uni
notmuch tag +personal folder:inbox/personal
notmuch tag +inbox folder:inbox and not folder:inbox/uni and not folder:inbox/personal
notmuch tag +spam folder:spam
notmuch tag +sent folder:sent

14.2 Continued updates

Change appropriate line in ~/.notmuch-config:

tags=new;

New file ~/bin/notmuch-my-new:

notmuch new

notmuch tag +sent -new folder:sent and tag:new

notmuch tag +spam -new folder:spam and tag:new

notmuch tag +inbox -new tag:new
chmod +x ~/bin/notmuch-my-new
notmuch-my-new

Now change the Gnubiff "When new mail, run command" to:

offlineimap && notmuch-my-new

14.3 Emacs

Download offlineimap.el into ~/.emacs.d.

Add to ~/.emacs:

(add-to-list 'load-path "~/.emacs.d")
(require 'offlineimap)
(require 'notmuch)

(setq mm-text-html-renderer 'w3m) ;; html2text causes tagging to stop working
(setq notmuch-fcc-dirs nil) ; Gmail saves sent mails by itself

(define-key notmuch-show-mode-map (kbd "RET") 'goto-address-at-point)

(global-set-key (kbd "C-c c g") 'notmuch)
(global-set-key (kbd "C-c c n") (lambda ()
                                  (interactive)
                                  (notmuch-search "tag:inbox")))
(define-key notmuch-search-mode-map "q" (lambda ()
                                          (interactive)
                                          (offlineimap)
                                          (notmuch-search-quit)))
(define-key notmuch-show-mode-map "q" 
  (lambda ()
    (interactive)
    (notmuch-kill-this-buffer)
    (if (and (eq major-mode 'notmuch-search-mode)
             (< (buffer-size) 1024))
        (notmuch-search-refresh-view))))

(setq notmuch-saved-searches 
      '(("inbox" . "tag:inbox")))

(defvar my-notmuch-mail-path (expand-file-name "~/mail")
  "Location of local Maildir.")

(defvar my-notmuch-move-options '(("personal" "INBOX.personal" "p")
                                  ("uni" "INBOX.uni" "u")
                                  ("trash" "[Gmail].Trash" "d"))
  "List of synced notmuch labels and Maildir folders. The format
    is '(notmuch-tag Maildir-folder key-binding). Key-binding
    is \"m x\" when viewing a message where x is the key-binding
    from the format.")

(defvar my-notmuch-remove-tags-on-move 
  (append (mapcar 'car my-notmuch-move-options)
          '("inbox"))
  "Which tags to remove from messages when moving them.")

(define-key notmuch-show-mode-map (kbd "m") nil)
(require 'cl)
(dolist (opt my-notmuch-move-options)
  (lexical-let ((tag (car opt))
                (binding (car (cdr (cdr opt)))))
    (define-key notmuch-show-mode-map (concat "m" binding)
      (function (lambda ()
                  (interactive)
                  (my-notmuch-move tag))))))

(defun my-notmuch-do-move (tag folder)
  (interactive)
  (notmuch-show-refresh-view)
  (let ((from (shell-quote-argument (notmuch-show-get-filename)))
        (to (shell-quote-argument folder)))
    (shell-command (concat "ln " from " " to))
    (shell-command (concat "rm " from))
    (dolist (cur-tag my-notmuch-remove-tags-on-move)
      (notmuch-show-remove-tag cur-tag))
    (notmuch-show-add-tag tag)))
(defun my-notmuch-move (&optional in-tag)
  (interactive)
  (let* ((tag (or in-tag
                  (completing-read "Move message to: "
                                   (mapcar 'car my-notmuch-move-options))))
         (folder (cadr (assoc tag my-notmuch-move-options)))
         (full-folder (concat my-notmuch-mail-path "/" folder "/cur/")))
    (if (null folder)
        (error "Unknown tag: %s" tag)
      (my-notmuch-do-move tag full-folder))))

Download nottoomuch-addresses into ~/bin.

Fetch addresses from mails:

./~/bin/nottoomuch-addresses --update

Should probably add as a cron job as well.

Add to ~/.emacs:

(require 'notmuch-address)
(setq notmuch-address-command "~/bin/nottoomuch-addresses.sh")
(notmuch-address-message-insinuate)

Adds TAB-completion in "To:" field when composing mails.

Date: 2012-02-01 09:28:40 CET

Author: Dan Amlund Thomsen

Org version 7.8.03 with Emacs version 23

Validate XHTML 1.0