Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It is not possible to override/unset/replace "Unattended-Upgrade::Origins-Pattern" #366

Open
votdev opened this issue Jul 1, 2024 · 0 comments

Comments

@votdev
Copy link

votdev commented Jul 1, 2024

To override the configuration it is recommended to create an other APT configuration file fragment which overrides the shipped default value because updates to to shipped configuration file may conflict with the local changes blocking updating unattended-upgrades itself.

This does not work if you want to replace/unset the default shipped Origins-Pattern. The Unattended-Upgrade::Origins-Pattern in a different config file are always appended to the entries from /etc/apt/apt.conf.d/50unattended-upgrades. It is not possible to unset them partly for example. Is this by intention?

Example

The intention here is to remove/unset the entry "origin=Debian,codename=${distro_codename},label=Debian"; without the need to modify or delete the /etc/apt/apt.conf.d/50unattended-upgrades file (which should be prevented as mentioned in the README).

/etc/apt/apt.conf.d/50unattended-upgrades

Unattended-Upgrade::Origins-Pattern {
        // Codename based matching:
        // This will follow the migration of a release through different
        // archives (e.g. from testing to stable and later oldstable).
        // Software will be the latest available for the named release,
        // but the Debian release itself will not be automatically upgraded.
//      "origin=Debian,codename=${distro_codename}-updates";
//      "origin=Debian,codename=${distro_codename}-proposed-updates";
        "origin=Debian,codename=${distro_codename},label=Debian";
        "origin=Debian,codename=${distro_codename},label=Debian-Security";
        "origin=Debian,codename=${distro_codename}-security,label=Debian-Security";

        // Archive or Suite based matching:
        // Note that this will silently match a different release after
        // migration to the specified archive (e.g. testing becomes the
        // new stable).
//      "o=Debian,a=stable";
//      "o=Debian,a=stable-updates";
//      "o=Debian,a=proposed-updates";
//      "o=Debian Backports,a=${distro_codename}-backports,l=Debian Backports";
};

/etc/apt/apt.conf.d/52unattended-upgrades-local

Unattended-Upgrade::Origins-Pattern {
  "origin=Debian,codename=${distro_codename},label=Debian-Security";
  "origin=Debian,codename=${distro_codename}-security,label=Debian-Security";
};

Result

Allowed origins are: 
origin=Debian,codename=bookworm,label=Debian,
origin=Debian,codename=bookworm,label=Debian-Security,
origin=Debian,codename=bookworm-security,label=Debian-Security, 
origin=Debian,codename=bookworm,label=Debian-Security,
origin=Debian,codename=bookworm-security,label=Debian-Security
votdev added a commit to openmediavault/openmediavault that referenced this issue Jul 1, 2024
According to the unattended-upgrades README it should be possible to override the default shipped configuration. This is done by OMV, but it seems there is a bug in unattended-upgrades which appends instead of replaces the custom `Unattended-Upgrade::Origins-Pattern` configuration.

To workaround this issue, a `DPkg::Post-Invoke` is deleting the `/etc/apt/apt.conf.d/50unattended-upgrades` file.

Relates to: mvo5/unattended-upgrades#366

Signed-off-by: Volker Theile <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant