Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Ubuntu 10.04, when I goto System > Administration > Software Sources and goto the Authentication tab, I can view all of my keys allowing me to download from third party sources.

How would I back this up to copy all of my sources and keys to a new system?

share|improve this question
up vote 8 down vote accepted

The method to backup your sources list has already been described by garbagecollector (also note the additional directory as explained by Javier Rivera).

To backup the trusted keys added to your system you can use the apt-key command line program. I don't know if there is a way to do this from the GUI.

From a terminal you can run something like this:

sudo apt-key exportall > ~/repositories.key

Then on your other system you should be able to import that key file from Software Sources or you can use apt-key again:

sudo apt-key add /path/to/repositories.key

I only have one Ubuntu desktop system so I haven't tested this out, but I think it should work.

share|improve this answer

From 10.04 the source list can be in different places, the file /etc/apt/sources.list as said before and all the files inside /etc/apt/sources.list.d/.

The keys are stored in a similar fashion, the file /etc/apt/trusted.gpg and the files inside /etc/apt/trusted.gpg.d/

Finally you will need the info in trustdb.gpg to be able to decrypt the keys.

You will need to copy all these files and dirs.

Edit: The best way to copy the keys is explained in another answer. So please copy only sources.list and all the files inside sources.list.d. I keep the info about the files placement in the case it proves useful to another person.

share|improve this answer

I believe this would help backing up your sources.

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

Then do the reverse when you are your new system.

Maybe also try this software. Although I haven't used it myself.

share|improve this answer
I have tried backing up all of my sources lists but I get this error for each source I have: W: GPG error: lucid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FC918B335044912E – RyanScottLewis Aug 12 '10 at 14:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.