1

I accidentally deleted the sources.list file from my Ubuntu VM running on a Google Compute Engine instance.

As Amazon Web Services, they also have their own optimized sources.list. I need an original unmodified one, please.

UPDATE: According to Giacomo1968’s answer, there should be a backup of the sources.list in the /etc/apt/ named sources.list.save but I checked couldn’t find that file in my install:

$ ls -la
total 64 
drwxr-xr-x 6 root root 4096 Sep 17 21:06 .
drwxr-xr-x 100 root root 4096 Sep 17 21:22 ..
drwxr-xr-x 2 root root 4096 Sep 9 06:54 apt.conf.d
drwxr-xr-x 2 root root 4096 Apr 7 14:44 preferences.d
-rw-r--r-- 1 root root 592 Sep 17 21:20 sources.list
drwxr-xr-x 2 root root 4096 Sep 2 07:40 sources.list.d
-rw-r--r-- 1 root root 17481 Sep 17 21:06 trusted.gpg
-rw-r--r-- 1 root root 12335 Sep 2 07:17 trusted.gpg~
drwxr-xr-x 2 root root 4096 Apr 7 14:44 trusted.gpg.d
Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
Bruno Finger
  • 322
  • 2
  • 6
  • 21

2 Answers2

2
## 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 http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us-central1.gce.archive.ubuntu.com/ubuntu/ vivid main
deb-src http://us-central1.gce.archive.ubuntu.com/ubuntu/ vivid main

## Major bug fix updates produced after the final release of the
## distribution.
deb http://us-central1.gce.archive.ubuntu.com/ubuntu/ vivid-updates main
deb-src http://us-central1.gce.archive.ubuntu.com/ubuntu/ vivid-updates main

## 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 http://us-central1.gce.archive.ubuntu.com/ubuntu/ vivid universe
deb-src http://us-central1.gce.archive.ubuntu.com/ubuntu/ vivid universe
deb http://us-central1.gce.archive.ubuntu.com/ubuntu/ vivid-updates universe
deb-src http://us-central1.gce.archive.ubuntu.com/ubuntu/ vivid-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
# deb http://us-central1.gce.archive.ubuntu.com/ubuntu/ vivid multiverse
# deb-src http://us-central1.gce.archive.ubuntu.com/ubuntu/ vivid multiverse
# deb http://us-central1.gce.archive.ubuntu.com/ubuntu/ vivid-updates multiverse
# deb-src http://us-central1.gce.archive.ubuntu.com/ubuntu/ vivid-updates multiverse

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://us-central1.gce.archive.ubuntu.com/ubuntu/ vivid-backports main restricted universe multiverse
# deb-src http://us-central1.gce.archive.ubuntu.com/ubuntu/ vivid-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu vivid partner
# deb-src http://archive.canonical.com/ubuntu vivid partner

deb http://security.ubuntu.com/ubuntu vivid-security main
deb-src http://security.ubuntu.com/ubuntu vivid-security main
deb http://security.ubuntu.com/ubuntu vivid-security universe
deb-src http://security.ubuntu.com/ubuntu vivid-security universe
# deb http://security.ubuntu.com/ubuntu vivid-security multiverse
# deb-src http://security.ubuntu.com/ubuntu vivid-security multiverse
chrispomeroy
  • 256
  • 1
  • 4
0

No need to build a whole Ubuntu setup just to get a clean copy of the sources.list. Just look in the /etc/apt/ directory:

ls -la /etc/apt/

There should be a sources.list.save in that directory that is basically a simple side-by-side backup of the original sources.list on your system. Of course any modifications/tweaks you might have made to it are gone. But hey! It’s better than nothing. Just copy the file into place like this:

sudo cp /etc/apt/sources.list.save /etc/apt/sources.list

And you should be good to go.

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
  • Unfortunately I couldn't find any `sources.list.save` in my `/etc/apt` directory. `$ ls -la total 64 drwxr-xr-x 6 root root 4096 Sep 17 21:06 . drwxr-xr-x 100 root root 4096 Sep 17 21:22 .. drwxr-xr-x 2 root root 4096 Sep 9 06:54 apt.conf.d drwxr-xr-x 2 root root 4096 Apr 7 14:44 preferences.d -rw-r--r-- 1 root root 592 Sep 17 21:20 sources.list drwxr-xr-x 2 root root 4096 Sep 2 07:40 sources.list.d -rw-r--r-- 1 root root 17481 Sep 17 21:06 trusted.gpg -rw-r--r-- 1 root root 12335 Sep 2 07:17 trusted.gpg~ drwxr-xr-x 2 root root 4096 Apr 7 14:44 trusted.gpg.d ` – Bruno Finger Sep 23 '15 at 20:27
  • @BrunoFinger Sorry to hear about this. But for future reference, please don't copy and paste huge blocks of formatted text like this into a comment. You might want to add that to your question as a reference to what you have checked but as a comment it's unreadable. – Giacomo1968 Sep 23 '15 at 20:36
  • 1
    You're right, a better approach would be to add it to the question instead. I didn't think about at the moment. – Bruno Finger Sep 23 '15 at 20:39
  • @BrunoFinger All good. I went ahead and added it to your question for you. So feel free to edit my wording if you wish. I think this is good info to share. – Giacomo1968 Sep 23 '15 at 23:40