Category Archives: Ubuntu

The following signatures were invalid: BADSIG 40976EAF437D05B5

I would get this error whenever I would run ‘sudo aptitude update’ or ‘sudo apt-get update’:

W: GPG error: http://mirror.anl.gov oneiric Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>

I was able to resolve this issue for this GPG public key in particular by doing the following:

sudo apt-get clean
sudo mv /var/lib/apt/lists /tmp
sudo mkdir /var/lib/apt/lists
sudo apt-get update

vpnc on Ubuntu Oneiric: "Error: either "to" is duplicate, or "ipid" is a garbage."

When one attempts to connect to their VPN after installing and configuring vpnc on Ubuntu Oneiric, the following error occurs:

root@ubuntu:~# vpnc-connect
Error: either "to" is duplicate, or "ipid" is a garbage.

After some time it eventually times out and fails to create a connection.
vpnc version information:

root@ubuntu:/tmp# vpnc --version
vpnc version 0.5.3
Copyright (C) 2002-2006 Geoffrey Keating, Maurice Massar, others
vpnc comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of vpnc under the terms of the GNU General
Public License.  For more information about these matters, see the files
named COPYING.
Built with certificate support.
Supported DH-Groups: nopfs dh1 dh2 dh5
Supported Hash-Methods: md5 sha1
Supported Encryptions: null des 3des aes128 aes192 aes256
Supported Auth-Methods: psk psk+xauth hybrid(rsa)

It appears that the Ubuntu package vpnc comes with an old version of vpnc-script. This script is what sets up all the addresses and routes for you. The OpenConnect project provides an updated / revised release of this script. Download the latest copy from here . Replace the vpnc-script script that comes with the Ubuntu vpnc package: /etc/vpnc/vpnc-script.

References

Install GNOME 3 on Ubuntu Natty (10.04)

Add the GNOME3 Personal Package Archive (PPA)

With Natty, Ubuntu comes with Unity installed as its default desktop environment. GNOME remains in Ubuntu’s universe package repository. However, it contains version 2.30 and not the newly released version 3:

user@ubuntu:~$ apt-cache show gnome
Package: gnome
Priority: optional
Section: universe/gnome
Installed-Size: 60
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>
Architecture: amd64
Source: meta-gnome2
Version: 1:2.30+7ubuntu3
Depends: gnome-desktop-environment (= 1:2.30+7ubuntu3), gdm, gnome-themes-extras, gnome-games (>= 1:2.30), libpam-gnome-keyring (>= 2.30), gstreamer0.10-plugins-ugly (>= 0.10.14), gstreamer0.10-ffmpeg (>= 0.10.10), rhythmbox-plugins (>= 0.12.8) | banshee (>= 1.6), rhythmbox-plugin-cdrecorder (>= 0.12.8) | banshee (>= 1.6), synaptic (>= 0.63), system-config-printer-gnome (>= 1.0.0), totem-mozilla, epiphany-extensions, gedit-plugins, evolution-plugins (>= 2.30), evolution-exchange (>= 2.30) | evolution-mapi (>= 0.30), evolution-webcal (>= 2.28), software-center, gnome-codec-install, transmission-gtk, avahi-daemon, tomboy (>= 1.2) | gnote
Recommends: gnome-games-extra-data (>= 2.30), network-manager-gnome (>= 0.8), gnome-office (= 1:2.30+7ubuntu3), update-notifier, shotwell, liferea | evolution-rss | blam, menu-xdg, gdebi, mozilla-plugin-gnash
Suggests: gnome-dbg, openoffice.org-gnome, openoffice.org-evolution
Conflicts: gnome-cups-manager
Filename: pool/universe/m/meta-gnome2/gnome_2.30+7ubuntu3_amd64.deb
Size: 2126
MD5sum: fa2a01a8c704eb05374ed95c74f6e84a
SHA1: cb2bcd2a12ea289afbc923c49359ba1f6a295516
SHA256: f792b1d4c4887d27d8c9e3a3f6bd9c773e12fea459b86e07f876d78262cc827c
Description: The GNOME Desktop Environment, with extra components
 This is the GNOME Desktop environment, an intuitive and attractive
 desktop, with extra components.
 .
 This package depends on the standard distribution of the GNOME desktop
 environment, plus a complete range of plugins and other applications
 integrating with GNOME and Debian, providing the best possible
 environment to date.
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu

This PPA contains packages from GNOME3 and their dependencies so they can be used in Ubuntu 11.04 (Natty).

user@ubuntu:~$ sudo add-apt-repository ppa:gnome3-team/gnome3
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://keyserver.ubuntu.com:80/ --recv 9D542E3D52C801D9F8E31682F1773AF13B1510FD
gpg: requesting key 3B1510FD from hkp server keyserver.ubuntu.com
gpg: key 3B1510FD: public key "Launchpad PPA for GNOME3 Team" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
user@ubuntu:~$ sudo apt-get update
root@ubuntu:~# sudo apt-get upgrade
root@ubuntu:/etc/apt/sources.list.d# aptitude upgrade
Resolving dependencies...
The following NEW packages will be installed:
  accountsservice{a} dconf-gsettings-backend{a}
  gir1.2-gnomebluetooth-1.0{a} gir1.2-gtk-3.0{a} gir1.2-peas-1.0{a}
  gir1.2-totem-1.0{a} gir1.2-totem-plparser-1.0{a} gnome-desktop3-data{a}
  gtk3-engines{a} gtk3-engines-unico{a} libaccountsservice0{a}
  libappindicator3-1{a} libaudit0{a} libavahi-ui-gtk3-0{a}
  libcamel-1.2-23{a} libcanberra-gtk3-0{a} libcanberra-gtk3-module{a}
  libcap2-bin{a} libdbusmenu-gtk3-3{a} libebackend-1.2-1{a}
  libedata-book-1.2-9{a} libedata-cal-1.2-11{a} libedataserverui-3.0-0{a}
  libgail-3-0{a} libgck0{a} libgcr-3-0{a} libgnome-control-center1{a}
  libgnome-desktop-3-0{a} libgnome-media-profiles-3.0-0{a} libgnomekbd7{a}
  libgtk-3-0{a} libgtk-3-bin{a} libgtk-3-common{a} libgtk-vnc-2.0-0{a}
  libgtkhtml-4.0-0{a} libgtkhtml-4.0-common{a} libgtkhtml-editor-4.0-0{a}
  libgtkmm-3.0-1{a} libgtksourceview-3.0-0{a}
  libgtksourceview-3.0-common{a} libgucharmap-2-90-7{a} libgvnc-1.0-0{a}
  libgweather-3-0{a} libindicator3-3{a} liblaunchpad-integration-3.0-1{a}
  libpeas-1.0-0{a} libpeas-common{a} libtotem0{a} libunique-3.0-0{a}
  libvte-2.90-9{a} libwebkitgtk-3.0-0{a} libwebkitgtk-3.0-common{a}
  libwnck-3-0{a} libwnck-3-common{a} sound-theme-freedesktop{a}
  zenity-common{a}
The following packages will be upgraded:
  aisleriot avahi-autoipd avahi-daemon avahi-utils baobab empathy
  empathy-common eog evolution evolution-common evolution-data-server
  evolution-data-server-common evolution-exchange evolution-plugins
  file-roller gcalctool gconf-defaults-service gconf-editor gconf2
  gconf2-common gdm gedit gedit-common gir1.2-freedesktop gir1.2-gconf-2.0
  gir1.2-glib-2.0 gir1.2-notify-0.7 gir1.2-soup-2.4
  gnome-accessibility-themes gnome-bluetooth gnome-disk-utility
  gnome-doc-utils gnome-games-common gnome-icon-theme gnome-keyring
  gnome-mahjongg gnome-media gnome-menus gnome-nettool gnome-orca
  gnome-power-manager gnome-screensaver gnome-screenshot gnome-search-tool
  gnome-session gnome-session-bin gnome-session-canberra
  gnome-session-common gnome-settings-daemon gnome-system-log
  gnome-system-monitor gnome-terminal gnome-terminal-data
  gnome-themes-selected gnome-user-share gnome-utils-common gnomine
  gsettings-desktop-schemas gucharmap ibus ibus-gtk libavahi-client3
  libavahi-common-data libavahi-common3 libavahi-core7 libavahi-glib1
  libavahi-gobject0 libavahi-ui0 libcanberra-gtk-module libcanberra-gtk0
  libcanberra-pulse libcanberra0 libdconf0 libebook1.2-10 libecal1.2-8
  libedataserver1.2-14 libegroupwise1.2-13 libevolution libgconf2-4 libgcr0
  libgdata-common libgdata11 libgdu-gtk0 libgdu0 libgirepository-1.0-1
  libgnome-bluetooth8 libgnome-keyring0 libgnome-menu2 libgnomekbd-common
  libgtk-vnc-1.0-0 libgucharmap7 libgweather-common libibus2
  libmetacity-private0 libmission-control-plugins0 libnautilus-extension1
  libnotify4 libpam-gnome-keyring libpolkit-agent-1-0 libpolkit-backend-1-0
  libpolkit-gobject-1-0 libpolkit-gtk-1-0 libquvi0 librsvg2-2
  librsvg2-common libsoup-gnome2.4-1 libsoup2.4-1 libstartup-notification0
  libtelepathy-glib0 libtelepathy-logger2 libtotem-plparser17
  libwebkitgtk-1.0-0 libwebkitgtk-1.0-common libwnck-common libwnck22
  libxklavier16 light-themes metacity metacity-common mousetweaks nautilus
  nautilus-data nautilus-sendto nautilus-sendto-empathy
  network-manager-gnome policykit-1 policykit-1-gnome python-gmenu
  python-ibus telepathy-butterfly telepathy-gabble telepathy-idle
  telepathy-logger telepathy-mission-control-5 telepathy-salut totem
  totem-common totem-mozilla totem-plugins ubuntu-artwork vinagre vino yelp
  yelp-xsl zenity
The following packages are RECOMMENDED but will NOT be installed:
  gir1.2-gtksource-3.0 gnome-icon-theme-symbolic
145 packages upgraded, 56 newly installed, 0 to remove and 7 not upgraded.
Need to get 175 MB/189 MB of archives. After unpacking 389 MB will be used.
Do you want to continue? [Y/n/?] y
root@ubuntu:~# sudo apt-get install gnome-shell
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  gir1.2-clutter-1.0 gir1.2-gkbd-3.0 gir1.2-json-glib-1.0 gir1.2-mutter-3.0
  gir1.2-polkit-1.0 gir1.2-telepathyglib-0.12 gir1.2-telepathylogger-0.2
  gir1.2-upowerglib-1.0 gjs gnome-icon-theme-symbolic libclutter-1.0-0
  libclutter-1.0-common libgjs0b libmozjs185-1.0 libmutter0 mesa-utils
  mutter-common
The following NEW packages will be installed:
  gir1.2-clutter-1.0 gir1.2-gkbd-3.0 gir1.2-json-glib-1.0 gir1.2-mutter-3.0
  gir1.2-polkit-1.0 gir1.2-telepathyglib-0.12 gir1.2-telepathylogger-0.2
  gir1.2-upowerglib-1.0 gjs gnome-icon-theme-symbolic gnome-shell
  libclutter-1.0-0 libclutter-1.0-common libgjs0b libmozjs185-1.0 libmutter0
  mesa-utils mutter-common
0 upgraded, 18 newly installed, 0 to remove and 7 not upgraded.
Need to get 6,630 kB of archives.
After this operation, 22.7 MB of additional disk space will be used.
Do you want to continue [Y/n]? y

Reboot. Choose GNOME for your desktop session at the login prompt.

Uninstall

root@ubuntu:~# sudo apt-get install ppa-purge
root@ubuntu:~# sudo ppa-purge ppa:gnome3-team/gnome3
...
The following packages will be DOWNGRADED:
  aisleriot avahi-autoipd avahi-daemon avahi-utils baobab empathy
  empathy-common eog evince evince-common evolution evolution-common
  evolution-data-server evolution-data-server-common evolution-exchange
  evolution-plugins file-roller gcalctool gconf-defaults-service
  gconf-editor gconf2 gconf2-common gdm gedit gedit-common
  gir1.2-clutter-1.0 gir1.2-freedesktop gir1.2-gconf-2.0 gir1.2-glib-2.0
  gir1.2-gtk-3.0 gir1.2-notify-0.7 gir1.2-soup-2.4
  gnome-accessibility-themes gnome-bluetooth gnome-disk-utility
  gnome-doc-utils gnome-games-common gnome-icon-theme gnome-keyring
  gnome-mahjongg gnome-media gnome-menus gnome-nettool gnome-orca
  gnome-power-manager gnome-screensaver gnome-screenshot gnome-search-tool
  gnome-session gnome-session-bin gnome-session-canberra
  gnome-session-common gnome-settings-daemon gnome-system-log
  gnome-system-monitor gnome-terminal gnome-terminal-data
  gnome-themes-selected gnome-user-share gnome-utils-common gnomine
  gsettings-desktop-schemas gucharmap ibus ibus-gtk libavahi-client3
  libavahi-common-data libavahi-common3 libavahi-core7 libavahi-glib1
  libavahi-gobject0 libavahi-ui0 libcanberra-gtk-module libcanberra-gtk0
  libcanberra-pulse libcanberra0 libclutter-1.0-0 libclutter-1.0-common
  libdconf0 libebook1.2-10 libecal1.2-8 libedataserver1.2-14
  libegroupwise1.2-13 libevolution libgconf2-4 libgcr0 libgdata-common
  libgdata11 libgdu-gtk0 libgdu0 libgirepository-1.0-1 libgjs0b
  libgnome-bluetooth8 libgnome-keyring0 libgnome-menu2 libgnomekbd-common
  libgtk-3-0 libgtk-3-bin libgtk-3-common libgtk-vnc-1.0-0 libgucharmap7
  libgweather-common libibus2 libmetacity-private0
  libmission-control-plugins0 libnautilus-extension1 libnotify4
  libpam-gnome-keyring libpeas-1.0-0 libpeas-common libpolkit-agent-1-0
  libpolkit-backend-1-0 libpolkit-gobject-1-0 libpolkit-gtk-1-0 libquvi0
  librsvg2-2 librsvg2-common libsoup-gnome2.4-1 libsoup2.4-1
  libstartup-notification0 libtelepathy-glib0 libtelepathy-logger2
  libtotem-plparser17 libwebkitgtk-1.0-0 libwebkitgtk-1.0-common
  libwnck-common libwnck22 libxklavier16 light-themes metacity
  metacity-common mousetweaks nautilus nautilus-data nautilus-sendto
  nautilus-sendto-empathy network-manager-gnome policykit-1
  policykit-1-gnome python-gmenu python-ibus telepathy-butterfly
  telepathy-gabble telepathy-idle telepathy-logger
  telepathy-mission-control-5 telepathy-salut totem totem-common
  totem-mozilla totem-plugins ubuntu-artwork vinagre vino yelp yelp-xsl
  zenity
The following NEW packages will be installed:
  gir1.2-gstreamer-0.10{a} gnome-js-common{a} libevdocument3{a}
  libevview3{a} libseed0{a} xulrunner-2.0-mozjs{a}
The following packages will be REMOVED:
  accountsservice{u} dconf-gsettings-backend{u} gir1.2-gkbd-3.0{a}
  gir1.2-gnomebluetooth-1.0{u} gir1.2-mutter-3.0{u} gir1.2-peas-1.0{u}
  gir1.2-polkit-1.0{u} gir1.2-telepathyglib-0.12{u}
  gir1.2-telepathylogger-0.2{u} gir1.2-totem-1.0{u}
  gir1.2-totem-plparser-1.0{u} gir1.2-upowerglib-1.0{u} gjs{u}
  gnome-desktop3-data{u} gnome-icon-theme-symbolic{a} gnome-shell{a}
  gtk3-engines{u} gtk3-engines-unico{u} libappindicator3-1{u} libaudit0{u}
  libavahi-ui-gtk3-0{u} libcamel-1.2-23{a} libcanberra-gtk3-0{u}
  libcanberra-gtk3-module{u} libcap2-bin{u} libdbusmenu-gtk3-3{u}
  libebackend-1.2-1{a} libedata-book-1.2-9{a} libedata-cal-1.2-11{a}
  libedataserverui-3.0-0{a} libevince3-3{a} libgail-3-0{u} libgck0{u}
  libgcr-3-0{u} libgnome-control-center1{u} libgnome-desktop-3-0{u}
  libgnome-media-profiles-3.0-0{u} libgnomekbd7{a} libgtk-vnc-2.0-0{u}
  libgtkhtml-4.0-0{u} libgtkhtml-4.0-common{u} libgtkhtml-editor-4.0-0{u}
  libgtkmm-3.0-1{u} libgtksourceview-3.0-0{u}
  libgtksourceview-3.0-common{u} libgucharmap-2-90-7{u} libgvnc-1.0-0{u}
  libgweather-3-0{u} libindicator3-3{u} liblaunchpad-integration-3.0-1{u}
  libmozjs185-1.0{u} libmutter0{u} libtotem0{a} libunique-3.0-0{u}
  libvte-2.90-9{u} libwebkitgtk-3.0-0{u} libwebkitgtk-3.0-common{u}
  libwnck-3-0{u} libwnck-3-common{u} mesa-utils{u} mutter-common{u}
  sound-theme-freedesktop{u} zenity-common{a}
0 packages upgraded, 6 newly installed, 157 downgraded, 63 to remove and 0 not upgraded.
Need to get 53.8 MB/58.7 MB of archives. After unpacking 406 MB will be freed.
Do you want to continue? [Y/n/?] y
Fetched 53.8 MB in 55s (973 kB/s)
Extracting templates from packages: 100%
Preconfiguring packages ...
dpkg: warning: downgrading libcanberra-pulse from 0.28-0ubuntu5~natty1 to 0.28-0ubuntu3.
(Reading database ... 141452 files and directories currently installed.)
Preparing to replace libcanberra-pulse 0.28-0ubuntu5~natty1 (using .../libcanberra-pulse_0.28-0ubuntu3_amd64.deb) ...
Unpacking replacement libcanberra-pulse ...
dpkg: warning: downgrading libcanberra0 from 0.28-0ubuntu5~natty1 to 0.28-0ubuntu3.
Preparing to replace libcanberra0 0.28-0ubuntu5~natty1 (using .../libcanberra0_0.28-0ubuntu3_amd64.deb) ...
Unpacking replacement libcanberra0 ...
dpkg: warning: downgrading libcanberra-gtk0 from 0.28-0ubuntu5~natty1 to 0.28-0ubuntu3.
Preparing to replace libcanberra-gtk0 0.28-0ubuntu5~natty1 (using .../libcanberra-gtk0_0.28-0ubuntu3_amd64.deb) ...
Unpacking replacement libcanberra-gtk0 ...
dpkg: warning: downgrading gconf2-common from 2.32.4-1ubuntu1~natty1 to 2.32.2-0ubuntu2.
Preparing to replace gconf2-common 2.32.4-1ubuntu1~natty1 (using .../gconf2-common_2.32.2-0ubuntu2_all.deb) ...
Unpacking replacement gconf2-common ...
dpkg: warning: downgrading libgconf2-4 from 2.32.4-1ubuntu1~natty1 to 2.32.2-0ubuntu2.
Preparing to replace libgconf2-4 2.32.4-1ubuntu1~natty1 (using .../libgconf2-4_2.32.2-0ubuntu2_amd64.deb) ...
Unpacking replacement libgconf2-4 ...
dpkg: warning: downgrading libpolkit-gobject-1-0 from 0.101-4~natty1 to 0.101-1ubuntu1.
Preparing to replace libpolkit-gobject-1-0 0.101-4~natty1 (using .../libpolkit-gobject-1-0_0.101-1ubuntu1_amd64.deb) ...
Unpacking replacement libpolkit-gobject-1-0 ...
dpkg: warning: downgrading libgcr0 from 3.0.3-2~natty1 to 2.92.92.is.2.32.1-0ubuntu2.
Preparing to replace libgcr0 3.0.3-2~natty1 (using .../libgcr0_2.92.92.is.2.32.1-0ubuntu2_amd64.deb) ...
Unpacking replacement libgcr0 ...
dpkg: warning: downgrading libgnome-keyring0 from 3.0.3-1~natty1 to 2.32.0-1ubuntu2.
Preparing to replace libgnome-keyring0 3.0.3-1~natty1 (using .../libgnome-keyring0_2.32.0-1ubuntu2_amd64.deb) ...
Unpacking replacement libgnome-keyring0 ...
dpkg: warning: downgrading gnome-keyring from 3.0.3-2~natty1 to 2.92.92.is.2.32.1-0ubuntu2.
Preparing to replace gnome-keyring 3.0.3-2~natty1 (using .../gnome-keyring_2.92.92.is.2.32.1-0ubuntu2_amd64.deb) ...
Unpacking replacement gnome-keyring ...
dpkg: warning: downgrading gconf2 from 2.32.4-1ubuntu1~natty1 to 2.32.2-0ubuntu2.
Preparing to replace gconf2 2.32.4-1ubuntu1~natty1 (using .../gconf2_2.32.2-0ubuntu2_amd64.deb) ...
Unpacking replacement gconf2 ...
dpkg: warning: downgrading file-roller from 3.0.2-0ubuntu1~natty1 to 2.32.1-0ubuntu4.
Preparing to replace file-roller 3.0.2-0ubuntu1~natty1 (using .../file-roller_2.32.1-0ubuntu4_amd64.deb) ...
Unpacking replacement file-roller ...
dpkg: warning: downgrading evince from 3.0.2-0ubuntu4~natty1 to 2.32.0-0ubuntu12.
Preparing to replace evince 3.0.2-0ubuntu4~natty1 (using .../evince_2.32.0-0ubuntu12_amd64.deb) ...
Unpacking replacement evince ...
dpkg: error processing /var/cache/apt/archives/evince_2.32.0-0ubuntu12_amd64.deb (--unpack):
 trying to overwrite '/usr/share/glib-2.0/schemas/org.gnome.Evince.gschema.xml', which is also in package evince-common 3.0.2-0ubuntu4~natty1
No apport report written because MaxReports is reached already
                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
dpkg: warning: downgrading totem-plugins from 3.0.1-0ubuntu2~natty1 to 2.32.0-0ubuntu10.
Preparing to replace totem-plugins 3.0.1-0ubuntu2~natty1 (using .../totem-plugins_2.32.0-0ubuntu10_amd64.deb) ...
Unpacking replacement totem-plugins ...
dpkg: warning: downgrading totem-mozilla from 3.0.1-0ubuntu2~natty1 to 2.32.0-0ubuntu10.
Preparing to replace totem-mozilla 3.0.1-0ubuntu2~natty1 (using .../totem-mozilla_2.32.0-0ubuntu10_amd64.deb) ...
Unpacking replacement totem-mozilla ...
Processing triggers for man-db ...
Processing triggers for libglib2.0-0 ...
Processing triggers for python-gmenu ...
Rebuilding /usr/share/applications/desktop.en_US.utf8.cache...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for desktop-file-utils ...
Processing triggers for hicolor-icon-theme ...
Processing triggers for python-support ...
Errors were encountered while processing:
 /var/cache/apt/archives/evince_2.32.0-0ubuntu12_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up libpolkit-gobject-1-0 (0.101-1ubuntu1) ...
Setting up libgcr0 (2.92.92.is.2.32.1-0ubuntu2) ...
Setting up gconf2-common (2.32.2-0ubuntu2) ...
Setting up gnome-keyring (2.92.92.is.2.32.1-0ubuntu2) ...
Installing new version of config file /etc/xdg/autostart/gnome-keyring-pkcs11.desktop ...
Installing new version of config file /etc/xdg/autostart/gnome-keyring-secrets.desktop ...
Installing new version of config file /etc/xdg/autostart/gnome-keyring-ssh.desktop ...
dpkg: dependency problems prevent configuration of totem-mozilla:
 totem-mozilla depends on totem (= 2.32.0-0ubuntu10); however:
  Version of totem on system is 3.0.1-0ubuntu2~natty1.
dpkg: error processing totem-mozilla (--configure):
 dependency problems - leaving unconfigured
Setting up libcanberra0 (0.28-0ubuntu3) ...
Setting up libcanberra-gtk0 (0.28-0ubuntu3) ...
dpkg: dependency problems prevent configuration of totem-plugins:
 totem-plugins depends on totem (= 2.32.0-0ubuntu10); however:
  Version of totem on system is 3.0.1-0ubuntu2~natty1.
dpkg: error processing totem-plugins (--configure):
 dependency problems - leaving unconfigured
Setting up libgnome-keyring0 (2.32.0-1ubuntu2) ...
Setting up libgconf2-4 (2.32.2-0ubuntu2) ...
Setting up libcanberra-pulse (0.28-0ubuntu3) ...
Setting up gconf2 (2.32.2-0ubuntu2) ...
Setting up file-roller (2.32.1-0ubuntu4) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Errors were encountered while processing:
 totem-mozilla
 totem-plugins
Current status: 2 broken [+2].
Warning:  Something went wrong, packages may not have been reverted

Fix totem by uninstalling the ppa:gnome3-team/gnome3 packages and installing the packages from the standard Ubuntu Natty repository:

root@ubuntu:~# aptitude purge totem-common totem totem-mozilla totem-plugins
root@ubuntu:~# aptitude install totem totem-common totem-mozilla totem-plugins
The following NEW packages will be installed:
  totem totem-common totem-mozilla totem-plugins
0 packages upgraded, 4 newly installed, 0 to remove and 1 not upgraded.

Remove GNOME 3 gnome-shell:

root@ubuntu:~# aptitude remove gnome-shell
The following packages will be REMOVED:
  gnome-shell
0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 4,084 kB will be freed.
(Reading database ... 140981 files and directories currently installed.)
Removing gnome-shell ...
Processing triggers for libglib2.0-0 ...
Processing triggers for python-gmenu ...
Rebuilding /usr/share/applications/desktop.en_US.utf8.cache...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for desktop-file-utils ...
Processing triggers for gconf2 ...
Processing triggers for man-db ...
Processing triggers for python-support ...
Current status: 32013 new [-1].

Once you reboot, you should be able to choose Ubuntu (Unity) for your desktop session.

References

Installing Sun Java Non-interactively

In order to install the Sun Java packages on Debian or Ubuntu, you must first accept Sun’s license. Normally you are suppose to do this through an interactive menu. In order to get around this license prompt you can accept the license prior to installing the package.
Create a file containing the following lines:

sun-java5-jdk shared/accepted-sun-dlj-v1-1 select true
sun-java5-jre shared/accepted-sun-dlj-v1-1 select true
sun-java6-jdk shared/accepted-sun-dlj-v1-1 select true
sun-java6-jre shared/accepted-sun-dlj-v1-1 select true

Then run /usr/bin/debconf-set-selections as root. Now you should not be prompted to accept the license anymore.

References

Determine files associated to a package in APT

Fetch Contents files from apt-sources

root@ubuntu:~# apt-file update
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 16.7M  100 16.7M    0     0  13.2M      0  0:00:01  0:00:01 --:--:-- 13.3M
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid-updates/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 5738k  100 5738k    0     0  8368k      0 --:--:-- --:--:-- --:--:-- 8389k
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid-security/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 3321k  100 3321k    0     0   9.7M      0 --:--:-- --:--:-- --:--:--  9.8M
Downloading Index http://mirror.anl.gov/ubuntu/dists/lucid/Contents-amd64.diff/Index:
No Index available.
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
File is up-to-date.
Downloading Index http://mirror.anl.gov/ubuntu/dists/lucid-updates/Contents-amd64.diff/Index:
No Index available.
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid-updates/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
File is up-to-date.
Downloading Index http://mirror.anl.gov/ubuntu/dists/lucid-security/Contents-amd64.diff/Index:
No Index available.
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid-security/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
File is up-to-date.
Downloading Index http://mirror.anl.gov/ubuntu/dists/lucid/Contents-amd64.diff/Index:
No Index available.
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
File is up-to-date.
Downloading Index http://mirror.anl.gov/ubuntu/dists/lucid-updates/Contents-amd64.diff/Index:
No Index available.
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid-updates/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
File is up-to-date.
Downloading Index http://mirror.anl.gov/ubuntu/dists/lucid-security/Contents-amd64.diff/Index:
No Index available.
Downloading complete file http://mirror.anl.gov/ubuntu/dists/lucid-security/Contents-amd64.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
File is up-to-date.
Ignoring source without Contents File:
  http://archive.canonical.com/dists/lucid/Contents-amd64.gz

Find what package installs a file

root@ubuntu:~# apt-file search /etc/init/upstart-udev-bridge.conf
upstart: /etc/init/upstart-udev-bridge.conf

List the files installed by a package

root@ubuntu:~# apt-file list upstart
brltty: /usr/share/doc/brltty/examples/upstart.job
cloud-init: /usr/share/doc/cloud-init/examples/upstart-cloud-config.txt
cloud-init: /usr/share/doc/cloud-init/examples/upstart-rclocal.txt
debhelper: /usr/share/debhelper/autoscripts/postinst-upstart
debhelper: /usr/share/debhelper/autoscripts/postinst-upstart-replace
debhelper: /usr/share/debhelper/autoscripts/postinst-upstart-restart
debhelper: /usr/share/debhelper/autoscripts/prerm-upstart
debhelper: /usr/share/debhelper/autoscripts/prerm-upstart-norestart
ebox-openvpn: /usr/share/ebox/stubs/openvpn/upstart.mas
ifupdown: /etc/network/if-down.d/upstart
ifupdown: /etc/network/if-up.d/upstart
...

How to Change a Network Device's MAC Address

root@ubuntu:~# ifconfig -a wlan0
wlan0     Link encap:Ethernet  HWaddr FF:FF:FF:FF:FF:FF
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:66769 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9225 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:22089814 (22.0 MB)  TX bytes:1509599 (1.5 MB)
root@ubuntu:~# ifconfig wlan0 down
root@ubuntu:~# ifconfig wlan0 hw ether AA:AA:AA:AA:AA:AA
root@ubuntu:~# ifconfig wlan0 up
root@ubuntu:~# ifconfig -a wlan0
wlan0     Link encap:Ethernet  HWaddr AA:AA:AA:AA:AA:AA
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:66977 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9399 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:22181538 (22.1 MB)  TX bytes:1534290 (1.5 MB)

References

How to Mount an Encrypted LVM Partition

root@ubuntu:~# fdisk -l
Disk /dev/sda: 128.0 GB, 128035676160 bytes
255 heads, 63 sectors/track, 15566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a735a
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          61      487424   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              61       15567   124546048   83  Linux
root@ubuntu:~# ls /dev/mapper/
control
root@ubuntu:~# cryptsetup luksOpen /dev/sda2 encrypted-partition
Enter passphrase for /dev/sda2:
Key slot 0 unlocked.
root@ubuntu:~# ls /dev/mapper/
control  encrypted-partition
root@ubuntu:~# mkdir /mnt/encrypted-partition
root@ubuntu:~# mount /dev/mapper/encrypted-partition /mnt/encrypted-partition/
mount: unknown filesystem type 'LVM2_member'
root@ubuntu:~# apt-get install lvm2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libdevmapper-event1.02.1 watershed
The following NEW packages will be installed:
  libdevmapper-event1.02.1 lvm2 watershed
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 447kB of archives.
After this operation, 1,282kB of additional disk space will be used.
Do you want to continue [Y/n]? y
root@ubuntu:~# sudo /sbin/modprobe dm-mod
root@ubuntu:~# /sbin/lsmod | grep dm_crypt
dm_crypt               11331  1
root@ubuntu:~# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "system" using metadata type lvm2
root@ubuntu:~# vgchange -ay system
  3 logical volume(s) in volume group "system" now active
root@ubuntu:~# lvs
  LV   VG     Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  root system -wi-ao 113.19g
  swap system -wi-a-   2.79g
  tmp  system -wi-a-   2.79g
root@ubuntu:~# ls /dev/mapper/
control  encrypted-partition  system-root  system-swap  system-tmp
root@ubuntu:~# mount /dev/mapper/system-root /mnt/encrypted-partition/
root@ubuntu:~# ls /mnt/encrypted-partition/
bin   etc         initrd.img.old  lost+found  opt   sbin     sys  var
boot  home        lib             media       proc  selinux  tmp  vmlinuz
dev   initrd.img  lib64           mnt         root  srv      usr  vmlinuz.old

Unmount

root@ubuntu:~# umount /mnt/system-root
root@ubuntu:~# cryptsetup remove encrypted-partition

References

Replace a failed drive in a software RAID

View kenel log to detect a possible failing hard drive

root@ubuntu:~# dmesg
[ 886.492585] sdb: Current: sense key: Recovered Error
[ 886.497903] Additional sense: Recovered data with retries
[ 886.504060] Info fld=0xdf82e1
[ 919.421181] sdb: Current: sense key: Recovered Error
[ 919.426474] Additional sense: Recovered data without ECC - recommend rewrite
[ 919.434375] Info fld=0xd66a9a
[ 1728.424643] sdb: Current: sense key: Recovered Error
[ 1728.429945] Additional sense: Recovered data without ECC - data auto-real
located
[ 1728.438197] Info fld=0xccc0fe
[ 1731.086946] sdb: Current: sense key: Recovered Error
[ 1731.092252] Additional sense: Recovered data without ECC - data auto-real
located
[ 1731.100514] Info fld=0xccb675

Perform SMART test on drive

Install SMART tools

root@ubuntu:~# aptitude install smartmontools

Run SMART tests

root@ubuntu:~# smartctl --test=long /dev/sdb
root@ubuntu:~# smartctl -a /dev/sdb
smartctl version 5.34 [x86_64-unknown-linux-gnu] Copyright (C) 2002-5 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
Device: FUJITSU MAV2073RCSUN72G Version: 0301
Serial number: 000535S00AUB
Device type: disk
Transport protocol: SAS
Local Time is: Sat Jan 29 14:22:13 2011 CST
Device supports SMART and is Enabled
Temperature Warning Disabled or Not Supported
SMART Health Status: OK
Current Drive Temperature: 27 C
Drive Trip Temperature: 65 C
Manufactured in week 35 of year 2005
Current start stop count: 43 times
Recommended maximum start stop count: 10000 times
Elements in grown defect list: 355
Error counter log:
Errors Corrected by Total Correction Gigabytes Total
ECC rereads/ errors algorithm processed uncorrected
fast | delayed rewrites corrected invocations [10^9 bytes] errors
read: 0 530114 1342 1342 0 78930.620 0
write: 0 2 0 0 0 38013.435 0
Non-medium error count: 44
SMART Self-test log
Num Test Status segment LifeTime LBA_first_err [SK
ASC ASQ]
Description number (hours)
# 1 Background long Failed in segment --> 9 42754 13399317 [0x3
0x11 0x1]
# 2 Background long Failed in segment --> 9 42635 13399317 [0x3
0x11 0x1]
# 3 Background short Completed - 42635 - [- -
-]
# 4 Background long Failed in segment --> 9 42634 13398730 [0x3
0x11 0x1]
Long (extended) Self Test duration: 2233 seconds [37.2 minutes]
root@ubuntu:~# fdisk -l
Disk /dev/sda: 73.4 GB, 73407865856 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          12       96358+  fd  Linux raid autodetect
/dev/sda2              13        8924    71585640   fd  Linux raid autodetect
Disk /dev/sdb: 73.4 GB, 73407865856 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1          12       96358+  fd  Linux raid autodetect
/dev/sdb2              13        8924    71585640   fd  Linux raid autodetect
Disk /dev/sdc: 73.4 GB, 73407865856 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        8924    71681998+  83  Linux
Disk /dev/sdd: 73.4 GB, 73407865856 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1        8924    71681998+  83  Linux
Disk /dev/md0: 98 MB, 98566144 bytes
2 heads, 4 sectors/track, 24064 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk /dev/md0 doesn't contain a valid partition table
Disk /dev/md1: 73.3 GB, 73303588864 bytes
2 heads, 4 sectors/track, 17896384 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk /dev/md1 doesn't contain a valid partition table
Disk /dev/md2: 73.4 GB, 73402286080 bytes
2 heads, 4 sectors/track, 17920480 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk /dev/md2 doesn't contain a valid partition table
root@ubuntu:~# cat /proc/mdstat
Personalities : [raid1]
md2 : active raid1 sdc1[0] sdd1[1]
      71681920 blocks [2/2] [UU]
md1 : active raid1 sda2[0] sdb2[1]
      71585536 blocks [2/2] [UU]
md0 : active raid1 sda1[0] sdb1[1]
      96256 blocks [2/2] [UU]
unused devices: <none>
root@ubuntu:~# mdadm --query --detail /dev/md0
/dev/md0:
        Version : 00.90.03
  Creation Time : Wed Feb  8 17:29:05 2006
     Raid Level : raid1
     Array Size : 96256 (94.02 MiB 98.57 MB)
    Device Size : 96256 (94.02 MiB 98.57 MB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 0
    Persistence : Superblock is persistent
    Update Time : Mon Jan 31 06:26:13 2011
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0
           UUID : 96c88b09:82b06262:679309e4:bbe2fe4f
         Events : 0.20160
    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       1       8       17        1      active sync   /dev/sdb1
root@ubuntu:~# mdadm --query --detail /dev/md1
/dev/md1:
        Version : 00.90.03
  Creation Time : Wed Feb  8 17:29:25 2006
     Raid Level : raid1
     Array Size : 71585536 (68.27 GiB 73.30 GB)
    Device Size : 71585536 (68.27 GiB 73.30 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 1
    Persistence : Superblock is persistent
    Update Time : Mon Jan 31 17:42:26 2011
          State : active
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0
           UUID : 6154cd5a:edf5f628:28d7a268:ad434b95
         Events : 0.59383068
    Number   Major   Minor   RaidDevice State
       0       8        2        0      active sync   /dev/sda2
       1       8       18        1      active sync   /dev/sdb2

Remove the Failed Drive

root@ubuntu:~# mdadm --manage /dev/md0 --fail /dev/sdb1
mdadm: set /dev/sdb1 faulty in /dev/md0
root@ubuntu:~# cat /proc/mdstat
Personalities : [raid1]
md2 : active raid1 sdc1[0] sdd1[1]
      71681920 blocks [2/2] [UU]
md1 : active raid1 sda2[0] sdb2[1]
      71585536 blocks [2/2] [UU]
md0 : active raid1 sda1[0] sdb1[2](F)
      96256 blocks [2/1] [U_]
unused devices: <none>
root@ubuntu:~# mdadm --manage /dev/md0 --remove /dev/sdb1
mdadm: hot removed /dev/sdb1
root@ubuntu:~# cat /proc/mdstat
Personalities : [raid1]
md2 : active raid1 sdc1[0] sdd1[1]
      71681920 blocks [2/2] [UU]
md1 : active raid1 sda2[0] sdb2[1]
      71585536 blocks [2/2] [UU]
md0 : active raid1 sda1[0]
      96256 blocks [2/1] [U_]
unused devices: <none>
root@ubuntu:~# mdadm --manage /dev/md1 --fail /dev/sdb2
mdadm: set /dev/sdb2 faulty in /dev/md1
root@ubuntu:~# cat /proc/mdstat
Personalities : [raid1]
md2 : active raid1 sdc1[0] sdd1[1]
      71681920 blocks [2/2] [UU]
md1 : active raid1 sda2[0] sdb2[2](F)
      71585536 blocks [2/1] [U_]
md0 : active raid1 sda1[0]
      96256 blocks [2/1] [U_]
unused devices: <none>
root@ubuntu:~# mdadm --manage /dev/md1 --remove /dev/sdb2
mdadm: hot removed /dev/sdb2
root@ubuntu:~# cat /proc/mdstat
Personalities : [raid1]
md2 : active raid1 sdc1[0] sdd1[1]
      71681920 blocks [2/2] [UU]
md1 : active raid1 sda2[0]
      71585536 blocks [2/1] [U_]
md0 : active raid1 sda1[0]
      96256 blocks [2/1] [U_]
unused devices: <none>

Replace Drive

Power down the server and replace the failed physical drive.

Add new Drive to RAID

Verify current partition information

root@ubuntu:~# sfdisk -d /dev/sda
# partition table of /dev/sda
unit: sectors
/dev/sdb1 : start=       63, size=   192779, Id=fd, bootable
/dev/sdb2 : start=   192780, size=143364059, Id=fd
/dev/sdb3 : start=        0, size=        0, Id= 0
/dev/sdb4 : start=        0, size=        0, Id= 0

Copy the partition information over

root@ubuntu:~# sfdisk -d /dev/sda | sfdisk /dev/sdb
Checking that no-one is using this disk right now ...
OK
Disk /dev/sdb: 8924 cylinders, 255 heads, 63 sectors/track
sfdisk: ERROR: sector 0 does not have an msdos signature
 /dev/sdb: unrecognized partition table type
Old situation:
No partitions found
New situation:
Units = sectors of 512 bytes, counting from 0
   Device Boot    Start       End   #sectors  Id  System
/dev/sdb1   *        63    192779     192717  fd  Linux raid autodetect
/dev/sdb2        192780 143364059  143171280  fd  Linux raid autodetect
/dev/sdb3             0         -          0   0  Empty
/dev/sdb4             0         -          0   0  Empty
Successfully wrote the new partition table
Re-reading the partition table ...
If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)

Verify partition information

root@ubuntu:~# fdisk -l /dev/sda /dev/sdb
Disk /dev/sda: 73.4 GB, 73407865856 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          12       96358+  fd  Linux raid autodetect
/dev/sda2              13        8924    71585640   fd  Linux raid autodetect
Disk /dev/sdb: 73.4 GB, 73407865856 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1          12       96358+  fd  Linux raid autodetect
/dev/sdb2              13        8924    71585640   fd  Linux raid autodetect

Add new drive partitions to software RAID

root@ubuntu:~# mdadm --manage /dev/md0 --add /dev/sdb1
mdadm: hot added /dev/sdb1
root@ubuntu:~# mdadm --manage /dev/md1 --add /dev/sdb2
mdadm: hot added /dev/sdb2
root@ubuntu:~# cat /proc/mdstat
Personalities : [raid1]
md2 : active raid1 sdc1[0] sdd1[1]
      71681920 blocks [2/2] [UU]
md1 : active raid1 sdb2[2] sda2[0]
      71585536 blocks [2/1] [U_]
      [>....................]  recovery =  0.1% (97408/71585536) finish=73.3min speed=16234K/sec
md0 : active raid1 sdb1[1] sda1[0]
      96256 blocks [2/2] [UU]
unused devices: <none>

Verify that the RAID build process eventually finishes successfully

root@ubuntu:~# cat /proc/mdstat
Personalities : [raid1]
md2 : active raid1 sdc1[0] sdd1[1]
      71681920 blocks [2/2] [UU]
md1 : active raid1 sdb2[1] sda2[0]
      71585536 blocks [2/2] [UU]
md0 : active raid1 sdb1[1] sda1[0]
      96256 blocks [2/2] [UU]
unused devices: <none>

Make Disks Bootable with Grub

If the drive you replaced contains the boot partition, you need to make it bootable by Grub once again.

/dev/sda

root@ubuntu:~# grub
Probing devices to guess BIOS drives. This may take a long time.
       [ Minimal BASH-like line editing is supported.   For
         the   first   word,  TAB  lists  possible  command
         completions.  Anywhere else TAB lists the possible
         completions of a device/filename. ]
grub> device (hd0) /dev/sda
grub> root (hd0,0)
grub> setup (hd0)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... yes
 Checking if "/grub/stage2" exists... yes
 Checking if "/grub/e2fs_stage1_5" exists... yes
 Running "embed /grub/e2fs_stage1_5 (hd0)"...  16 sectors are embedded.
succeeded
 Running "install /grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/grub/stage2 /grub/menu.lst"... succeeded
Done.
grub> quit

/dev/sdb

root@ubuntu:~# grub
Probing devices to guess BIOS drives. This may take a long time.
       [ Minimal BASH-like line editing is supported.   For
         the   first   word,  TAB  lists  possible  command
         completions.  Anywhere else TAB lists the possible
         completions of a device/filename. ]
grub> device (hd1) /dev/sdb
grub> root (hd1,0)
grub> setup (hd1)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... yes
 Checking if "/grub/stage2" exists... yes
 Checking if "/grub/e2fs_stage1_5" exists... yes
 Running "embed /grub/e2fs_stage1_5 (hd1)"...  16 sectors are embedded.
succeeded
 Running "install /grub/stage1 (hd1) (hd1)1+16 p (hd1,0)/grub/stage2 /grub/menu.lst"... succeeded
Done.
grub> quit
root@ubuntu:~#

References

  • http://www.howtoforge.com/replacing_hard_disks_in_a_raid1_array

Force consistant hardware mappings across reboots

Partition mount points

/etc/fstab

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# /dev/mapper/system-root /
UUID=1e6d957c-5f9f-484e-99cb-4c068ac16ba1 / ext4 noatime,errors=remount-ro 0 1
# /dev/md0 /boot
UUID=39b8423d-e831-40f8-8ab6-c16aff22a984 /boot ext4 noatime 0 2
# /dev/mapper/system-home /home
UUID=b0677542-d6ca-4d80-8dec-e89d02433b4c /home ext4 noatime 0 2
# /dev/mapper/system-tmp /tmp
UUID=95dd18be-815c-40e6-8713-a9b64daf3b0c /tmp ext4 noatime 0 2
# /dev/mapper/system-var /var
UUID=c6c23b39-b611-4b2c-b172-51cbb6d93696 /var ext4 noatime 0 2
# /dev/mapper/system-swap swap
UUID=9be44e9c-d7f6-424e-8d94-7757ce89509c none swap sw 0 0

References

Hard drives

Network interfaces

/etc/udev/rules.d/70-persistent-net.rules

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x10de:0x0057 (forcedeth)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:14:4f:49:f7:18", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x10de:0x0057 (forcedeth)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:14:4f:49:f7:19", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x8086:0x1010 (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:14:4f:49:f7:1a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
# PCI device 0x8086:0x1010 (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:14:4f:49:f7:1b", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

RAID Devices

/etc/mdadm/mdadm.conf

# mdadm.conf
#
# Please refer to mdadm.conf(5) for information about this file.
#
# by default, scan all partitions (/proc/partitions) for MD superblocks.
# alternatively, specify devices to scan, using wildcards if desired.
DEVICE partitions
# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes
# automatically tag new arrays as belonging to the local system
HOMEHOST <system>
# instruct the monitoring daemon where to send mail alerts
MAILADDR root
# definitions of existing MD arrays
ARRAY /dev/md0 level=raid1 num-devices=2 UUID=0b97a661:714c0c61:55ac34b1:8b37b7ca
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=4433950a:a2b749b8:9600c122:bd466c99

Generate a list of installed packages

Generate the list of installed packages. Exclude those packages that have been removed

dpkg --get-selections | grep -v deinstall > installed-packages.txt
acpi-support                                    install
acpid                                           install
adduser                                         install
adium-theme-ubuntu                              install
aisleriot                                       install
akonadi-server                                  install
alacarte                                        install
alsa-base                                       install
alsa-utils                                      install
anacron                                         install
...

Use this list on another system to set what to install

sudo dpkg --set-selections < installed-packages.txt

Perform the installation. Type ‘I‘ and allow dselect to install of the the packages listed in your list. When it’s finished, type ‘Q‘ and hit the ENTER key to exit dselect.

sudo dselect

If you just want a clean list of installed packages

dpkg --get-selections | grep -v deinstall | cut -f 1 > installed-packages.txt
acpi-support
acpid
adduser
adium-theme-ubuntu
aisleriot
akonadi-server
alacarte
alsa-base
alsa-utils
anacron
...

References