couchdb-pkg icon indicating copy to clipboard operation
couchdb-pkg copied to clipboard

Nouveau Debian package fails if CouchDB package is not already configured

Open martiell opened this issue 1 year ago • 0 comments

The postinst script for couchdb-nouveau can fail if the couchdb package is not yet configured.

If installing both at the same time, the couchdb-nouveau postinst script may run before the couchdb postinst script that creates the user. In this case, the couchdb user is not yet present when the couchdb-nouveau package is configured, and its postinst script will fail on the following line, because the user doesn't exist:

chown couchdb:couchdb /opt/couchdb/etc/default.d/10-nouveau.ini

Expected Behavior

It should be possible to install couchdb and couchdb-nouveau in the same apt-get invocation, interactively or in an automated way.

Current Behavior

This is the end of the output from sudo apt install couchdb couchdb-nouveau after purging both packages and their configuration. (Not shown: interactive package configuration to select standalone install type, cookie, admin password, etc)

Fetched 67.0 MB in 5s (14.7 MB/s)
Preconfiguring packages ...
Selecting previously unselected package couchdb.
(Reading database ... 160047 files and directories currently installed.)
Preparing to unpack .../couchdb_3.4.0~jammy_arm64.deb ...
Unpacking couchdb (3.4.0~jammy) ...
Selecting previously unselected package couchdb-nouveau.
Preparing to unpack .../couchdb-nouveau_3.4.0~jammy_arm64.deb ...
Unpacking couchdb-nouveau (3.4.0~jammy) ...
Setting up couchdb-nouveau (3.4.0~jammy) ...
chown: invalid user: ‘couchdb:couchdb’
dpkg: error processing package couchdb-nouveau (--configure):
 installed couchdb-nouveau package post-installation script subprocess returned error exit status 1
Setting up couchdb (3.4.0~jammy) ...
Created symlink /etc/systemd/system/multi-user.target.wants/couchdb.service → /lib/systemd/system/couchdb.service.
Processing triggers for man-db (2.10.2-1) ...
Errors were encountered while processing:
 couchdb-nouveau
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

The couchdb-nouveau package is left in an unconfigured state.

Possible Solution

It may be possible to check if the couchdb user exists, and only chown 10-nouveau.ini if it does. I think this may work because the couchdb postinst script changes the owner:group of /opt/couchdb/etc/default.d/* to couchdb:couchdb.

Steps to Reproduce (for bugs)

  1. sudo apt-get remove --purge couchdb couchdb nouveau
  2. sudo apt-get install couchdb couchdb nouveau
  3. Run through debconf configuration screens interactively with reasonable values

Context

I was building packages for 3.4.0-RC4 to evaluate. As a workaround, the couchdb-nouveau package can be installed in a separate apt-get invocation after couchdb is already configured.

Your Environment

  • Version used: 3.4.0-RC4
  • Browser Name and version: n/a
  • Operating System and version (desktop or mobile): Ubuntu Jammy
  • Link to your project: n/a

martiell avatar Sep 18 '24 08:09 martiell