Wed, 10 Nov 2010

Webalizer and GeoIP

Keywords: Webalizer Geoip database package missing dependency

I was getting the following error message from cron:

Error Opening file /usr/share/GeoIP/GeoIP.dat

Turns out it was coming from webalizer. It seems that there is a package dependency missing. The solution was fairly simple:

aptitude install geoip-database

[/unix] permanent link

Mon, 18 Oct 2010

Ubuntu 10.10 crashes running under VirtualBox 3.2.10.

Keywords: Virtualbox Ubuntu 10.10 crashes timer noapictimer nohz=off highres=off grub

I recently bought myself a new laptop. It's a rather nice HP Envy 14. Unfortunately no linux distribution properly supports it yet and so I run a Ubuntu guest virtual machine on it under VirtualBox with Windows 7 as the host.

Recently the VM started crashing. It would stop accepting keyboard input, and wouldn't shut itself down nicely using the mouse either from within Ubuntu or from VirtualBox. The only solution was to get VirtualBox to poweroff the VM. I upgraded Ubuntu to 10.10 and VirtualBox to 3.2.10, hoping to fix the problem, but it didn't help.

What did help though, was adding the following startup options:

noapictimer nohz=off highres=off

These can be added to the GRUB_CMDLINE_LINUX_DEFAULT line in /etc/default/grub, then run update-grub and the problem seems to be fixed.

Although sound under a VM isn't really the best idea, I just can't find any music players that I like which run under windows, and so I use Amarok 1.4. (No, I don't like Amarok 2.) Previously I was getting more frequent crashes whilst playing music. With this fix I've not had any crashes, even when playing flac files. Looking at the solution, this makes sense.

[/software/virtualbox] permanent link

Sun, 10 Oct 2010

Installing VirtualBox guest additions on a Ubuntu 10.10 guest

Keywords: Virtualbox Ubuntu 10.10 X server guest additions

Adding VirtualBox guest additions to a Ubuntu 10.10 guest fails for the X server, since 10.10 includes a later version than the guest additions are expecting.

The solution:

$ sudo aptitude install virtualbox-ose-guest-x11

[/software/virtualbox] permanent link

Sat, 09 Oct 2010

Updating the copyright on gallery2

Keywords: copyright gallery2 carbon

I use the Carbon theme on gallery2. The copyright in the footer can be updated via the theme configuration on the web.

[/software/gallery] permanent link

Sat, 25 Sep 2010

Splitting a git repository

Keywords: git directory subdirectory separate detach filter-branch

I had a bunch of directories in a single git repository and I wanted to make each one into its own repository. It turns out to be fairly simple. Suppose that the original repository is called orig and the directories in it are called dir1, dir2 etc. For each directory:

$ git clone --no-hardlinks orig dir1
$ cd dir1
$ git filter-branch --subdirectory-filter dir1 HEAD -- --all
$ git remote rm origin
$ rm -r .git/refs/original/
$ git reflog expire --expire=now --all
$ git gc --aggressive
$ git prune
$ du -sh *
$ git log

[/revision_control] permanent link

Sat, 03 Jul 2010

Floating menu items left on screen in Windows

Keywords: Windows floating menu items left screen dwm

Sometimes, under Windows, a floating menu item gets left on the screen. It's possible it may have something to do with Chrome. The only way to get rid of it is to reboot the machine. (Or maybe logging out works, I don't think I ever tried.) Well, obviously neither of those options is particularly attractive, but it turns out there is another. better option. Killing the dwm.exe process fixes the problem far more satisfactorily.

dwm.exe is the Desktop Window Manager which looks after thiings such as the 3D effects and transparencies. When it is killed it simply restarts itself.

[/software/windows] permanent link

Fri, 02 Jul 2010

Copying a MySQL database

Keywords: copy mysql database db directory files disk partition machine

I wanted to copy a MySQL database on a disk that used to be attached to a Ubuntu machine that died, to its replacement. It turns out not to be too difficult.

# stop mysql
# mv /var/lib/mysql /var/lib/mysql.orig
# cp -a /media/old-disk/var/lib/mysql /var/lib
# chown -R mysql:mysql /var/lib/mysql

There were a couple of files in /var/lib/mysql that were owned by root - mysql_upgrade_info and debian-5.1.flag in my case. Change them back to being owned by root.

# start mysql

I actually had to reboot since something hung on restarting mysql. I have no idea why. Logs can be found in /var/log/mysql/error.log if required.

[/software/mysql] permanent link

Mon, 28 Jun 2010

Cron on a Linksys WRT54G Router

Keywords: linksys wrt54g router alchemy

Every so often my Linksys WRT54G router will stop accepting connections. The simplest solution is just to reboot it. The trouble occurs when that happens and I am not near the router. So I wanted to set up a cron job to reboot it every night.

ssh into the router and run these commands:

nvram set rc_startup='#!/bin/sh
echo "0 5 * * * root /sbin/reboot" > /tmp/cron.d/reboot
touch /tmp/crontab
nvram commit
nvram get rc_startup

The first four lines set up a startup command which writes the cron line after each reboot, and touches the crontab to get cron to reload. The fifth line commits the command to the nvram and the final command simply prints it out to check.

[/unix] permanent link

Sun, 06 Jun 2010


Keywords: iPhone iTunes error 0xE8000041

If you get the error 0xE8000041 from iTunes when trying to sync apps on the iPhone, you need to run the following command on your iPhone:

# chown mobile:mobile /var/mobile/Applications/

Well, I did anyway. The previous owner was root.wheel. The permissions are 777.

[/unix/iPhone] permanent link

Mon, 17 May 2010

Marking spam in mutt with spamassasin

Keywords: mutt spam spamassasin macro

For far too long I had fairly simple macros for mutt which would train spamassasin on a single message and then chuck it in my spam folder. It worked well, but only on single messages. I wanted something that would also work on a set of tagged messages in a reasonable time. Eventually I got around to working out how to do it.

Mutt has the limitation that for the pager the macro will not work on tagged messages, but I kept the macros the same as for the index for simplicity.

Here they are:

macro index S "<enter-command>set auto_tag=yes<enter><enter-command>unset wait_key<enter>WoC=learnspam<enter>\
<pipe-entry>sa-learn --spam --progress --mbox ~/Mail/learnspam && cat /dev/null > ~/Mail/learnspam<enter>\
s=spam<enter><enter-command>set wait_key<enter><enter-command>set auto_tag=no<enter>"

macro pager S "<enter-command>set auto_tag=yes<enter><enter-command>unset wait_key<enter>WoC=learnspam<enter><\
pipe-entry>sa-learn --spam --progress --mbox ~/Mail/learnspam && cat /dev/null > ~/Mail/learnspam<enter>\
s=spam<enter><enter-command>set wait_key<enter><enter-command>set auto_tag=no<enter>"

macro index H "<enter-command>set auto_tag=yes<enter><enter-command>unset wait_key<enter>C=learnspam<enter>\
<pipe-entry>sa-learn --ham --progress --mbox ~/Mail/learnspam && cat /dev/null > ~/Mail/learnspam<enter>\
s=spam<enter><enter-command>set wait_key<enter><enter-command>set auto_tag=no<enter>"

macro pager H "<enter-command>set auto_tag=yes<enter><enter-command>unset wait_key<enter>C=learnspam<enter>\
<pipe-entry>sa-learn --ham --progress --mbox ~/Mail/learnspam && cat /dev/null > ~/Mail/learnspam<enter>\
s=spam<enter><enter-command>set wait_key<enter><enter-command>set auto_tag=no<enter>"

[/software/mutt] permanent link

Tue, 20 Apr 2010

Disks and UUIDs

Keywords: linux ubuntu disk mount fstab uuid

Linux likes to use UUIDs nowadays instead to the older /dev/hda1 format. The ways to find the UUID is to run

# blkid

[/unix] permanent link

Sun, 18 Apr 2010

Installing a raw disk in VirtualBox

Adding a raw disk to VirtualBox is a lot harder than it is with vmware. Here's how to do it on Windows 7:

cd "\Program Files\Sun\VirtualBox"
VBoxManage internalcommands createrawvmdk -filename C:\Users\pjcj\.VirtualBox\HardDisks\1.5TB.vmdk -rawdisk \\.\PhysicalDrive1

I had to start the command prompt window an administrator in order to be able to do this. I then had to start VirtualBox as administrator in order to be able to add the disk from the Virtual Device Manager.

Update 19.06.2010:

Oracle bought Sun. The path is now:

cd "\Program Files\Oracle\VirtualBox"

But more importantly, if you do as I said above and do all this as an administrator, then you can't connect any USB devices, which is a shame. The solution to this, such as it is, is to turn off UAC (User Access Control). Type UAC into the start menu and drag the slider down to the bottom. Reboot, acknowledge that you are doing something silly, and off you go.

[/software/virtualbox] permanent link

Thu, 18 Feb 2010

Canon PIXMA MX860 on Ubuntu 9.10

Keywords: Canon PIXMA MX860 ubuntu install

MX860 drivers for printing and scanning can be downloaded from Canon. Uncompress them and cd into the created directory:

$ tar xvzf cnijfilter-mx860series-3.10-1-i386-deb.tar.gz
$ cd cnijfilter-mx860series-3.10-1-i386-deb

Installation is performed by runing the script. The script tries to determine whether to use rpm or dpkg but got confused when it found both on my system. This can be fixed quite easily by forcing the issue:

$ perl -pi.bak -e 's/rpm --version/XXX/'

Then install with:

$ sudo ./

Do exactly the same with the driver for the scanner, scangearmp-mx860series-1.30-1-i386-deb

If the printer is already on the network it can be configured with System -> Administration -> Printing and then clicking on New.

[/unix] permanent link

Tue, 09 Feb 2010

Amarok 1.4 on Ubuntu 9.10

Keywords: ubuntu 9.10 amarok 1.4

I still don't like Amarok 2, so here's how I installed Amarok 1.4 on Ubuntu 9.10.

wget ''
wget ''
wget ''
aptitude install ruby libtunepimp5 libqt3-mt libnjb5 libmysqlclient15off libifp4 kdelibs4c2a libtunepimp5-mp3
dpkg -i amarok14-common_1.4.10-0ubuntu3\~ppa4_all.deb
dpkg -i amarok14-engine-xine_1.4.10-0ubuntu3\~ppa4_i386.deb
dpkg -i amarok14_1.4.10-0ubuntu3\~ppa4_i386.deb
apt-get install -f

See these two posts.

Update: 27.03.2010

wget ''
wget ''
wget ''
aptitude install ruby libtunepimp5 libqt3-mt libnjb5 libmysqlclient15off libifp4 kdelibs4c2a libtunepimp5-mp3
dpkg -i amarok14-common_1.4.10-0ubuntu3\~ppa5_all.deb amarok14_1.4.10-0ubuntu3\~ppa5_amd64.deb amarok14-engine-xine_1.4.10-0ubuntu3\~ppa5_amd64.deb

Update: 13.06.2010

For Ubuntu 10.04:

wget ''
wget ''
wget ''
dpkg -i libmysqlclient15off_5.1.30really5.0.83-0ubuntu3_amd64.deb
aptitude install ruby libtunepimp5 libqt3-mt libnjb5 libifp4 kdelibs4c2a libtunepimp5-mp3 libpq5
dpkg -i amarok14-common_1.4.10-0ubuntu3\~ppa5_all.deb amarok14_1.4.10-0ubuntu3\~ppa5_amd64.deb amarok14-engine-xine_1.4.10-0ubuntu3\~ppa5_amd64.deb

See this post to download libmysqlclient15off from [ here] for amd64.

[/software/amarok] permanent link

Fri, 05 Feb 2010

Ubuntu packages on a new system

Keywords: ubuntu package

Here are the packages I added to a new Ubuntu 9.10 system:

apt-get install aptitude
aptitude update
aptitude full-upgrade
aptitude install openssh-server
aptitude install ubuntu-restricted-extras kubuntu-restricted-extras
cd /etc/apt/sources.list.d/
wget$(lsb_release -cs).list
apt-get -q update
apt-get --yes -q --allow-unauthenticated install medibuntu-keyring
apt-get -q update
aptitude install zsh vlc libdvdcss2 non-free-codecs mplayer \
                 vim-gnome exuberant-ctags nfs-client git-core \
                 git-doc gitk thunderbird ktorrent p7zip gimp \
                 acroread acroread-fonts compizconfig-settings-manager \
                 auto-apt graphicsmagick-imagemagick-compat abcde eyed3 \
                 lame libjpeg-progs parted k3b normalize-audio sshfs \
                 exiftags libtemplate-perl git-cola \
                 sharutils cuetools shntool flac mp3splt nasm etckeeper \
                 ffmpeg mencoder ispell audacity alac-decoder\
                 rxvt-unicode-256color tmux mutt update-manager-core lua5.1 \
                 liblua5.1-0-dev libx11-dev libxext-dev libsm-dev gettext \
                 graphviz gdebi libdvdread4 parcellite libgdk-pixbuf2.0-dev libxft2-dev
aptitude install sqlite3 sqlite3-doc sqlite3-pcre sqlitebrowser sqliteman \
                 sqliteman-doc postgresql libpq-dev \
                 libopenoffice-oodoc-perl unoconv pdfjam pdftk \
add-apt-repository ppa:stebbins/handbrake-releases
aptitude install handbrake-gtk handbrake-cli

# edit /etc/etckeeper/etckeeper.conf to use git
etckeeper init
cd /etc; git commit -m "initial checkin"; git gc
cd /etc/etckeeper/post-install.d
(echo '#!/bin/sh' ; echo 'exec git gc') > 99git-gc
chmod +x 99git-gc; git add .; git commit -m "run git gc after each apt run"

# install Inconsolata for Powerline (otherwise ttf-inconsolata)
mkdir ~/.fonts
cp Inconsolata\ for\ Powerline.otf ~/.fonts
fc-cache -vf ~/.fonts
# build latest urxvt
aptitude install libgdk-pixbuf2.0-dev libxft2-dev
./configure --prefix=~/g/sw --enable-everything --enable-256-color
# build latest vim
./configure --prefix=~/g/sw --with-features=big --enable-pythoninterp

gpasswd -a $USER fuse
add-apt-repository ppa:tualatrix/ppa
apt-key adv --recv-keys --keyserver 6AF0E1940624A220
aptitude update
aptitude install ubuntu-tweak
aptitude full-upgrade
apt-add-repository ppa:pmcenery/ppa
aptitude update
aptitude full-upgrade
aptitude install ipheth-utils

And install Google Chrome.

And Amarok 1.4.

And download Picasa for Windows and install it by running the .exe with wine.

Install MX860 drivers for printing and scanning.

[/unix] permanent link

Thu, 28 Jan 2010

Configuring saslauthd

Keywords: ubuntu postfix saslauthd

Configuring saslauth with Ubuntu 9.10 required making /etc/postfix/sasl/smtpd.conf look like:

pwcheck_method: saslauthd
mech_list: plain login
saslauthd_path: /var/run/saslauthd/mux

The important missing part that I couldn't find in any tutorials or instructions is the /mux on the end of the saslauthd_path.

I also needed to add the following parts to /etc/postfix/

smtp_tls_security_level = may
smtpd_tls_security_level = may
smtpd_tls_auth_only = no
smtp_tls_note_starttls_offer = yes
smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
smtp_use_tls = yes

[/unix] permanent link

November 2022
Sun Mon Tue Wed Thu Fri Sat