Monday, October 17, 2011

broken cyrus seen file

Someday I'm going to give up on running my own mail server. I say this especially when my hard drive fills up an my cyrus "seen" database files inevitably corrupt. This db file keeps track of your mailbox message status (whether you've read a message or not).

If you have this problem, you'll see a line like this in  your mail log:
DBERROR: skiplist recovery /home/cyrus/user/u/username.seen: ADD at 4C48 exists
The recommended way to fix this is to truncate the file at the location the problem is detected. In the case above, at the hex byte 4C48.

I've had to do this often enough that I've written a shell script to do it, which just needs the username and hex location supplied via command line.

  • it's a shell script, but python is used to do hex conversion.
  • you'll probably need to change the path (/home/cyrus/user/) to your cyrus user directory (mine is non-standard).
  • you must supply the hex location where the corruption is detected. You can find this in your mail log file (usually /var/log/mail.log). 
  • if your cyrus files are owned by other than user cyrus and group mail, you'll need to change the chown cyrus:mail.
  • the existing *.seen file is backed up with a unique filename (current timestamp), so it can be restored if something goes wrong.

if [ $# != 2 ]; then
    echo "USAGE: $0 login hex"

TRUNC=`python -c "print int('$2', 16)"`
DATE=`date +%Y%m%dT%H%M`

if [ -d $DBPATH ]; then
    dd if=$DBPATH/$1.seen of=$DBPATH/$1.seen.fixed bs=1 count=$TRUNC
    chown cyrus:mail $DBPATH/$1.seen.fixed
    chmod 600 $DBPATH/$1.seen.fixed
    mv $DBPATH/$1.seen $DBPATH/$1.seen.$$TRUNC
    mv $DBPATH/$1.seen.fixed $DBPATH/$1.seen
    echo "No such directory: $DBPATH"

Friday, October 14, 2011

fsck.vfat -a "Unable to create unique name"

On linux (kubuntu), trying to do an fsck on a vfat USB drive, I keep getting "Unable to create unique name".

The solution apparently is to use fsck.vfat -r [device]

I have no idea why interactive mode (-r) works, and automatic mode does not... but it gets rid of the problem.

(dosfsck is an alias for fsck.vfat and fsck.mdos)

Thursday, October 13, 2011

Alert: Error Unable to initialize OpenGL. (Error: Failed loading

It seems my ubuntu/kubuntu opengl/mesa installation is messed up again. Getting the above error on an amd64 system trying to run an ai32 binary the solution is:
LD_PRELOAD=/usr/lib32/mesa/ [path/to/program/to/run]