Removing a top level cyrus imap mailbox
Thursday, May 28th, 2009 by Gary Richards - Categories: Email, Linux, Operating Systems, RedhatWhen using cyrus imap generally a new mailbox is added to the system using the following commands:
$ cyradm -u cyrus localhost
Password:
localhost> cm user.someusername
Generally, this would create the directory: /var/spool/imap/user/s/someuser, containing the various cyrus files.
It turns out that you can also do the following too:
localhost> cm someusername
localhost> cm someuser.name
When you list users you would see:
localhost> lm
someuser.name (\HasNoChildren)
someusername (\HasNoChildren)
user.someusername (\HasNoChildren)
I came across a (RHEL4) cyrus server like this today, it seems that someone had created some mailboxes like this accidentally and then not been able to remove them.
When I tried I received the following messages:
localhost> dm someusername
deletemailbox: Permission denied
localhost> sam someusername cyrus c
setaclmailbox: cyrus: c: System I/O error
Based on what I said above, I would have expected both /var/spool/imap/someusername and /var/spool/imap/someuser/n/name (or /var/spool/imap/someuser/name) to exist and to contain the various cyrus files, but they don’t. I can only assume that this is why I see the errors above.
Anyhow, the fix was fairly simple:
$ cd /var/spool/imap
$ mkdir someusername
$ reconstruct someusername
$ cyradm -u cyrus localhost
localhost> sam someusername cyrus c
localhost> dm someusername
The same applies forsomeuser.name, however rather than creating an extravagent directory structure, it appears that you can just create the directory someuser.name and then reconstruct someuser.name, if that fails then i’d suggest try creating someuser/name and resconstructing someuser.name or failing that, try creating someuser/n/name and reconstructing someuser.name.
This looks as though it may have been a bug in an older build of cyrus imapd. As I tried some similar steps on a test cyrus setup on a Gentoo system and I can create/delete these mailboxes fine without the above steps.
All very odd.