Today I got a duplicate sources.list entry warning when update local package index using apt-get update. As you can see from the screenshot below, I was notified that they are two entries for Google Chrome.
I looked at /etc/apt/sources.list file and I only saw one entry for Google Chrome in this file.
#Google Chrome deb http://dl.google.com/linux/chrome/deb/ stable main
So why apt-get said duplicate souces.list entry?
Many users are not aware that they can define software sources under /etc/apt/sources.list.d/ directory. As a matter of fact, when you add PPAs on Ubuntu, there will a new source list file for each PPA under this directory. And some programs can automatically configure a source list file under /etc/apt/sources.list.d/ directory. Google Chrome for example automatically generate a google-chrome.list file under /etc/apt/sources.list.d/ directory.
So if you followed the method metioned in this post to install Google Chrome on Debian, then in addition to the following entry you added in /etc/apt/sources.list file.
deb http://dl.google.com/linux/chrome/deb/ stable main
You will have another source list file under /etc/apt/sources.list.d/ directory. Let’s take a look with this command:
As you can see, this file is automatically configured. So that’s the problem. There’s another entry in this file.
To get rid of the duplicate sources.list entry warning, you can either comment out the entry in /etc/apt/sources.list file or comment out the entry in /etc/apt/sources.list.d/google-chrome.list file.
Another way to see duplicate entry is to use this command:
grep -R --include="*.list" chrome /etc/apt/
The duplicate sources.list entry warning should be gone by following the above method.