0

I'm trying to install packages with having as little files from their dependencies as possible, since system size is important to me.

For example, when wanting to install a package, I could install it with apt-get install on another system and then systematically go through apt-cache depends (shows all packages it depends on) for it and all it's dependencies until I have a (sizable) list of packages.

Then I would go through that list with dpkg -L (shows all installed files by the package) to get a (gigantic) list of files that I would need to copy to my system to make the original package work.

I did this with the python package and got lucky after only a handful of tries. Other packages seem to be more complicated sadly.

There must surely be a better way to find a minimal set of files, that is really necessary to successfully install the package. Some obviously useless candidates are /usr/share/man/*, /usr/share/doc/* etc.

Is there a way to find out, which particular file from a dependency is necessary? (e.g. only one library file from a whole collection)

Are there other ways to get the minimal set of files, other than picking some out and trying if it still works?

Is my approach to gathering the necessary files the correct one?


Also: Would compiling from source be an option? I'm still completely unfamiliar with this practice and will look that up next.

EDIT: I'm using XUbuntu 14.04.

  • I get that you're using a debian derivative, but which distribution exactly? package management is where they might differ – Sebastian Oct 29 '14 at 14:36
3

I think that removing individual files is a wrong approach. You will never be sure about what you are potentially breaking.

Maybe you remove file A and test functionality F1 from package B, and all seems to work. But that just might be because F1 did not require A. One week after you try to use functionality F2 and it fails miserably because it requires file A, but it will be very difficult to diagnose or troubleshoot.

In theory, the packagers already try to minimize dependencies and files.

On the other hand, compiling the software yourself might be a better approach. Many packages will offer you the possibility to create static versions (not depending on external libraries) and then you can obtain some smaller footprint.

Even with this method, each case will be different. It is also quite time consuming.

My advice would be to use tools like deborphan (or the equivalent on your distro). That will list packages with no dependencies, that can be removed safely. It is an iterative process because with each removal you might find more packages that are now safe to remove.

Try deborphan -a also, that will list all the candidates, not only libraries and dependencies.

  • deborphan seems helpful. I'll go through the man page. Thanks for answering, @Luis. – Minix Oct 29 '14 at 15:12

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.