Subprocess post-installation script returned error exit status 1

Scenario: while installing a package in Debian, we get into the following situation:

debian:~# apt-get install bugzilla
Reading Package Lists... Done
Building Dependency Tree... Done
bugzilla is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 1272 not upgraded.
1 not fully installed or removed.
Need to get 0B of archives.
After unpacking 0B of additional disk space will be used.
Setting up bugzilla (2.22.1-2) ...
dbconfig-common: writing config to /etc/dbconfig-common/bugzilla.conf
dpkg: error processing bugzilla (--configure):
 subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
 bugzilla
E: Sub-process /usr/bin/dpkg returned an error code (1)

This is yet another "observability" problem, as clearly too little information is provided to determine the problem's cause.

The correct way to proceed is to trace the execution of the failed post-installation script, but first we need to find out where it is and how it is called. Note that the apt-get install internally runs dpkg --install and, as we can learn from dpkg's man page, dpkg --configure. The post-installation script is invoked by dpkg --configure. To see how it is done, we use strace:

debian:~# ( strace -f dpkg --configure bugzilla 2>&1 ) \
| grep execve | grep post
[pid  6289] execve("/var/lib/dpkg/info/bugzilla.postinst",
["/var/lib/dpkg/info/bugzilla.post"..., "configure", "2.20.1-1"],
[/* 47 vars */] 
[pid  6289] execve("/usr/share/debconf/frontend",
["/usr/share/debconf/frontend", "/var/lib/dpkg/info/bugzilla.post"...,
"configure", "2.20.1-1"], [/* 45 vars */]) = 0
[pid  6310] execve("/var/lib/dpkg/info/bugzilla.postinst",
["/var/lib/dpkg/info/bugzilla.post"..., "configure", "2.20.1-1"],
[/* 46 vars */]) = 0

Based on the first logged execve, we try the following command:

/var/lib/dpkg/info/bugzilla.postinst configure 2.20.1-1; echo $?

and we see that it in fact reproduces the error reported by dpkg --configure. From here we can rely on generic shell script tracing or debugging techniques to determine the cause.

No comments:

Post a Comment