I think it would be really useful (and cool) to be able to get all the source code for my current Ubuntu installation. I mean everything, every last package from the kernel all the way up to user interface details.

(One situation where this would be useful is when there is some kind of error message that I don't understand what it means and don't know exactly where it came from, like the infamous "system program problem detected" popup. I don't know which package is responsible for presenting that. If I had all the source code I could simply search for the error message string to find the relevant part of the code. That could help me understand what happened and possibly modify the code slightly to add more details in the error message, or whatever, and rebuild that package.)

Assuming that I installed everything using apt, I can get the source code for any individual package x using apt-get source x so I guess it should be possible to write a script that first gets a list of the names of all currently installed packages, and then use a loop to get the source code using apt-get source for each package one by one. My question is: is there a more convenient way of getting all source code for all software I currently have installed, perhaps using a single command?

  • 2
    I don't think you realize how big the source code would be. You can install debian from a single dvd; but if you grab the version with source code it's a stack of dvd's (14 I think for one version squashed). lubuntu-default-settings package size is 21.9KB (18.04), but the source code is 4.9MB on disk (18.04), and that's not touching the number of files that package contains...
    – guiverc
    Oct 12, 2019 at 6:42
  • This seems like a very simple scripting exercise, so I'm not sure what you mean by "more convenient"
    – user535733
    Oct 12, 2019 at 16:05

1 Answer 1


As guiverc, the complete source code will be huge to handle its storage.

(You need to build an infrastructure, why there few sites to index free code and for each distribution a site to build/remaster packages and CD/DVD installation images ...)

I would suggest a different approach:

  • Download the -dbg/dbgsyms packages for compiled tools. See What are -dbg packages for?
  • For script tools, no need, the source is already in your hand.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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