Score:2

What is the purpose of the /etc/apt/preferences.d directory in Ubuntu?

us flag

When I put some apt config file into /etc/apt/preferences.d of my Ubuntu 20 LTS desktop, it is ignored (cannot be seen in the output of apt-config dump).
When I instead put the same *.conf file into the /etc/apt/apt.conf.d directory, it is honored (can be seen in the output of apt-config dump).

So what is the purpose of the /etc/apt/preferences.d directory in Ubuntu ?

cn flag
if not ... https://difyel.com/linux/etc/apt/preferences/
Juergen avatar
us flag
@user535733, not before asking - but now I did: Seems `preferences.d` is for `*.pref` files that contain preferences for packages, but preferences for `apt-config` must go into `apt.conf.d/*.conf`. Maybe the word "preferences" was misleading for me. If this is the correct answer, please write it as an answer and I would accept it.
Juergen avatar
us flag
OK, did not reach you, so writing this as my own answer.
Score:2
us flag

According to man apt_preferences, the directory /etc/apt/preferences.d is for *.pref files that contain preferences for packages, but preferences for apt-config must go into apt.conf.d/*.conf.

apt-config ignores wrong *.conf files in /etc/apt/preferences.d, but apt-get install warns with
Ignoring file 'somefile.conf' in directory '/etc/apt/preferences.d/' as it has an invalid filename extension.

user535733 avatar
cn flag
Glad to see you figured it out.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.