Skip to content

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

Open
koen-serry wants to merge 7 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 7 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
Comment thread distribution/debian/scripts/preinst Outdated
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 👍 / 👎.

@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: bbd27f3a80

ℹ️ 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 on lines +24 to +25
dpkg-maintscript-helper rm_conffile \
"/etc/vector/examples/$_example_conffile" 0.57.0-1 vector -- "$@"

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 Add the postrm half of rm_conffile

Although this adds the rm_conffile calls to preinst/postinst, I checked dpkg-maintscript-helper --help and it states that rm_conffile must be called in preinst, postinst, and postrm. Without a matching postrm call, an upgrade from a version that owned /etc/vector/examples/*.yaml can run preinst and move old examples to .dpkg-remove/.dpkg-backup, then if the upgrade aborts before postinst the abort path never restores them; purges also leave helper backup files behind. Please add the corresponding postrm transition for the same file list.

Useful? React with 👍 / 👎.

Comment on lines +31 to +32
if [ -e /etc/vector/vector.yaml.vector-preserve ]; then
mv -f /etc/vector/vector.yaml.vector-preserve /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.

P2 Badge Restore preserved config on aborted installs

Because the only restore of .vector-preserve is in postinst configure, an install/upgrade that reaches the preinst move and then aborts during unpack before postinst runs leaves the user's active /etc/vector/vector.yaml displaced as /etc/vector/vector.yaml.vector-preserve while the package is not configured. Add an abort-install/abort-upgrade cleanup path, such as a postrm handler, so failed upgrades do not leave Vector without its original config at the default path.

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.

2 participants