7

I have tried to change a apt config value with apt-config but without success:

apt-config -o APT::Periodic::Unattended-Upgrade=1 shell

Is there a another program on Debian / Ubuntu with you can customize the configuration?

2
  • 2
    I do not understand what the -o option is for then. I can see some temporary effect: $ apt-config -o APT::Periodic::Unattended-Upgrade=1 dump | grep ^APT::Periodic::Unattended-Upgrade APT::Periodic::Unattended-Upgrade "1"; $ apt-config dump | grep ^APT::Periodic::Unattended-Upgrade APT::Periodic::Unattended-Upgrade "0";
    – jarno
    Feb 15, 2019 at 11:06
  • BTW you could giveargument(s) for dump: apt-config dump APT::Periodic::Unattended-Upgrade to restrict its output (though man page does not tell it currently)
    – jarno
    Apr 30, 2023 at 8:52

2 Answers 2

5

Nope, apt-config is read-only (as its --help will tell you):

 apt-config is a simple tool to read the APT config file

To persist an Apt configuration change, you need to edit/add to the configuration files in /etc/apt/apt.conf.d/. Before you start creating new files, you might want to check to see if that variable has already been set. Here's a quick grep looking for "Periodic":

$ grep -R Periodic /etc/apt/apt.conf.d/
/etc/apt/apt.conf.d/10periodic:APT::Periodic::Update-Package-Lists "1";
/etc/apt/apt.conf.d/10periodic:APT::Periodic::Download-Upgradeable-Packages "1";
/etc/apt/apt.conf.d/10periodic:APT::Periodic::AutocleanInterval "0";
/etc/apt/apt.conf.d/10periodic:APT::Periodic::Unattended-Upgrade "1";

This may differ from your computer so run it. If I were going to make any changes, I'd run sudoedit /etc/apt/apt.conf.d/10periodic. Apt should pick those up the next time one of its commands runs.


Note: the above obviously applies to the apt.config side of things. There are other settings lurking around in /etc/apt/ (the parent directory of above) that may be applicable if you're trying to set other things.

2
  • 2
    apt-config --help does not tell it is read-only (apt 1.2.29).
    – jarno
    Feb 15, 2019 at 11:00
  • This answer is objectively wrong/outdated. Jul 6, 2022 at 19:16
0

apt-config is not read-only but does not document all options in --help

apt 2.4.5 (amd64) Usage: apt-config [options] command

apt-config is an interface to the configuration settings used by all APT tools, mainly intended for debugging and shell scripting.

Most used commands: shell - get configuration values via shell evaluation dump - show the active configuration setting

See apt-config(8) for more information about the available commands. Configuration options and syntax is detailed in apt.conf(5). Information about how to configure sources can be found in sources.list(5). Package and version choices can be expressed via apt_preferences(5). Security details are available in apt-secure(8).

Keywords "See apt-config(8) for more information". In other words the information displayed by --help is incomplete by design. Upon viewing the man page for apt-config vi man apt-config you see

-o, --option Set a Configuration Option; This will set an arbitrary configuration option. The syntax is -o Foo::Bar=bar. -o and --option can be used multiple times to set different options.

Thus the op should have stated what error they were getting. I suppect its because sudo was not used to execute the command. This is required to modify any system wide configuration such that of apt.

2
  • op's command does give neither output nor error status, Command apt-config -o APT::Periodic::Unattended-Upgrade=1 shell var APT::Periodic::Unattended-Upgrade gives var='1' but what is the point?
    – jarno
    Apr 30, 2023 at 8:49
  • The error code can help identify where a problem is happening. As far as the question does apt-config support this setting I guess it doesn't matter. May 2, 2023 at 20:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .