Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

Thanks in advance!

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

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.

share|improve this answer
    
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 '12 at 19:14
add comment

apt-get source rhythmbox only works if you have the source repositories (dpkg) turned on, 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.

share|improve this answer
    
Thank you for your answer! It turned out that I was using the wrong server. –  Muurverf Nov 26 '12 at 19:15
add comment

Your Answer

 
discard

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.