Tony's Site

Bulding a Debian backport of Dovecot 2.4

This apage is work in progress - it is not complete. I am not an expert in this so there may be a better way. Do not assume that this is suitable for a live system.

Introduction

When I started to consider the upgrade from Debian bookworm to trixie I discovered that the Dovecot version in trixie had major config changes compared to bookworm. In the past when other packages have done this I have looked to install the later version from Debian backports prior to the main upgrade. There isn't a backport of Dovecot 2.4 so I decided to try to create one myself.

This turned out to be less straightforward than I expected. I have hit a number of snags on the way. Below I document the error messages I received at different times so that this may be picked up by Google if someone else hits the same problem.

Later sections show instructions to backport Dovecot and lua-json. Instructions to be run as root have an amber background. Non root have a red background.

Errors encountered

test-buffer-istream.c:54: Assert failed: buffer_append_full_file(result, TEST_FILENAME, SIZE_MAX, &error) == BUFFER_APPEND_READ_ERROR, test-buffer-istream.c:56: Assert failed: error != NULL && *error != '\0' - As per this page this happens if you try to build the package as root or fakeroot.

Fatal: dlua_script_init() failed: lua_pcall(/home/tony/dovecot/dovecot-2.4.1+dfsg1/src/lib-lua/test-lua-http-client.lua) failed: ...dovecot-2.4.1+dfsg1/src/lib-lua/test-lua-http-client.lua:1: module 'json' not found: - I identified that I needed to create and install a backport of lua-json before building Dovecot.

dh_installsystemd: error: Package 'dovecot-core' does not install unit 'dovecot.service' - Need to install backport of debhelper.

Preparation

As root:

Install packaging tools.

apt install build-essential fakeroot packaging-dev debian-keyring devscripts equivs

Add the following to /etc/apt/sources.list

deb-src http://deb.debian.org/debian/ trixie main
deb http://deb.debian.org/debian bookworm-backports main

Then update package listings.

apt update

Backporting lua-json

This turned out to be easy.

Not as root:

mkdir lua-json
cd lua-json
apt-get source lua-json/trixie
cd lua-json-1.3.4
mk-build-deps --install --remove
dch --bpo
debuild -b -uc -us

Run as root in lua-json folder

apt install ./lua-json_......deb

Install backport of debhelper

As root

apt install debhelper/bookworm-backports

Backport dovecot

Not as root:

mkdir dovecot
cd dovecot
apt-get source dovecot/trixie
cd dovecot-2.4.1......

After the following command you need to ensure ownership of the folder by the non-root user.

mk-build-deps --install --remove
chown -R user:user ..
dch --bpo
debuild -b -uc -us

As root install required .deb files from the dovecot folder.