What is "deb deb-src stable/xenial main" in /etc/apt/sources.list [duplicate]

I was going through Repository files and in file /etc/apt/sources.list, saw these lines :

deb http://ppa.launchpad.net/elementary-os/stable/ubuntu xenial main
deb-src http://ppa.launchpad.net/elementary-os/stable/ubuntu xenial main

Wherein, I understand that

http://ppa.launchpad.net/elementary-os/stable/ubuntu

is where apt-get would retrieve files from, but I couldn't get what the rest of words in it mean. These words are deb, deb-src, xenial main, stable main, trusty main.

Edit: Also, I found these lines while visiting this site and noticed [arch=amd64] in between deb and the URL.

echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/chrome.list

So, The Question here is:

  • What do these words in sources.list file mean?

    deb
    deb-src
    xenial main
    stable main
    trusty main
    
  • Also, What does [arch=amd64] mean?


Solution 1:

Your question revolves around the syntax or format of source list file that describes other programs what, how & from where to get the sources. So, Here it goes :

Apt ( Advanced package tool )

used to manage the repository on Debian & Debian-based (Ubuntu) systems. It uses a file that lists the Repository Sources from where packages should and can be obtained. Also the file lists how the packages should be obtained and from what subpackages (or suites).


Everything lies in the /etc/apt/sources.list

The format in which entities are written tells everything to apt. However, there are two variations of the format.

  1. One-line-style format

    • They have extensions .list
    • Traditional format, supported by all version of apt.
    • A single line entry describes the source.
    • Example :

      deb http://security.debian.org stretch/updates main contrib non-free
      
  2. deb822-style format

    • They have extension .sources
    • Supported by apt itself since version 1.1
    • Individual entries are separated by an empty line where each entry contains information in the form of fieldname : value.
    • Example :

      Types: deb
      URIs: http://deb.debian.org/debian
      Suites: stretch
      Components: main contrib non-free 
      

As you can get an idea from deb822-style format what are those words you asked in question. Let's get into more details into the format.

1. Archive Type

  • It tells which source is going to be accessed.
  • The first word on each line possibly deb or deb-src, indicates the type of archive.
  • deb indicates that archive contains binary packages (deb), the pre-compiled packages that we normally use.
  • deb-src indicates source packages, which are the original program sources plus the Debian control files (.dsc) and the diff.gz containing the changes needed for packaging the program.
  • Format, syntax and names of the options vary between one-line-style and deb822-style formats as described above, but they both have the same options available.

2. Repository URL or URI Specification

Its simply a URL/URI to the source repository from where you want to get the packages. You can specify type for the URL/URI that can be anyone from the currently recognized URIs that are :

http | https | file | cdrom | ftp | copy | rsh,ssh 

You can add more recognizable URI types, If you want.

3. Suite

A suite refers to combination of two attributes of distribution that are :

  1. Release Code Name

    An alias given to every release of OS. Every OS has got a Code Name & you already now that How to get distribution's full code name ?

  2. Release Class

    Defines the development phase of a package that can be one or the combination of the following :

    stable testing unstable
    

4. Components

Components tell that whether package is :

  • Free (As defined in context of free software) or Non-Free,
  • Independent ( as in main ) or have dependencies somewhere else ( as in contrib ).
  • whether they comply with DFSG or not.
  • Also tell the Repository Sections that can be main or restricted or universe or multiverse.

5. Options

The EDIT part in your question refers to what is called as options. And as the name says, they are optional but when used, they modify the source entry to fetch a particular kind of packages. They can define :

  • Architecture for which packages are to be fetched. As in options in the source entry you quote in Edit part :

    "[arch=amd64]"
    
  • specific Language

  • Trust level of sources
  • Pdiff values
  • and many others.

The Syntax (Revised) :

  • One-line-style format

    [archive-type] [ option1=value1,option2=value2 ] URI suite [component1] [component2] [...]
    
  • deb822-style format

    Types: deb deb-src
    URIs: uri
    Suites: suite
    Components: [component1] [component2] [...]
    option1: value1
    option2: value2
    

Some Useful Links.

  1. Example lines in sources.list file

  2. How do I remove a malformed line in my sources.list

Feel free to add-in more details.