9

I'm trying to download source code of certain packages, for example rhythmbox, for learning purposes. I want to do this through apt-get, with the apt-get source command.

For some reason, apt-get can't seem to find any package. I've tried several packages, and I keep getting this output from apt-get:

$ apt-get source rhythmbox
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to find a source package for rhythmbox

I've been searching for answers for quite some time now, but I can't find anyone with the same issue. apt-get works fine with installing and updating so apt-get works fine in my opinion. During the search I also learned that I had to enable the 'source code repositories' in Software Sources, so that's also enabled.

I am aware of the fact that (maybe only for certain packages, not sure) source packages can also be downloaded with bzr from Launchpad, but I want to know why this method won't work.

1

2 Answers 2

7

Open the Software Center and choose Edit -> Software Sources. Which server do you use? I'm using "Server and United States" and just downloaded the source for rhythmbox just fine. I'm on Precise.

3
  • Thank you for your answer! I turned out that I was using the wrong server. I was using the server from The Netherlands. Switched to USA and now it works! :) Thank you very much!
    – Muurverf
    Nov 26, 2012 at 19:14
  • i havent tried it yet... BTW where is the source code stored on the machine... or it appears in the directory from where you have run the command? Feb 1, 2016 at 15:43
  • In the directory where you run command as I vaguely recall.
    – GaryBishop
    Feb 1, 2016 at 20:26
7

apt-get source rhythmbox only works if you have the source repositories turned on, updated your package list, AND you actually have that repository in your sources.

If, for example, you installed a normal Ubuntu install and didn't add any apt repos. Then all you need to do is make sure "Source code" has a check by it. If you added extra repos, then you need to have two entries for each repo. One for "main" (usually) and one for "source".

Also just in case you haven't. Run apt-get update again to get all the new repos.

Now apt-get source installs source for the exact package you installed. This means that ifyou installed the deb from some-odd-ppa (main) then the source needs to be in some-odd-ppa(source). Packages installed from some-odd-ppa will not pull source from other repositories because it's not the same version.

I have checked and rhythmbox is available via source repositories. You simply haven't included the right source repository in your apt repos, or you haven't run apt-get update yet.

1
  • Thank you for your answer! It turned out that I was using the wrong server.
    – Muurverf
    Nov 26, 2012 at 19:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .