Ubuntu – Dovecot-core purge/reinstall error

16.04dovecotdpkgpackage-management

Recently dovecot was shown to need updating. No problem…

Except that it barks this error out: /usr/bin/ucfr: line 323: [: : integer expression expected

and collapses on itself. So I think for a while.. maybe it's an old conflict, we've upgraded a few times. I run iredmail, lets backup our configurations and flush it, rebuild it, and I'll just diff out the changes.

I can't remove the file:

Purging configuration files for dovecot-core (1:2.2.22-1ubuntu2.1) ...
/usr/bin/ucfr: line 323: [: : integer expression expected
/usr/bin/ucfr: line 56: [: : integer expression expected
ucfr: Association belongs to , not dovecot-core
ucfr: Aborting
dpkg: error processing package dovecot-core (--purge):
 subprocess installed post-removal script returned error exit status 5
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing..

So I go into the /var/lib/dpkg/info directory and read up on its removal. I remove further nooks and crannies of what I can find. I believe at this time I have everything. I turn back to reinstall just the core, and we have:

The following NEW packages will be installed:
  dovecot-core
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/2,420 kB of archives.
After this operation, 7,578 kB of additional disk space will be used.
Selecting previously unselected package dovecot-core.
(Reading database ... 177431 files and directories currently installed.)
Preparing to unpack .../dovecot-core_1%3a2.2.22-1ubuntu2.1_amd64.deb ...
Unpacking dovecot-core (1:2.2.22-1ubuntu2.1) ...
Processing triggers for systemd (229-4ubuntu10) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up dovecot-core (1:2.2.22-1ubuntu2.1) ...
/usr/bin/ucfr: line 323: [: : integer expression expected
/usr/bin/ucfr: line 110: [: : integer expression expected
/usr/bin/ucfr: line 323: [: : integer expression expected
/usr/bin/ucfr: line 110: [: : integer expression expected
/usr/bin/ucfr: line 323: [: : integer expression expected
/usr/bin/ucfr: line 110: [: : integer expression expected
/usr/bin/ucfr: line 323: [: : integer expression expected
/usr/bin/ucfr: line 110: [: : integer expression expected
/usr/bin/ucfr: line 323: [: : integer expression expected
/usr/bin/ucfr: line 110: [: : integer expression expected
/usr/bin/ucfr: line 323: [: : integer expression expected
/usr/bin/ucfr: line 110: [: : integer expression expected
/usr/bin/ucfr: line 323: [: : integer expression expected
/usr/bin/ucfr: line 110: [: : integer expression expected
/usr/bin/ucfr: line 323: [: : integer expression expected
/usr/bin/ucfr: line 110: [: : integer expression expected

Creating config file /etc/dovecot/conf.d/10-master.conf with new version
/usr/bin/ucfr: line 323: [: : integer expression expected
/usr/bin/ucfr: line 110: [: : integer expression expected
/usr/bin/ucfr: line 323: [: : integer expression expected
/usr/bin/ucfr: line 56: [: : integer expression expected
ucfr: Association belongs to , not dovecot-core
ucfr: Aborting
dpkg: error processing package dovecot-core (--configure):
 subprocess installed post-installation script returned error exit status 5
Processing triggers for systemd (229-4ubuntu10) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Errors were encountered while processing:
 dovecot-core
E: Sub-process /usr/bin/dpkg returned an error code (1)

I've searched high and low and can't find a reference for how to handle this. I'm pretty lost and now I have an utterly broken dovecot.

Thoughts anyone before I figure out my last backup and rollback?

Best Answer

Looks like a bug in /usr/bin/ucfr. As a workaround you could remove the ucfr call from /var/lib/dpkg/info/dovecot-core.postrm:

In line 19 change

ucfr --purge dovecot-core $conffile

to

true ucfr --purge dovecot-core $conffile

Then run

sudo apt-get purge dovecot-core

If that works reinstall dovecot-core

Related Question