Skip to content

[packaging] Lifecycle paths that leave the stack down or stuck (remove, purge, upgrade, reruns) #771

Open

Description

@guanzhousongmicrosoft

Package lifecycle paths on the 1.0 RC2 native install that leave the stack down after reboot, or in a state the user can't get out of.

Tested on release/1.0-RC2-v2 @ 40f86c0. Ubuntu 24.04 + PG18 debs (and Rocky 9 RPMs where noted) were built from that commit, installed with install.sh test-repository mode, and run in privileged systemd containers. docker restart stood in for a reboot. The upgrade source was the published 1.0-rc1 packages.

Items

  • apt remove documentdb-18 + reinstall leaves the target disabled; install.sh then reports unhealthy
  • Removing the documentdb meta package leaves nothing enabled at boot
  • Greenfield setup for a second major stops a running documentdb-gateway.service on the same port
  • Package upgrades never restart PostgreSQL or say that a restart is needed
  • Purge, then reinstall: no supported path (residual-data refusal, and the gateway uid changes)
  • Ubuntu 26.04: the tune umask fixes are not on the release branch
  • A non-interactive apt upgrade with an edited conffile leaves packages unconfigured
  • Reruns and undo paths that silently lose configuration

1. remove → reinstall

  1. The documentdb-18 prerm runs systemctl disable [email protected] on remove.
  2. Nothing re-enables it on reinstall, and the "next steps" banner is skipped because dpkg passes the old version.
  3. setup.conf survives remove, so install.sh goes to status mode and exits 1 with "not healthy. Diagnose it with documentdb-setup and systemctl". The stack stays down after reboot too.

Workaround: systemctl enable --now [email protected].

Fix: either don't disable on remove, or re-enable in postinst when setup.conf exists.

2. Meta package removal

  1. With the meta installed, setup enables only documentdb-local.target (the alias), not @18.
  2. apt remove documentdb deletes the alias.
  3. After reboot everything is inactive, and documentdb-setup --status returns rc=1.

The meta's purge hint also omits postgresql-18-documentdb.

3. Second major stops a Workflow-B gateway

Setup:

  1. Run Workflow B on a PG17 cluster with documentdb-gateway.service listening on 10260.
  2. Run documentdb-setup --pg-version 18 (greenfield).

What happens:

  • Setup logs Stopping manually started gateway (pid ...) before systemd takeover and kills it.
  • Workflow-B clients now get "Invalid account".
  • Both units stay enabled. After reboot documentdb-gateway.service is stuck in activating.

Same-major is correctly refused. The port-takeover logic in documentdb-setup.sh should refuse a listener it didn't start.

4. Upgrade doesn't restart PostgreSQL

On RC1 → RC2 apt upgrade / dnf upgrade, the gateway restarted (new pid) but the postmaster kept its pid and start time. binary_extended_version() kept reporting the RC1 sha until a manual restart.

Nothing tells the user that PG needs a restart, or that documentdb-setup must be rerun to apply ALTER EXTENSION ... UPDATE. RC1 and RC2 share catalog 1.0-0, so the missing ALTER only shows from older versions.

Expected: the upgrade either restarts PostgreSQL and updates the extension, or prints exactly what to run.

5. Purge → reinstall

  1. Purge leaves /var/lib/documentdb-local/18/{data,gateway/tls} but deletes the documentdb-gateway user and group (DEB postrm; dnf remove does the same).
  2. install.sh then refuses with "Residual data ... Reconcile or remove it with documentdb-setup", but documentdb-setup was purged and has no "remove data" mode.
  3. If the user installs documentdb-18 manually and runs setup, setup silently adopts the old data and resets the admin password.
  4. The gateway then crash-loops with Failed to create TLS provider ... Permission denied, because the TLS files keep the old uid.

#735 tracks the uid part for RPM; this is the DEB side plus the installer refusal. Needed: a documented adopt-or-wipe path, and stable ownership of retained state.

6. Ubuntu 26.04 tune

The umask fixes on main (1dcc471, 877bdec) are not on release/1.0-RC2-v2. On a fresh Ubuntu 26.04 host, documentdb-tune exits 0 with "Config written". But the parent directories are created 0700, so postgres can't read the fragment, and after restart shared_preload_libraries is empty. A rerun repairs nothing.

These commits need backporting to the release branch. Separately, tune says "this host has no sudo" and then prints a sudo command.

7. Conffile prompt during a non-interactive upgrade

Edit /etc/documentdb/gateway/SetupConfiguration.json, then run DEBIAN_FRONTEND=noninteractive apt-get upgrade -y </dev/null.

The result is "end of file on stdin at conffile prompt". The gateway, common and documentdb-18 packages are left unconfigured (rc=100). This is standard dpkg behaviour, but the docs or the upgrade notes should mention -o Dpkg::Options::=--force-confold.

8. Reruns and undo paths

  • Re-registering the gateway: documentdb-register-gateway rerun without --listen-addr drops DOCUMENTDB_LISTEN_ADDR=:10261, so the gateway moves back to 10260. Before the printed "reload PostgreSQL" step, clients hang 60 s or more on peer-auth failures instead of getting an error. Related to [packaging] documentdb-setup, reset and package removal report success that isn't true #760 item 4.
  • Reset: documentdb-local-reset leaves /etc/documentdb/documentdb-postgresql.env and, with the meta installed, the enabled alias. After reboot documentdb-local.target is "active" with nothing running.
  • Undo: the "Undo setup" path (documentdb-setup --restore) leaves the whole data directory. install.sh then refuses on residual data, and setup silently re-adopts it and resets the password.

Activity

  1. added
    documentdb-1.0
    1.0-blocker
    on Oct 5, 2026
  2. added this to the 1.0 milestone on Oct 6, 2026
  3. guanzhousongmicrosoft commented on Oct 6, 2026

    @guanzhousongmicrosoft
    MemberAuthor

    1.0 blockers: item 4 (upgrade leaves the old library loaded), item 5 (purge then reinstall breaks the gateway's TLS state, same cause as #735) and item 6 (Ubuntu 26.04 tune). Items 4 and 5 are in review. Item 6 is fixed on main and still needs a backport to the 1.0 release branch. The other items don't block 1.0.

  4. guanzhousongmicrosoft commented on Nov 23, 2026

    @guanzhousongmicrosoft
    MemberAuthor

    Items 1–5, 7 and 8 are addressed on main (b566aa3), and the Ubuntu 26.04 tune fix for item 6 is on main (ab0a6e1). Still to confirm: item 6 on the 1.0 release branch, and tune's "no sudo" message printing a sudo command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    1.0-blockerbugdocumentdb-1.0packaging

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions