couchdb
couchdb copied to clipboard
3.2.2 on Ubuntu 22.04 -- interactive install creates admin, pre-populated debconf does not -- couchdb refuses to start
Moving to couch3.
We pre-populate debconf for unattended installs when provisioning servers. Something like...
echo "couchdb couchdb/mode select standalone
couchdb couchdb/adminpass password <somepass>
couchdb couchdb/adminpass_again password <somepass>
couchdb couchdb/bindaddress string 127.0.0.1
couchdb couchdb/nodename string couchdb@localhost
couchdb couchdb/postrm_remove_databases boolean false
couchdb couchdb/cookie string <somecookie>
" | debconf-set-selections
followed by
DEBIAN_FRONTEND=noninteractive apt-get install -y couchdb
However when starting up couchdb we get the following:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
No Admin Account Found, aborting startup.
Please configure an admin account in your local.ini file.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
However if we clear the debconf values and do a manual interactive install of couchdb, the admin account is properly set and couchdb starts up without issue.
apt-get remove couchdb
apt-get install debconf-utils
echo PURGE | debconf-communicate couchdb
debconf-get-selections | grep -E '^couchdb'
apt-get install couchdb
Is there a way we can utilize debconf preseed to ensure the admin is created? I know I can also set the password in a local ini and couch will salt/hash it on next startup...however we would like to use debconf if possible.
Well I found at least one interesting thing.
This debconf...
couchdb couchdb/bindaddress string 127.0.0.1
...results in...
cat /opt/couchdb/etc/default.d/10-bind-address.ini
# Package-introduced bind address
[chttpd]
bind_address = 127.0.0.1
...which prevents couchdb from starting. The error in the log is the following:
Application chttpd exited with reason: {{shutdown,{failed_to_start_child,chttpd,invalid_bind_address}},{chttpd_app,start,[normal,[]]}}
This is because there is 2 spaces between the =
and the 127
. Apparently couchdb doesn't trim whitespace when parsing config files (at least in 3.2.2).
The fix is that all excess whitespace needs to be removed from the debconf pre-populated values (single space separating each token only).
This doesn't resolve the admin user not getting created, but is a related debconf issue.
Hi, I suspect that the problems are entirely due to the leading/trailing white spaces. Did the admin-config value also have leading white-spaces in it?
@mattpr ^
I think this issue is fixed. Closing.
Hey @big-r81 -- really sorry I ghosted you. It wasn't on purpose. I didn't see any notifications (probably just missed it on a busy inbox day) and don't normally check notifications directly on github.
Unfortunately it has been so long I don't have the repro or issue top of mind anymore, but I did save a backup of the debconf we were using from around this time and there was some extra whitespace on couchdb/adminpass
.
couchdb couchdb/adminpass password XXXXXXXXXXXXXXX
couchdb couchdb/adminpass_again password XXXXXXXXXXXXXXX
...
Our updated debconf doesn't have the extra whitespaces.
I've deployed couchdb recently for a new app and the debconf does work for the admin user now...so yes I would say one way or another (it was probably the same whitespace issue), this has been resolved.
👍🏼