Wednesday, March 29, 2006

Ubuntu Qmail HOWTO

Ubuntu used to have the qmail-src package available in the multiverse collection, however due to the lack of attention by whomever monitors the build reports, breezy doesn't have the package availble to it. However, since the debian package is an all-platform package, one can simply use it to get where you need to go. The process is easy (once you've figured it the hell out).

  1. download the Debian stable .debs for qmail-src and ucspi-tcp to your ubuntu system

  2. use dpkg to install them manually

  3. run build-ucspi-tcp

  4. run build-qmail

  5. (optional) apply patches

First, you need to fetch the .debs for qmail-src and ucspi-tcp-src from the debian-stable distribution. Use the architecture all link at the bottom to find and download the .deb from any mirror. Save each file on the target system.

  • wget (...) ucspi-tcp/ucspi-tcp-src_0.88-9_all.deb

  • wget (...) qmail/qmail-src_1.03-38_all.deb

Next, use the dpkg command to install them. I used the following commands:
  • sudo dpkg -i ./ucspi-tcp-src_0.88-9_all.deb

  • sudo dpkg -i ./qmail-src_1.03-38_all.deb

Now, build ucspi, letting it be installed. I usually purge the installer package as it's not needed anymore:

  • build-ucspi-tcp

Then, build the qmail package:

  • build-qmail

When I build, I install this patch I made which is a version of the qmail-spp patch modified to work against the debian patched source tree. To apply it, all you need to do is download it and run the following:

  • cd /tmp/qmail/qmail-1.03

  • patch -p 1 ~/debian-qmail-src-to-qmail-spp.patch

That's it!


  1. Life has been so much better since I left qmail and converted completely to Postfix. Thanks for reminding me of the little annoyances I'm still missing.

  2. I'm still using Qmail and your patch patch'd fine with the qmail-src package, but I'm noticing that it's not passing the recpt to my script. I have a script and from the command prompt, it works fine, but through the qmail-spp patch, it's not finding virtual aliases within vpopmail for some reason. Any ideas?

  3. Figured it out. Vpopmail permission problem.

  4. Hello,

    If you want qmail+smtp_auth+vpopmail-mysql+qmailadmin+autorespond you could try my debian sarge packages. URL:

  5. Have you verified that these packages work on ubuntu without rebuilding? Capricous mixing debian and ubuntu repositories can have undesirable consequences, so be careful.

    I would suggest adding the deb-src repository lines and then building ubuntu packages on your system before I would use the .deb directly.

  6. Sorry, yes, you should rebuild package for ubuntu! Soon I rebuild it for dapper

  7. My question is, how do you apply the patch? I assume before I start build-qmail, right? But I have no src folder, I only have the qmail-src tarballs, so should I unpack the tarballs, apply the patch and repackage it, and then run build-qmail?

  8. Eitch,

    When you run the build-qmail script, it stops right before the compilation and prompts you to apply any patches in the build tree it has created in /tmp. You have to use another terminal to do it, then return and hit enter to continue with the .deb construction.


  9. I tried building qmail and everything went fine but I don't see anywhere to apply patches and the install doesn't prompt me at all, any ideas?

  10. Uniacid,

    As mentioned in the comment immediately above yours, there's a stage in the build process which tells you to open another terminal and apply any desired patches.


  11. [...] Ubuntu Qmail HOWTO (tags: linux ubuntu sysadmin email qmail) [...]

  12. I've installed qmail several times on different systems. However, I have one problem on Ubuntu that seems simple, yet stumps me. There seems to be no /etc/inittab file in which to put the entry for svscanboot. So, where should I put the kicker for svscanboot? In /etc/rc.local?


    - Jeremy

  13. That's not right. You must be missing something because without an /etc/inittab file your system will not successfully boot. I would check again.

    Also, if you are using the packages above, then you don't launch qmail with svscan in inititab, it is run as a daemon from /etc/init.d as other processes are.

  14. Trying to install qmail on ubuntu edgy.
    dpkg: error processing qmail_1.03-38_i386.deb (--install):
    subprocess pre-installation script returned error exit status 2
    Errors were encountered while processing:

    Do you want to purge qmail-src now? [yN] y
    (Reading database ... 109489 files and directories currently installed.)
    Removing qmail-src ...
    Purging configuration files for qmail-src ...

    Remember that you can install qmail_1.03-38_i386.deb
    on other computers so you don't need to compile it again.

    Don't forget to setup a /etc/qmail/rcpthosts file to prevent open relaying!

    Good luck!

  15. qmail-pop3d.c:48: warning: conflicting types for built-in function ‘puts’
    qmail-pop3d.c: In function ‘main’:
    qmail-pop3d.c:297: warning: return type of ‘main’ is not ‘int’

  16. I have the same issue with qmail on hardy/

    dpkg --force-all -i /tmp/qmail/qmail_1.03-44_amd64.deb
    (Reading database ... 93196 files and directories currently installed.)
    Unpacking qmail (from .../qmail/qmail_1.03-44_amd64.deb) ...
    Performing install
    First installation of the Debian qmail package...
    Checking if qmail is already installed on this computer... no.
    Checking group qmail (gid 64010)... ok.
    Checking user alias (uid 64010, gid 65534, homedir /var/qmail/alias)... ok.
    Checking user qmaild (uid 64011, gid 65534, homedir /var/qmail)... ok.
    Checking user qmails (uid 64012, gid 64010, homedir /var/qmail)... ok.
    Checking user qmailr (uid 64013, gid 64010, homedir /var/qmail)... ok.
    Checking user qmailq (uid 64014, gid 64010, homedir /var/qmail)... ok.
    Checking user qmaill (uid 64015, gid 65534, homedir /var/qmail)... ok.
    Checking user qmailp (uid 64016, gid 65534, homedir /var/qmail)... ok.
    Could not open /etc/inetd.conf
    dpkg: error processing /tmp/qmail/qmail_1.03-44_amd64.deb (--install):
    subprocess pre-installation script returned error exit status 2
    Errors were encountered while processing:

  17. Well, forcing all isn't necessary to install the package. You're probably missing the inetd package which is a prerequisite for qmail. Consider not forcing anything.

  18. [...] With the moving of ubuntu from the old fashioned init to the modern upstart, the daemontools package doesn’t cleanly install. Here’s how to fix it. You really do need daemontools if you’re going to run djbdns or qmail. [...]