Difference between revisions of "Dpkg"

From Linuxintro
imported>ChrisM
imported>ThorstenStaerk
m (Reverted edits by 188.143.232.32 (talk) to last revision by ThorstenStaerk)
 
(24 intermediate revisions by 5 users not shown)
Line 1: Line 1:
If you understand rpm or dpkg and want to learn the other
+
dpkg is [[Debian]]'s default packaging software. However you will normally use apt-get to install Debian software.
 +
Here are package management issues and how you achieve them using dpkg or rpm.
  
 +
__TOC__
 +
 +
= Overview =
 
{| border=1
 
{| border=1
 
! Issue
 
! Issue
Line 10: Line 14:
 
| list all installed packages || rpm -qa || dpkg -l  
 
| list all installed packages || rpm -qa || dpkg -l  
 
|-
 
|-
| list all installed packages by order of installation date || rpm -qa --last || ||
+
| list all installed packages by order of installation date || rpm -qa --last ||
 
|-
 
|-
 
| install a package from a file || rpm -i ''file.rpm'' || dpkg -i ''file.deb''
 
| install a package from a file || rpm -i ''file.rpm'' || dpkg -i ''file.deb''
Line 18: Line 22:
 
| find what package provides the installed file ''/bin/ls'' || rpm -qf ''/bin/ls'' || dpkg --search ''/bin/ls''  
 
| find what package provides the installed file ''/bin/ls'' || rpm -qf ''/bin/ls'' || dpkg --search ''/bin/ls''  
 
|-
 
|-
| look at a package file description || || dpkg -I ''file.deb''
+
| look at a package file description || rpm -qpl ''file.rpm'' || dpkg -I ''file.deb''
 
|-
 
|-
 
| look at a package description || rpm -qi ''package'' || apt-cache show ''package''
 
| look at a package description || rpm -qi ''package'' || apt-cache show ''package''
Line 25: Line 29:
 
|-
 
|-
 
| find what program provides the file ''Xlib.h'' || || auto-apt search ''Xlib.h''
 
| find what program provides the file ''Xlib.h'' || || auto-apt search ''Xlib.h''
 +
|-
 +
| extract a package                              || rpm2cpio blah.rpm <nowiki>|</nowiki> cpio -id || dpkg -x datei.deb ''target_folder''
 +
|-
 +
| remove a package, but do not run pre-uninstall scripts before || rpm -e --nopreun ''xyz'' || rm /var/lib/dpkg/info/xyz.prerm; dpkg -r ''xyz''
 
|}
 
|}
 +
 +
= TroubleShooting =
 +
 +
== Unmet dependencies ==
 +
<pre>
 +
root@lvps83-169-3-117:~# apt-get install kde
 +
Reading package lists... Done
 +
Building dependency tree
 +
Reading state information... Done
 +
You might want to run `apt-get -f install' to correct these:
 +
The following packages have unmet dependencies:
 +
  kde: Depends: kde-core (>= 5:47) but it is not going to be installed
 +
      Depends: kde-amusements (>= 5:47) but it is not going to be installed
 +
      Depends: kdeaccessibility (>= 4:3.4.3) but it is not going to be installed
 +
      Depends: kdeaddons (>= 4:3.4.3) but it is not going to be installed
 +
      Depends: kdeadmin (>= 4:3.4.3) but it is not going to be installed
 +
      Depends: kdeartwork (>= 4:3.4.3) but it is not going to be installed
 +
      Depends: kdegraphics (>= 4:3.4.3) but it is not going to be installed
 +
      Depends: kdemultimedia (>= 4:3.4.3) but it is not going to be installed
 +
      Depends: kdenetwork (>= 4:3.4.3) but it is not going to be installed
 +
      Depends: kdepim (>= 4:3.4.3) but it is not going to be installed
 +
      Depends: kdeutils (>= 4:3.4.3) but it is not going to be installed
 +
      Depends: kdewebdev (>= 4:3.4.3) but it is not going to be installed
 +
  psa: Depends: libpam-plesk but it is not going to be installed
 +
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
 +
</pre>
 +
Once solution was to remove a postuninstall script, /var/lib/dpkg/info/psa-imp.postrm
 +
 +
== failed to fetch ==
 +
Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/g/gcc-4.3/g++-4.3_4.3.3-5ubuntu4_i386.deb  404 Not Found [IP: 91.189.92.171 80]
 +
Looking at http://us.archive.ubuntu.com/ubuntu/pool/main/g/gcc-4.3/ it is empty. This was the case because my Ubuntu was not supported any longer.
 +
 +
== not found ==
 +
Here is an example. Calling
 +
sudo apt-get install tcl
 +
Gave me
 +
<pre>
 +
Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/t/tcl8.4/tcl8.4_8.4.19-2_i386.deb  404 Not Found [IP: 91.189.92.171 80]
 +
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
 +
</pre>
 +
Now the commands
 +
apt-get update
 +
and
 +
apt-get install --fix-missing tcl
 +
did not help. Surfing to http://us.archive.ubuntu.com/ubuntu/pool/main/t/tcl8.4/ I found there is no tcl8.4_8.4.19-2_i386.deb only tcl8.4_8.4.19-3_i386.deb. So I got this one:
 +
wget http://us.archive.ubuntu.com/ubuntu/pool/main/t/tcl8.4/tcl8.4_8.4.19-3_i386.deb
 +
and installed it:
 +
sudo dpkg -i tcl*

Latest revision as of 07:32, 15 January 2016

dpkg is Debian's default packaging software. However you will normally use apt-get to install Debian software. Here are package management issues and how you achieve them using dpkg or rpm.

Overview

Issue rpm dpkg
how files are called *.rpm *.deb
list all installed packages rpm -qa dpkg -l
list all installed packages by order of installation date rpm -qa --last
install a package from a file rpm -i file.rpm dpkg -i file.deb
list package content rpm -ql package dpkg -L package
find what package provides the installed file /bin/ls rpm -qf /bin/ls dpkg --search /bin/ls
look at a package file description rpm -qpl file.rpm dpkg -I file.deb
look at a package description rpm -qi package apt-cache show package
find which installed package provides /bin/bash rpm -qf /bin/bash dpkg -S /bin/bash (to also search in not installed packages you can use apt-file)
find what program provides the file Xlib.h auto-apt search Xlib.h
extract a package rpm2cpio blah.rpm | cpio -id dpkg -x datei.deb target_folder
remove a package, but do not run pre-uninstall scripts before rpm -e --nopreun xyz rm /var/lib/dpkg/info/xyz.prerm; dpkg -r xyz

TroubleShooting

Unmet dependencies

root@lvps83-169-3-117:~# apt-get install kde
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run `apt-get -f install' to correct these:
The following packages have unmet dependencies:
  kde: Depends: kde-core (>= 5:47) but it is not going to be installed
       Depends: kde-amusements (>= 5:47) but it is not going to be installed
       Depends: kdeaccessibility (>= 4:3.4.3) but it is not going to be installed
       Depends: kdeaddons (>= 4:3.4.3) but it is not going to be installed
       Depends: kdeadmin (>= 4:3.4.3) but it is not going to be installed
       Depends: kdeartwork (>= 4:3.4.3) but it is not going to be installed
       Depends: kdegraphics (>= 4:3.4.3) but it is not going to be installed
       Depends: kdemultimedia (>= 4:3.4.3) but it is not going to be installed
       Depends: kdenetwork (>= 4:3.4.3) but it is not going to be installed
       Depends: kdepim (>= 4:3.4.3) but it is not going to be installed
       Depends: kdeutils (>= 4:3.4.3) but it is not going to be installed
       Depends: kdewebdev (>= 4:3.4.3) but it is not going to be installed
  psa: Depends: libpam-plesk but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Once solution was to remove a postuninstall script, /var/lib/dpkg/info/psa-imp.postrm

failed to fetch

Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/g/gcc-4.3/g++-4.3_4.3.3-5ubuntu4_i386.deb  404 Not Found [IP: 91.189.92.171 80]

Looking at http://us.archive.ubuntu.com/ubuntu/pool/main/g/gcc-4.3/ it is empty. This was the case because my Ubuntu was not supported any longer.

not found

Here is an example. Calling

sudo apt-get install tcl

Gave me

Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/t/tcl8.4/tcl8.4_8.4.19-2_i386.deb  404 Not Found [IP: 91.189.92.171 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Now the commands

apt-get update

and

apt-get install --fix-missing tcl

did not help. Surfing to http://us.archive.ubuntu.com/ubuntu/pool/main/t/tcl8.4/ I found there is no tcl8.4_8.4.19-2_i386.deb only tcl8.4_8.4.19-3_i386.deb. So I got this one:

wget http://us.archive.ubuntu.com/ubuntu/pool/main/t/tcl8.4/tcl8.4_8.4.19-3_i386.deb 

and installed it:

sudo dpkg -i tcl*