0

So far, it seems that the best way to install packages without losing your head on Linux is to use apt-get install <package>. This is because the command pulls all dependencies along with it. If I choose to stick with dpkg --install <package> for installing packages on my machine, which means I probably downloaded the package – how can I ensure that I do not miss any dependent packages?

For things like libelf-dev or libelf1, are there websites that carry source disk containing these nice-to-haves, and in fact carry bundled modules to make updates easier? Again, so I don't miss the packages that libelf needs, like make, etc.

4
  • Use libelf from Debian repositories also! There's no need to compile it manually. Jun 25 '18 at 23:10
  • 3
    And why exactly using apt-get install is not good enough? What do you gain by doing all the dependencies resolving by hand and using dpkg? Jun 25 '18 at 23:15
  • @PatrickMevzek what happens with purely using apt-get install at times is somethings will break. Most notably as Ubuntu 14.04LTS and python2 were going out of support, I for example found myself missing things like pip when they were previously available. This is easy to understand, but in the past I have had the apt-get install break for no reason (probably I started something with dpkg and it clogged the pipeline) which I personally think that you are correctly alluding to - this should be a winning command. A noob on dpkg should present more errors (the problem).
    – Phume
    Apr 20 '20 at 7:20
  • Over experience I have found that apt-get automatically presents solutions such as apt-get -f install, which it suggests after package breaks. Thanks though.
    – Phume
    Apr 20 '20 at 7:20
2

You always need to satisfy the dependencies, that is why they are called like that.

That said, the best method of installing a downloaded .deb package IMHO is:

sudo apt-get install ./some_package_name_in_current_directory.deb

Of course, you can always go the other way around like so:

sudo dpkg --install ./some_package_name_in_current_directory.deb
sudo apt-get install --fix-missing

But I find it cumbersome.

3
  • you are right, if you follow my logic when you try to install some packages, say you download them manually at some url you get the initial file that you think that you need. But, when you read the rest of what I mean here by dependencies... on that website termed "requires"/requirements-to-run the intended package. You can find that you at times even enter into a seemingly endless loop to find the rest of the modules that your targeted module needs to work! The question is how do I force either dpkg or apt-get to do the work for me!?
    – Phume
    Apr 20 '20 at 7:22
  • Over experience, it would seem as though apt-get does not work as you suggested. But dpkg does, and is the main source of the problem. If you are lucky, you can read through the error messages until you get it right. But the question is can I do it more seamlessly so as I don't miss a thing? On a good day, apt-get should the work for you. But at times, I start out with dpkg and try to force apt-get to finish the work for me as it could be a file that is still carried in the ubuntu source repos. I must have asked the question before I fully understood what was happening as well.
    – Phume
    Apr 20 '20 at 7:23
  • ... apt-get does not work that way "./install.deb". Only dpkg does.
    – Phume
    Apr 20 '20 at 7:26
0

IIRC if you have a .deb file with dependencies that can be met from your configured repos, you can install it with dpkg -i package.deb and then do an apt-get -f install and apt will bring in anything that your package needed... but ONLY if appropriate version numbers, etc. all exist and match.

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.