7

I'm trying to update from Ubuntu 12.10 lately but I keep getting the "Failed to fetch" error.

W: Failed to fetch
http://security.ubuntu.com/ubuntu/dists/quantal-security/Release 
Unable to find expected entry 'independent/binary-amd64/Packages' in
Release file (Wrong sources.list entry or malformed file)

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/quantal/Release Unable to find expected entry 'independent/source/Sources' in Release file (Wrong sources.list entry or malformed file)

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/quantal-updates/Release Unable to find expected entry 'independent/binary-amd64/Packages' in Release file (Wrong sources.list entry or malformed file)

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/quantal-backports/Release Unable to find expected entry 'independent/binary-amd64/Packages' in Release file (Wrong sources.list entry or malformed file)

E: Some index files failed to download. They have been ignored, or old ones used instead.

I changed the server and deleted the source lists from /var/lib/apt/lists/ like some answers say but it still doesn't work.

karel
  • 114,770

4 Answers4

5

The message

(Wrong sources.list entry or malformed file)

Means that either some entry in your sources.list file is wrong or a line is malformed.

Searched the Web and I found this old bug, it is not exactly old, but Expired.

The solution (workaround is better word) is to examine your sources.list file and remove the word independent from the lines. Try it.

A good and detailed command to see all your sources.list entries is bellow:

find /etc/apt -name '*.list' -exec bash -c 'echo -e "\n$1\n"; cat -n "$1"' _ '{}' \;
Luís de Sousa
  • 13,227
  • 26
  • 81
  • 128
NickTux
  • 17,539
  • Works like a charme! thanks alot. I found tone of updates waiting and I can install softwares now :) I found that bug too. Almost lost hope on Ubuntu there. – Farouk BA Nov 08 '12 at 20:43
  • In this case you need to search and remove independent as that appears in the error message (Unable to find expected entry 'independent/...). If someone else has a different error - e.g. (Unable to find expected entry 'xyx') - you need to examine the file and remove xyz. – Wilf Jun 07 '15 at 09:29
3

If you land here in 2019 because apt update is spitting out something like this:

W: Failed to fetch http://mariadb.biz.net.id/repo/10.2/ubuntu/dists/bionic/InRelease  Could not connect to mariadb.biz.net.id:80 (203.142.69.189), connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead.

This worked for me:

You can change the mirror. I like digitalocean but this can be any valid mirror.

  • sudo apt update

Problem solved for me.

  • 1
    deb [arch=amd64] http://mirror.netcologne.de/mariadb//mariadb-10.4.8/repo/ubuntu/ trusty main worked for me. – mpen Nov 08 '19 at 05:53
2

For anyone coming to this in the future for a newer version of Ubuntu, NikTh's answer works but you want to search for commercial instead of independent.

This fixed the issue for me.

Alienz
  • 21
0

I had the same problem and I changed the server name by testing the best server in the software & updates application and then did a sudo apt-get update. Worked like a charm.