How do you tell apt to use files in /etc/apt/sources.list.d

I added a repo by putting a file in

 /etc/apt/sources.list.d 

and then i did an

 apt-get update.  

However it didn't do anything with that repo. I then noticed that it didn't appear to be including any of the repos in that directory. Only stuff in /etc/apt/sources.list seem to be noticed by apt-get. All the files in the directory end in .list and contain something like:

 virtualbox.list

      deb http://download.virtualbox.org/virtualbox/debian oneiric contrib

 pj-assis-ppa-oneiric.list

      deb http://ppa.launchpad.net/pj-assis/ppa/ubuntu oneiric main
      deb-src http://ppa.launchpad.net/pj-assis/ppa/ubuntu oneiric main

Do I need to put some sort of include statement in /etc/apt/sources.list?

I'm using kubuntu 11.10.


The names of files in /etc/sources.list.d must end in .list, if they are to be included as software sources.

As the man page of sources.list says:

DESCRIPTION

   The package resource list is used to locate archives of the package
   distribution system in use on the system. At this time, this manual
   page documents only the packaging system used by the Debian GNU/Linux
   system. This control file is /etc/apt/sources.list.

   The source list is designed to support any number of active sources and
   a variety of source media. The file lists one source per line, with the
   most preferred source listed first. The format of each line is: type
   uri args The first item, type determines the format for args.  uri is a
   Universal Resource Identifier (URI), which is a superset of the more
   specific and well-known Universal Resource Locator, or URL. The rest of
   the line can be marked as a comment by using a #.

SOURCES.LIST.D

   The /etc/apt/sources.list.d directory provides a way to add
   sources.list entries in separate files. The format is the same as for
   the regular sources.list file. File names need to end with .list and
   may only contain letters (a-z and A-Z), digits (0-9), underscore (_),
   hyphen (-) and period (.) characters. Otherwise APT will print a notice
   that it has ignored a file if the file doesn't match a pattern in the
   Dir::Ignore-Files-Silently configuration list - in this case it will be
   silently ignored.

Taking an example from this page, suppose you wanted to install chef (from opscode), what you'd do is:

  • Create and open a file named opscode.list:
    sudo vim /etc/apt/sources.list.d/opscode.list
  • Add the required line and save the file:
    deb http://apt.opscode.com/ oneiric main

The above steps can be combined to make a single command:

sudo /bin/sh -c 'echo "deb http://apt.opscode.com/ onereic main" > /etc/apt/sources.list.d/opscode.list'

Note: The command contains onereic because the codename of the Ubuntu you're using is Onereic. Had you been using Precise (12.04), you'd have writter precise.


So the problem seemed to be that I had a package installed from one of the normal apt repos and I wanted it to update with a version from one of the new repos. Apparently this is not possible. I had to uninstall the packages in question and then install with all of the normal repos commented out. I'm still not sure why when you do an apt-get update, that none of these new repos have their urls displayed.