Pages

Wednesday, July 30, 2014

Installing dovecot with vpopmail support on Ubuntu 12.04.4 LTS

The problem is that dovecot is not compiled with --with-vpopmail support. Here is step-by-step guide how to make debian package from source.

First you need working vpopmail installed somewhere on the system. Second we need some deb packages installed for the build process:
# apt-get install build-essential dpkg-dev debhelper pkg-config libssl-dev libpam0g-dev libldap2-dev libpq-dev libmysqlclient-dev drac-dev libsasl2-dev libsqlite3-dev libbz2-dev libdb-dev libcurl4-gnutls-dev libexpat-dev hardening-wrapper
Now download the source package:
# apt-get source dovecot
This will get the source and unpack it in current directory
root@mail2:/usr/src/tmp# ls -l
drwxr-xr-x 7 root root    4096 Jul 30 10:53 dovecot-2.0.19
-rw-r--r-- 1 root root 1278258 May 15 17:29 dovecot_2.0.19-0ubuntu2.1.debian.tar.gz
-rw-r--r-- 1 root root    3142 May 15 17:29 dovecot_2.0.19-0ubuntu2.1.dsc
-rw-r--r-- 1 root root 3357056 Apr  8  2012 dovecot_2.0.19.orig.tar.gz
Now enter dovecot directory and edit the file debian/rules. Find the lines:
$(shell dpkg-buildflags --export=configure) sh configure \
                 --with-ldap=plugin \
                 --with-ssl=openssl \
                 --with-sql=plugin \
and add another line like this:

 $(shell dpkg-buildflags --export=configure) sh configure \
                 --with-vpopmail \
                 --with-ldap=plugin \
                 --with-ssl=openssl \
                 --with-sql=plugin \
Alternatively here is a patch:

--- dovecot-2.0.19/debian/rules    2012-06-29 00:33:07.000000000 +0300
+++ ../dovecot-2.0.19/debian/rules    2014-07-30 10:18:00.469643701 +0300
@@ -25,6 +25,7 @@
     dh_testdir
     # Dovecot
     $(shell dpkg-buildflags --export=configure) sh configure \
+            --with-vpopmail \
                 --with-ldap=plugin \
                 --with-ssl=openssl \
                 --with-sql=plugin \
Now go to unpacked dovecot's directory and build the package:
# dpkg-buildpackage -uc -rfakeroot
You will end up with lot of *.deb files. The one that you need is 'dovecot-core_2.0.19-0ubuntu2.1_i386.deb'. Install it, restart dovecot and use your vpopmail support.
# dpkg -i dovecot-core_2.0.19-0ubuntu2.1_i386.deb
# service dovecot restart

Monday, April 28, 2014

MRTG error on Debian Squeeze

The error:
rogue:~# mrtg /etc/mrtg.cfg
2014-04-28 16:32:17: WARNING: Can not determine ifNumber for public@127.0.0.1:     ref: 'Name'     key: 'eth0'
2014-04-28 16:32:17: WARNING: Can not determine ifNumber for public@127.0.0.1:     ref: 'Name'     key: 'eth1'
2014-04-28 16:32:17: ERROR: Target[127.0.0.1_eth0][_IN_] ' $target->[0]{$mode} ' did not eval into defined data
2014-04-28 16:32:17: ERROR: Target[127.0.0.1_eth0][_OUT_] ' $target->[0]{$mode} ' did not eval into defined data
2014-04-28 16:32:17: ERROR: Target[127.0.0.1_eth1][_IN_] ' $target->[1]{$mode} ' did not eval into defined data
2014-04-28 16:32:17: ERROR: Target[127.0.0.1_eth1][_OUT_] ' $target->[1]{$mode} ' did not eval into defined data
How to fix it:

# cd /var/lib/mrtg
# mv _etc_mrtg.cfg _etc_mrtg.cfg.old

Now run again mrtg /etc/mrtg.cfg - the error is gone.

Monday, April 14, 2014

Lotus Notes 9 on RHEL/CentOS/Oracle Linux

Dependencies needed by ibm_notes-9.0.i586.rpm on RHEL.
# yum install gnome-desktop libatk atk libart art libart_lgpl.i686 libXt.i686 
libzip.i686 libXScrnSaver.i686 libXtst.i686 libXp.i686 libXrender.i686 
libxml2.i686 libxkbfile.i686 libXft.i686 libXcursor.i686 libpng.i686 pam.i68 
libgnomeprintui22.i686 libgnomeprint22.i686 GConf2.i686 ORBit2.i686 
gnome-vfs2.i686 libgnomeui.i686 alsa-lib.i686
Install the package:

 # rpm -i /path/to/ibm_notes-9.0.i586.rpm

Friday, January 10, 2014

Увеличаване на Max opened files под Debian Squeeze.

Трябва да направим следното:

Редактираме /etc/security/limits.conf и за съответният потребител добавяме определените лимити. Примерно:
nginx   soft    nofile  16144
nginx   hard    nofile  18191
За да проработи е нужно и да добавим в /etc/pam.d/common-session следното:
session required        pam_limits.so
Остава само да рестартираме процесът, който се нуждае от промените по лимитите.

Tuesday, November 5, 2013

Debian Squeeze 6.x on HP DL360gen8 not detecting the raid controller

Debian Squeeze cannot detect RAID controller on HP ProLiant DL360gen8.
In expert mode when installer prompts that it cannot detect hard disk, open a console (Alt+F2, hit Enter) and then type:
# modprobe -r hpsa
# modprobe hpsa hpsa_allow_any=1
First remove the driver if loaded and then load it again with hpsa_allow_any=1 parameter. Here is the result:
[    1.314375] scsi0 : hpsa
[    1.316649] hpsa 0000:02:00.0: RAID              device c0b0t0l0 added.
[    1.316654] hpsa 0000:02:00.0: Direct-Access     device c0b0t0l1 added.
[    1.316827] scsi 0:0:0:0: RAID              HP       P420i            4.66 PQ: 0 ANSI: 5
[    1.316958] scsi 0:0:0:1: Direct-Access     HP       LOGICAL VOLUME   4.66 PQ: 0 ANSI: 5
Now swtich back to installer (Alt+F1) and try again 'detect hard disks'. Now you can partition your raid logical volume.

Friday, October 18, 2013

Importing CSV file into django model.

Lets assume that we have the following django model:
class Person(models.Model):
    PersonID = models.CharField(max_length=10)
    FirstName = models.CharField(max_length=30)
    LastName = models.CharField(max_length=30)
    Address = models.CharField(max_length=30)

and we have a csv file with 4 elements on each row and we want to import them in our django database. Here is example (delimeter is !):
1!Nikolay!Hristov!Bulgaria, Gabrovo, Test street 18 
What we need to do is to make a view and attach it to certain url (for example http://localhost/import_db/). Here is the view:
def import_db(request):
   
    f = open('/path/to/filename-with-data.csv', 'r'
    for line in f:
        line =  line.split('!')
        tmp = Person.objects.create()
        tmp.PersonID = line[0]
        tmp.FirstName = line[1]
        tmp.LastName = line[2]
        tmp.Address = line[3]
        tmp.save()

    f.close()
Now all we have to do is to point our browser to http://localhost/import_db/ and wait for data to be imported.

Wednesday, September 18, 2013

Qmail starting error "alert: cannot start: unable to open mutex"

If you are getting this error message when you try to start qmail-send - most probably you are moving qmail from old installation to a new server.

The problem comes from missing diretories (and files) which are on most distributions links and when you archive it the real directories will not be trasfered.

Directory is /var/qmail/queue and as you can see from the example bellow it is just a symlink to another directory (example is from NetBSD qmail package):

 # ls -la /var/qmail      
drwxr-xr-x   2 root  wheel  512 Sep 18 15:25 .
drwxr-xr-x  26 root  wheel  512 Aug 24 22:11 ..
lrwxr-xr-x   1 root  wheel   24 Jul 16 04:36 alias -> /usr/pkg/etc/qmail/alias
lrwxr-xr-x   1 root  wheel   12 Jul 16 04:36 bin -> /usr/pkg/bin
lrwxr-xr-x   1 root  wheel   34 Jul 16 04:36 boot -> /usr/pkg/share/examples/qmail/boot
lrwxr-xr-x   1 root  wheel   26 Jul 16 04:36 control -> /usr/pkg/etc/qmail/control
lrwxr-xr-x   1 root  wheel   24 Jul 16 04:36 doc -> /usr/pkg/share/doc/qmail
lrwxr-xr-x   1 root  wheel   12 Jul 16 04:36 man -> /usr/pkg/man
lrwxr-xr-x   1 root  wheel   16 Jul 16 04:36 queue -> /var/spool/qmail
lrwxr-xr-x   1 root  wheel   24 Jul 16 04:36 users -> /usr/pkg/etc/qmail/users

So the real directory is "queue -> /var/spool/qmail" and here is the listing of subdirs:

# ls -la
drwxr-xr-x  11 qmailq  qmail  512 Sep 18 15:34 .
drwxr-xr-x   8 root    wheel  512 Jul 16 04:36 ..
drwx------   2 qmails  qmail  512 Sep  9 15:11 bounce
drwx------  25 qmails  qmail  512 Jan 19  2008 info
drwx------   2 qmailq  qmail  512 Sep 18 13:55 intd
drwx------  25 qmails  qmail  512 Jan 19  2008 local
drwxr-x---   2 qmailq  qmail  512 Jan 19  2008 lock
drwxr-x---  25 qmailq  qmail  512 Jan 19  2008 mess
drwx------   2 qmailq  qmail  512 Sep 18 13:55 pid
drwx------  25 qmails  qmail  512 Jan 19  2008 remote
drwxr-x---   2 qmailq  qmail  512 Sep 18 13:55 todo


Make sure to transfer this directory to the new server and also chown the dirs with correct permissions.

The actual error is caused by missing file sendmutex which resides in /var/spool/qmail/lock/ directory

# ls -la /var/spool/qmail/lock
total 12
drwxr-x---   2 qmailq  qmail   512 Jan 19  2008 .
drwxr-xr-x  11 qmailq  qmail   512 Sep 18 15:34 ..
-rw-------   1 qmails  qmail     0 Jan 19  2008 sendmutex
-rw-r--r--   1 qmailr  qmail  1024 Sep 16 09:39 tcpto


If this file does not exist just create it with the following command (make sure also to change the file owner):
# touch /var/qmail/queue/lock/sendmutex
# chown qmails:qmail /var/qmail/queue/lock/sendmutex