Check dependencies and generate download script before installing by dpkg

10,689

Solution 1

You can always try a dry run before the install,

dpkg --dry-run -i *.deb

Solution 2

You can get a list of the packages dependencies with:

find *deb -exec dpkg -f {} Depends \;

Solution 3

You can also try one of these

 dpkg -I package
 apt-cache rdepends package.deb
 apt-cache showpkg package-name

this one is a combination of steps incase it's just a .deb file

 ar -x <package-name>.deb
 tar -xzf control.tar.gz
 grep Depends control

or

 apt-cache depends package-name

for example

 apt-cache depends mplayer

but i think the last option is what might serve you best

Share:
10,689

Related videos on Youtube

Pandya
Author by

Pandya

Started using Linux and StackExchange since Ubuntu 12.04 LTS. Then Upgraded to 14.04 LTS. Now I am using Debian GNU/Linux on my Laptop and PureOS on old Desktop computer. I recommend visiting the Philosophy of GNU Project As I've replaced Ubuntu with Debian GNU/Linux, Now my question(s) are became off-topic on AskUbuntu. So, I continue to Unix &amp; Linux. The second reason for my shifting to U &amp; L is I found U &amp; L more interesting than AU since AU is only Ubuntu specific whereas U &amp; L is a broad concept and in my opinion U &amp; L deserves generic questions. (I know why SE has AU &amp; U &amp; L both).

Updated on September 18, 2022

Comments

  • Pandya
    Pandya over 1 year

    I used to install packages with dpkg -i *.deb command for off-line installation. Because all deb files are in one folder.

    I want to avoid dependency error and stop installing packages as broken.

    Ultimately my aim is to check dependencies and generate download script (if all dependencies are not satisfied) for only those package which is missing in mentioned folder. so-that I can first download missing packages and Then confidently install package by dpkg -i *.deb

    apt-cache showpkg $(find -iname '*.deb' -exec dpkg --info '{}' \; | awk '/Package:/ {print $2}') shows dependencies but long list and not helpful to check whethter it is satisfied (exist) in mentioned folder or not. Also dpkg -I *.deb errors following:

       dpkg-deb: 'cabextract_1.4-4_i386.deb' contains no control component 'chromium-codecs-ffmpeg-extra_34.0.1847.116-0ubuntu2_i386.deb'
       dpkg-deb: 'cabextract_1.4-4_i386.deb' contains no control component 'flashplugin-installer_11.2.202.350ubuntu1_i386.deb'
    ..
    ..
    so on for each deb
    

    Hence, That commands are not useful for me.

    Further Clarification:

    1. First check all deb dependencies in my folder.
    2. according to package already installed, check this deb's are able to installed without dependency error or not.
    3. if yes then execute dpkg -i *.deb
    4. else list missing package which not fond installed or in mentioned folder

    Thanks.

    • guntbert
      guntbert about 10 years
      Do I understand correctly that you expect to get a complete script from us? Why don't you use the results and write it yourself?
    • Pandya
      Pandya over 9 years
      This question is no longer supported from my side because now I am using Local repository method to install debs offline (as APT is standard method)