In the folder /etc/apt/sources.list.d
I have the file:
google-chrome-repo.list:
deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome-keyring.gpg] https://dl.google.com/linux/chrome/deb/ stable main
deb-src [arch=amd64 signed-by=/usr/share/keyrings/google-chrome-keyring.gpg] https://dl.google.com/linux/chrome/deb/ stable main
and in the folder /usr/share/keyrings
i have a file named google-chrome-keyring.gpg
If I install google-chrome:
sudo apt-get install google-chrome-stable
That annoying second file is created in /etc/apt/sources.list.d
with the name google-chrome.list
, with content:
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main
and the file in the /etc/apt/trusted.gpg.d
folder named google-chrome.gpg
If I don't delete the annoying autogenerated file /etc/apt/sources.list.d/google-chrome.list
, then the command:
sudo apt-get purge google-chrome-stable
will give the following error:
E: Conflicting values set for option Signed-By regarding source https://dl.google.com/linux/chrome/deb/ stable: /usr/share/keyrings/google-chrome-keyring.gpg !=
E: The list of sources could not be read.
My goal instead is to be able to do apt-get install
and apt-get purge
of google-chrome as many times as I want, without first having to delete the autogenerated file each time.
How can i get this?
Is there a way to make apt-get
ignore that file?
The solutions proposed in other topics like delete that file
are not really functional.
I want to be able to use apt-get
directly as written above and not scripts or substitute functions.
It would be nice if there were some Dpkg::Options::=
like:
Of multiple coincident files in "sources.list.d", only consider the oldest one (the one created first).
I don't think what you explicitly asks is possible (to use only the oldest source file).
But instead, you can make a
DPkg::Post-Invoke
command that runs after usingapt
/dpkg
to remove the file you don't want.Create the file
/etc/apt/apt.conf.d/100post-invoke
(you can call it anything you like) with the contents:Now, after running any
apt install
orapt purge
command, the file/etc/apt/sources.list.d/google-chrome.list
will be deleted (or ignored if it doesn't exist).You can of course add any number of commands to the
/etc/apt/apt.conf.d/100post-invoke
file to customize the behavior ofapt
/dpkg
.