Debian: How to fix the warning “Duplicate sources.list” while running “apt-get update”

Hi there guys,

just to share an easy fix for the following situation:

Imagine that you want to execute APT to obtain the packages lists from the sources you specified (“/etc/apt/sources.list”), for that you would run:

sudo apt-get update

After executing the above command you got the following warning:

W: Duplicate sources.list entry http://dl.google.com/linux/chrome/deb/ stable/main amd64 Packages (/var/lib/apt/lists/dl.google.com_linux_chrome_deb_dists_stable_main_binary-amd64_Packages)
W: Duplicate sources.list entry http://dl.google.com/linux/chrome/deb/ stable/main i386 Packages (/var/lib/apt/lists/dl.google.com_linux_chrome_deb_dists_stable_main_binary-i386_Packages)
W: You may want to run apt-get update to correct these problems

This means that there are duplicate entries on your sources list (“/etc/apt/sources.list”). In my case per the above warning I can see that there are duplicate entries for Google Chrome but this can happen on all kinds of software package lists.

To find out where they are run the following command (single line):

 grep -R --include="*.list" chrome /etc/apt/

kali-chromet

I did a recursive search for “chrome” on all files with the extension “.list” under each directory of “/etc/apt” and I got the following duplicates on the output:

/etc/apt/sources.list.d/google-chrome.list:deb http://dl.google.com/linux/chrome/deb/ stable main

/etc/apt/sources.list:deb http://dl.google.com/linux/chrome/deb stable main

kali-chrome2

Based on the above output I have duplicate entries for chrome on “/etc/apt/souces.list” and “/etc/apt/sources.list.d/google-chrome.list”, the last one has been automatically created during Chrome installation.

The “/etc/apt/sources.list.d” directory provides a way to add sources.list entries in separate files, I don’t want separate files to manage my sources and I prefer to manage all sources on a single file (“/etc/apt/souces.list”), so I will comment ( # ) the entry on “google-chrome.list”:

sudo nano /etc/apt/sources.list.d/google-chrome.list

Comment ( # ) the entry:

# http://dl.google.com/linux/chrome/deb/ stable main

Press [CONTROL]+[X] to exit and save the file.

kali-chrome3

 

Now rerun the “apt-get update” and everything should be ok.

kali-chrome4

 

That’s all folks.

 

R-Tape Loading error,
Luís Rato

Anúncios

~ por Luis Rato em 5 de Janeiro de 2014.

Deixe uma Resposta

Preencha os seus detalhes abaixo ou clique num ícone para iniciar sessão:

Logótipo da WordPress.com

Está a comentar usando a sua conta WordPress.com Terminar Sessão / Alterar )

Imagem do Twitter

Está a comentar usando a sua conta Twitter Terminar Sessão / Alterar )

Facebook photo

Está a comentar usando a sua conta Facebook Terminar Sessão / Alterar )

Google+ photo

Está a comentar usando a sua conta Google+ Terminar Sessão / Alterar )

Connecting to %s

 
%d bloggers like this: