"Failed to fetch" while updating
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"' _ '{}' \;
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:
- sudo vi /etc/apt/sources.list
- Comment out: deb [arch=amd64] http://mariadb.biz.net.id/repo/10.2/ubuntu bionic main
- Add: deb [arch=amd64] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.2/ubuntu bionic main
You can change the mirror. I like digitalocean but this can be any valid mirror.
- sudo apt update
Problem solved for me.
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.