Skip to content

fix(debian): preserve vector.yaml as a conffile + move examples to docs folder#25884

Open
koen-serry wants to merge 4 commits into
vectordotdev:masterfrom
koen-serry:fix-debian-conffiles
Open

fix(debian): preserve vector.yaml as a conffile + move examples to docs folder#25884
koen-serry wants to merge 4 commits into
vectordotdev:masterfrom
koen-serry:fix-debian-conffiles

Conversation

@koen-serry

Copy link
Copy Markdown

Summary

Vector configuration

How did you test this PR?

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

Notes

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • Some CI checks run only after we manually approve them.
    • We recommend adding a pre-push hook, please see this template.
    • Alternatively, we recommend running the following locally before pushing to the remote branch:
      • make fmt
      • make check-clippy (if there are failures it's possible some of them can be fixed with make clippy-fix)
      • make test
  • After a review is requested, please avoid force pushes to help us review incrementally.
    • Feel free to push as many commits as you want. They will be squashed into one before merging.
    • For example, you can run git merge origin master and git push.
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run make build-licenses to regenerate the license inventory and commit the changes (if any). More details on the dd-rust-license-tool.

@koen-serry
koen-serry requested a review from a team as a code owner July 17, 2026 15:08
@github-actions github-actions Bot added the domain: releasing Anything related to releasing Vector label Jul 17, 2026
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@datadog-vectordotdev

This comment has been minimized.

@koen-serry

Copy link
Copy Markdown
Author

I have no clue what that CLA Assistant is

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7bc4e400cc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Cargo.toml
section = "admin"
maintainer-scripts = "distribution/debian/scripts/"
conf-files = ["/etc/default/vector"]
conf-files = ["/etc/default/vector", "/etc/vector/vector.yaml"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid conffile prompts on upgrades

For Debian users who installed a version where /etc/vector/vector.yaml was not package-owned and then created that file themselves, adding the same path as a new dpkg conffile makes dpkg -i stop at the “File on system created by you” conffile prompt; without explicit --force-confold/confnew options, unattended apt/dpkg upgrades fail before the package is configured. The new verify path only reinstalls this same package, so it misses the transition from an unowned user config to a packaged conffile; please add a maintainer-script transition or another approach that preserves the existing file without prompting.

Useful? React with 👍 / 👎.

@koen-serry

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

…file

Since /etc/vector/vector.yaml was not a dpkg conffile before this change,
a file already present at that path (created by a user, or by an older
Vector package) is unknown to dpkg. Unpacking it as a new conffile makes
dpkg treat it as "created by you" and stop at an interactive prompt,
which breaks unattended upgrades without --force-confold/confnew.

Add a preinst/postinst transition: preinst moves aside any untracked
pre-existing file so dpkg can install the conffile without prompting,
and postinst restores it afterwards so the content is preserved
byte-for-byte. Once installed this way the path is a normal tracked
conffile and standard dpkg conffile handling applies on later upgrades.

Extend verify-install.sh to seed such an untracked file before the first
install and assert it survives, since the existing verify path only
reinstalled the same package and never exercised this transition.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a1bc7cbd4b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Cargo.toml
["distribution/debian/vector.yaml", "/etc/vector/vector.yaml", "644"],
["config/vector.yaml", "/usr/share/vector/examples/vector.yaml", "644"],
["config/examples/*", "/etc/vector/examples/", "644"],
["config/examples/*", "/usr/share/doc/vector/examples/", "644"],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove obsolete Debian example conffiles on upgrade

When upgrading from a Debian package that installed config/examples/* under /etc/vector/examples, cargo-deb treats those /etc files as conffiles, so moving the asset here only affects fresh installs: dpkg leaves the old /etc/vector/examples/*.yaml files on disk and marks them obsolete (this matches dpkg-maintscript-helper(1), which says removed conffiles need an explicit rm_conffile transition). That means the new verify/changelog expectation that examples no longer live under /etc is false for existing users; please add a maintainer-script transition for the previous example paths so unmodified old examples are removed and modified ones are preserved as backups.

Useful? React with 👍 / 👎.

case "$1" in
install|upgrade)
if [ -e /etc/vector/vector.yaml ] && [ ! -L /etc/vector/vector.yaml ]; then
if ! dpkg-query -W -f='${Conffiles}' vector 2>/dev/null | grep -q ' /etc/vector/vector.yaml '; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve obsolete vector.yaml before re-adding it

For users who upgraded through the release that removed /etc/vector/vector.yaml, dpkg-query still reports the old path with an obsolete marker (the dpkg-maintscript-helper docs describe this state for removed conffiles), so this grep treats it as tracked and skips the preserve/restore path. If that old config was locally modified, dpkg prompts when this package re-adds a different conffile, which breaks unattended upgrades; treat obsolete conffile entries as needing the same no-prompt preservation path.

Useful? React with 👍 / 👎.

install|upgrade)
if [ -e /etc/vector/vector.yaml ] && [ ! -L /etc/vector/vector.yaml ]; then
if ! dpkg-query -W -f='${Conffiles}' vector 2>/dev/null | grep -q ' /etc/vector/vector.yaml '; then
mv /etc/vector/vector.yaml /etc/vector/vector.yaml.vector-preserve

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Don't move files owned by another package

If /etc/vector/vector.yaml is provided by a local configuration package or any other Debian package while vector is not installed, this mv runs before dpkg's file-conflict check and hides the other package's file; I verified with dummy packages that dpkg still aborts on the ownership conflict after preinst, leaving only vector.yaml.vector-preserve and no file at the path owned by the other package. Please check package ownership (not only Vector's conffile list) before moving the file aside.

Useful? React with 👍 / 👎.

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

Labels

domain: releasing Anything related to releasing Vector

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant