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

30,008

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.

Share:
30,008
Redscarfs
Author by

Redscarfs

Updated on September 18, 2022

Comments

  • Redscarfs
    Redscarfs almost 2 years

    I was following instructions (https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#install-docker-ce-1) to try install Docker CE on VirtualBox running Ubuntu 16.04.3. Then when I tried to set up the stable repository on step 4 by doing:

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

    I got

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

    Can someone please help? I am new to programming but online search doesn't appear to show anything directly relevant.

  • Redscarfs
    Redscarfs over 6 years
    Corrected, THX!
  • Redscarfs
    Redscarfs over 6 years
    I started a new virtual machine and its now working!
  • LUser
    LUser over 3 years
    Sad there is actually a question on this.
  • Zanna
    Zanna over 3 years
    There is nothing in the quoted portion that would be treated differently with the different quotes. Perhaps when you used double quotes they were not standard double quotes, but fancy ones (i.e. a different unicode character) copy-pasted from somewhere?