Official fixed packages have been released, use those
TL;DR Scroll to the bottom
Just ran into this issue myself.
To debug it a bit further, I set the following environment variable:
export DEBCONF_DEBUG=developer
That way we can see what debconf is doing.
Now we run
dpkg --configure --pending
And we can see the following:
Setting up nginx-common (1.10.1-3+xenial1) ...
debconf (developer): frontend started
debconf (developer): frontend running, package name is nginx-common
debconf (developer): starting /var/lib/dpkg/info/nginx-common.config configure 1.10.1-3+xenial0
dpkg: error processing package nginx-common (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of libnginx-mod-http-image-filter:
libnginx-mod-http-image-filter depends on nginx-common (= 1.10.1-3+xenial1); however:
Package nginx-common is not configured yet.
Now we can edit the /var/lib/dpkg/info/nginx-common.config
script, and change
#!/bin/sh
with
#!/bin/sh -x
to enable debugging as well.
Running dpkg --configure --pending
again will show:
Setting up nginx-common (1.10.1-3+xenial1) ...
debconf (developer): frontend started
debconf (developer): frontend running, package name is nginx-common
debconf (developer): starting /var/lib/dpkg/info/nginx-common.config configure 1.10.1-3+xenial0
+ set -e
+ . /usr/share/debconf/confmodule
+ [ ! 1 ]
+ [ -z ]
+ exec
+ [ ]
+ exec
+ DEBCONF_REDIR=1
+ export DEBCONF_REDIR
+ logdir=/var/log/nginx
+ log_symlinks_check 1.10.1-3+xenial0
+ [ -z 1.10.1-3+xenial0 ]
+ dpkg --compare-versions 1.10.1-3+xenial0 lt-nl 1.10.1-0ubuntu1.1
+ return
dpkg: error processing package nginx-common (--configure):
And now we can see our problematic line in the script
dpkg --compare-versions 1.10.1-3+xenial0 lt-nl 1.10.1-0ubuntu1.1
returns exit code 1, as it should -- it's doing a version comparison and returns 0 or 1 depending on the result.
I won't comment on how to properly fix it, as it's an actual bug being tracked at #1637058 (for Ubuntu) and #1637200 (for PPAs) at LP.
Work-around fix:
Edit /var/lib/dpkg/info/nginx-common.config
and add a return
on the first line of the log_symlinks_check
function.
e.g.:
log_symlinks_check() {
return <---- here
# Skip new installations
[ -z "$1" ] && return
This will allow the upgrade process to continue.
EDIT As pointed out by @Thomas Ward, this will skip a setup step (fixing insecure symlinks -- if there are any -- in /var/log/nginx)