Error: 'deb [arch=amd64] https://download.docker.com/linux/ubuntu \ xenial \ stable' invalid

Solution 1:

That command is incorrectly line-wrapped which introduces line breaks and backslash characters where there should be none. The correct command would be:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

However, you still need to find and remove the previously added bogus entries. One way to find the files is via grep:

grep -ne '^deb.*docker.*\\' /etc/apt/sources.list{,.d/*.list}

I assume you know how to edit or remove files owned by root.

Solution 2:

check the file at /etc/apt/sources.list. The repo line should read:

deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable

Note the lack of backslash. You will need root privileges in order to edit this file if it is incorrect.