Malformed entry 11 in list file /etc/apt/sources.list (URI parse)

Posted January 15, 2021 136 views
Ubuntu 16.04

I deployed a ubuntu server. Then tried to install certain packages but this results in:

sudo: unable to resolve host production-server-1
E: Malformed entry 11 in list file /etc/apt/sources.list (URI parse)
E: The list of sources could not be read.

This is what sources.list looks like:

## Note, this file is written by cloud-init on first boot of an instance
## modifications made here will not survive a re-bundle.
## if you wish to make changes you can:
## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg
##     or do the same in user-data
## b.) add sources in /etc/apt/sources.list.d
## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl

# See for how to upgrade to
# newer versions of the distribution.
deb {{mirror}} {{codename}} main restricted
# deb-src {{mirror}} {{codename}} main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb {{mirror}} {{codename}}-updates main restricted
# deb-src {{mirror}} {{codename}}-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb {{mirror}} {{codename}} universe
# deb-src {{mirror}} {{codename}} universe
deb {{mirror}} {{codename}}-updates universe
# deb-src {{mirror}} {{codename}}-updates universe

How can I solve this problem.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

Hi there,

It looks like that the following line is line 11:

deb {{mirror}} {{codename}} main restricted

Have you made any changes to the source list file after the server setup? The line should not really hold any variables but an actual link to the repository.

What I could suggest is taking a default copy of the source list file from the exact Ubuntu version that you are currently using and replacing it.

Let me know how it goes.

Submit an Answer