roots / trellis

WordPress LEMP stack with PHP 8.2, Composer, WP-CLI and more
https://roots.io/trellis/
MIT License
2.51k stars 607 forks source link

Bug: Target Packages (nginx/binary-amd64/Packages) is configured multiple times [...] #1363

Closed strarsis closed 2 years ago

strarsis commented 2 years ago

Terms

Description

What's wrong?

After applying the latest Trellis on a staging server, apt update shows warnings for multiple times configured target packages/CNF. (See the "Relevant Log Output" section below).

/etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:

deb [arch=amd64] http://nginx.org/packages/mainline/ubuntu focal nginx
deb http://nginx.org/packages/mainline/ubuntu focal nginx

Note: Admittedly this staging server had a quite old Trellis version: From about August of last year, 2021.

What have you tried?

Commenting out one of the duplicate line fixed the warning. Purging all the managed and unmanaged files indiscriminately in /etc/apt/sources.list.d and re-provisioning also fixes the problem.

What insights have you gained?

A previously added apt source files for the previously used nginx fork becomes unmanaged and is not cleaned up when the new nginx apt source is added.

Possible solutions

Explicitly clean up the apt source file of previously used nginx fork in Trellis, so re-provisioning an existing Trellis server will not result in an unmanaged, left-over apt sources file that cause these apt warnings (and possible source inconsistencies when installing nginx packages).

Temporary workarounds

The apt warnings can probably be ignored. But there could be inconsistencies with nginx package versions and from where they will be installed. As a workaround, the duplicate lines mentioned in the apt update warnings can be commented out.

Steps To Reproduce

  1. Provision a server with an earlier Trellis version / use an existing Trellis server that was provisioned by an earlier Trellis version.
  2. Provision the server with latest Trellis version.
  3. Invoke apt update for maintenance and updating system packages. Note the apt warnings about duplicate target packages/CNF.

Expected Behavior

No unmanaged, left-over apt source files with duplicate target packages/CNF; no apt warnings after having re-provisioned an existing Trellis server with a newer Trellis version.

Actual Behavior

Unmanaged, left-over apt source files with duplicate target packages/CNF; no apt warnings after having re-provisioned an existing Trellis server with a newer Trellis version.

Relevant Log Output

W: Target Packages (nginx/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:1 and /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:2
W: Target Packages (nginx/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:1 and /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:2
W: Target Translations (nginx/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:1 and /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:2
W: Target Translations (nginx/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:1 and /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:2
W: Target CNF (nginx/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:1 and /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:2
W: Target CNF (nginx/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:1 and /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:2
W: Target Packages (nginx/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:1 and /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:2
W: Target Packages (nginx/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:1 and /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:2
W: Target Translations (nginx/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:1 and /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:2
W: Target Translations (nginx/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:1 and /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:2
W: Target CNF (nginx/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:1 and /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:2
W: Target CNF (nginx/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:1 and /etc/apt/sources.list.d/nginx_org_packages_mainline_ubuntu.list:2

Versions

Create mysql my.cnf credentials file earlier (#1360)

swalkinshaw commented 2 years ago

Fairly certain this is caused by the change in https://github.com/roots/trellis/pull/1318

The apt warnings can probably be ignored. But there could be inconsistencies with nginx package versions and from where they will be installed.

I think they can be safely ignored since the only difference in sources in the architecture specified (amd64 vs all). Ubuntu automatically detects the architecture and picks the correct one anyway.

So I'm not sure if it's worth adding an explicit cleanup task or not.

swalkinshaw commented 2 years ago

Thanks for reporting this @strarsis but I'm going with "not worth fixing for now"