Re: Lazy-Expunge plugin documentation incomplete?

Randolf Richardson via dovecot <[email protected]> Wed, 17 Jun 2026 10:26:49 -0700
Newsgroups gmane.mail.imap.dovecot
Organization Inter-Corporate Computer & Network Services
Message-ID <[email protected]>
	Thank you for your help, I appreciate it very much.

	What I meant by "not working" is that the deleted messages were just=20
disappearing, without being placed in the ~/Maildir.deleted/ folder=20
(which is the expected behaviour), and with no errors being logged.

	I tried replacing my 16-lazy-expunge.conf file with what you=20
provided, and now, upon deletion, the IMAP4 client (Evolution on=20
Linux in this case) reports an "expunge" operation error.  The=20
following errors now show up in the logs (this is on a test server=20
that worked correctly before upgrading from 2.3 to 2.4.1):

2026-06-17T10:13:27.137678-07:00 mail02 dovecot: imap([email protected])<1=
232591><CUPOK3ZUdOIKAQHB>: Debug: Mailbox Deleted Items: UID 864: Mail meta=
data accessed
2026-06-17T10:13:27.137908-07:00 mail02 dovecot: imap([email protected])<1=
232591><CUPOK3ZUdOIKAQHB>: Debug: Mailbox EXPUNGED/: Mailbox opened
2026-06-17T10:13:27.138080-07:00 mail02 dovecot: imap([email protected])<1=
232591><CUPOK3ZUdOIKAQHB>: Error: Mailbox Deleted Items: UID 864: lazy_expu=
nge: Couldn't open expunge mailbox: Failed to open mailbox EXPUNGED/: Inval=
id mailbox name 'EXPUNGED/': Ends with hierarchy separator
2026-06-17T10:13:27.138259-07:00 mail02 dovecot: imap([email protected])<1=
232591><CUPOK3ZUdOIKAQHB>: Debug: Mailbox Deleted Items: UID 864: Expunge r=
equested
2026-06-17T10:13:27.138422-07:00 mail02 dovecot: imap([email protected])<1=
232591><CUPOK3ZUdOIKAQHB>: Debug: Mailbox Deleted Items: UID 865: Expunge r=
equested
2026-06-17T10:13:27.138547-07:00 mail02 dovecot: imap([email protected])<1=
232591><CUPOK3ZUdOIKAQHB>: Debug: Mailbox Deleted Items: UID 866: Expunge r=
equested
2026-06-17T10:13:27.138682-07:00 mail02 dovecot: imap([email protected])<1=
232591><CUPOK3ZUdOIKAQHB>: Debug: Mailbox Deleted Items: UID 867: Expunge r=
equested
2026-06-17T10:13:27.138807-07:00 mail02 dovecot: imap([email protected])<1=
232591><CUPOK3ZUdOIKAQHB>: Debug: Mailbox Deleted Items: UID 868: Expunge r=
equested
2026-06-17T10:13:27.138919-07:00 mail02 dovecot: imap([email protected])<1=
232591><CUPOK3ZUdOIKAQHB>: Error: Mailbox Deleted Items: Lazy-expunge trans=
action failed: Mailbox Deleted Items: UID 864: lazy_expunge: Couldn't open =
expunge mailbox: Failed to open mailbox EXPUNGED/: Invalid mailbox name 'EX=
PUNGED/': Ends with hierarchy separator

	I did attempt removing the trailing slash, but the errors logged=20
remained the same.

	I also tried to add the following lines to "mailbox EXPUNGED" stanza=20
(which is what I will be needing, although I'm unsure if this is the=20
correct placement), which resulted in more errors that I think I=20
should ignore at this point until the errors (above) are sorted:

    mail_driver =3D maildir
    mail_path =3D ~/Maildir.deleted
    mail_index_private_path =3D=20
    mail_cache_path =3D=20

	Note:  Some eMail clients delete directly instead of moving messages=20
to the "Deleted Items" (Trash) folders, and Dovecot 2.3 preserved=20
this structure with its lazy-expunge configuration (which is a=20
wonderfully helpful feature), which is all stored in the specified=20
"mail_path" file system hierarchy separate from the user's mailbox.

	Thanks!

> For 2.4 you would use
>=20
> acl_driver =3D vfile
> acl_global_path =3D /etc/dovecot/dovecot.acl
> lazy_expunge_mailbox =3D EXPUNGED/
> lazy_expunge_only_last_instance =3D yes
>=20
> namespace inbox {
>   mailbox EXPUNGED {
>     autoexpunge =3D 32days
>     autoexpunge_max_mails =3D 100000
>   }
>   mailbox \Drafts {
>     lazy_expunge_mailbox =3D=20
>   }
> }
>=20
> namespace ns {
>   hidden =3D yes
>   list =3D no
>   prefix =3D EXPUNGED/
>   subscriptions =3D no
>=20
>   mailbox EXPUNGED {
>     quota_ignore =3D yes
>   }
> }
>=20
> mail_plugins {
>   acl =3D yes
>   lazy_expunge =3D yes
> }
>=20
> but you never did explain "how it does not work".
>=20
> Aki
>=20
> > On 15/06/2026 19:17 EEST Randolf Richardson via dovecot <dovecot@doveco=
t.org> wrote:
> >=20
> > =20
> > One of the Dovecot repository maintainers on GitHub recommended=20
> > sending an eMail to you regarding the issue I encountered:
> >=20
> > Documentation for lazy-expunge doesn't work
> > https://github.com/dovecot/documentation/issues/1555
> >=20
> > --------
> > I converted from Dovecot 2.3 to Dovecot 2.4.1, which was not a minor=20
> > upgrade. Anyway, I can't get the lazy-expunge plugin to work in 2.4.1=20
> > now. Here's my configuration file from 2.3 -- how can I get this=20
> > working in 2.4.1? Thanks.
> >=20
> > namespace inbox {
> >   mailbox EXPUNGED {
> >     autoexpunge =3D 32days
> >     autoexpunge_max_mails =3D 100000
> >     #auto =3D create
> >   }
> > }
> >=20
> > # Namespace for lazy_expunge plugin
> > namespace {
> >   prefix =3D EXPUNGED/
> >   hidden =3D yes
> >   list =3D no
> >   subscriptions =3D no
> >   separator =3D /
> >   location =3D maildir:~/Maildir.deleted:INDEX=3D
> > }
> >=20
> > mail_plugins =3D $mail_plugins lazy_expunge acl
> > plugin {
> >=20
> >   # Move expunged messages into the .EXPUNGED namespace
> >   lazy_expunge =3D EXPUNGED/
> >=20
> >   # Only move to expunged storage if this is the last copy of the=20
> > message in the user=B4s account
> >   lazy_expunge_only_last_instance =3D yes
> >=20
> >   # Exclude Drafts from lazy expunging
> >   lazy_expunge_exclude =3D \Drafts
> >=20
> >   # Copy of each message is done with hard links whenever possible
> >   maildir_copy_with_hardlinks =3D yes
> >=20
> >   # Define ACL so that user cannot list the .EXPUNGED mailbox
> >   # Example entry:  .EXPUNGED owner rwstipekxa
> >   acl =3D vfile:/etc/dovecot/dovecot.acl
> >   # dovecot.acl contains one line:  EXPUNGED owner ip
> >=20
> >   # Expunged messages most likely don't want to be included in quota:
> >   quota_rule =3D EXPUNGED:ignore
> > }
> > #lazy_expunge_mailbox =3D EXPUNGED
> >=20
> > Here's an example of someone else who encountered the same problem:=20
> > https://www.dovecot.org/mailman3/archives/list/[email protected]/thr
> > ead/25BXSHQWGQQ3ACVZSYF3O3LC4WROTUCI/
> >=20
> > Randolf Richardson, CNA - [email protected]
> > Inter-Corporate Computer & Network Services, Inc.
> > Beautiful British Columbia, Canada
> > https://www.inter-corporate.com/
> >=20
> >=20
> > _______________________________________________
> > dovecot mailing list -- [email protected]
> > To unsubscribe send an email to [email protected]
>=20


Randolf Richardson, CNA - [email protected]
Inter-Corporate Computer & Network Services, Inc.
Beautiful British Columbia, Canada
https://www.inter-corporate.com/


_______________________________________________
dovecot mailing list -- [email protected]
To unsubscribe send an email to [email protected]