Debian

sktsee sktsee at tulsaconnect.com
Thu Sep 20 14:51:39 UTC 2007


On Thu, 2007-09-20 at 09:32 -0300, Derek Broughton wrote:
> sktsee wrote:
> 
> > On Wed, 2007-09-19 at 19:30 +0100, Liam Proven wrote:
> >> On 17/09/2007, Mihamina (R12y) Rakotomandimby
> >> <mihamina.rakotomandimby at etu.univ-orleans.fr> wrote:
> 
> >> > Nope. apt cant be used without dpkg.
> >> 
> >> Yes, it can.
> > 
> > Hmmm...
> > 
> > $ mv /usr/bin/dpkg /usr/bin/dpkg.bak
> > $ sudo apt-get remove libdvdplay0
> > Reading package lists... Done
> > Building dependency tree
> > Reading state information... Done
> > The following packages will be REMOVED:
> >   libdvdplay0
> > 0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded. Need to
> > get
> > 0B of archives.
> > After unpacking 119kB disk space will be freed. Do you want to continue
> > [Y/n]? y
> > Could not exec dpkg!
> > E: Sub-process /usr/bin/dpkg returned an error code (100)
> > 
> > I don't think so.
> 
> You're making the same error Mihamina made.  apt is not apt-get.  apt is a
> whole family of tools, most (all?) of which use libapt.  Some of those
> tools do not directly or indirectly invoke dpkg.
> -- 
> derek
> 
> 

Any tool that actually manipulates (updates, installs, removes, etc.)
the the Debian package database ultimately execs dpkg (dpkg being the
suite of low level tools used for Debian package management) to do the
grunt work. A tool that doesn't use dpkg like apt-cache, simply reads
the package database directly.

You are correct that most of the high level tools like aptitude link
to /usr/lib/libapt-pkg-libc6.4-6.so.3.53.0 library. However if you do a
strace on a command like the following, you'll see the exec calls to
dpkg to carry out the actual installation of the package:

$ sudo strace -f -q -e trace=process -o tracer.txt aptitude install
libdvdnav4
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Reading extended state information       
Initializing package states... Done
Building tag database... Done      
The following NEW packages will be installed:
  libdvdnav4 
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/92.1kB of archives. After unpacking 295kB will be used.
Writing extended state information... Done
Selecting previously deselected package libdvdnav4.
(Reading database ... 118656 files and directories currently installed.)
Unpacking libdvdnav4 (from .../libdvdnav4_0.1.10-0.1_i386.deb) ...
Setting up libdvdnav4 (0.1.10-0.1) .

$ grep -v ENOENT tracer.txt |grep bin/dpkg"
8214  execve("/bin/sh", ["/bin/sh", "-c", "/usr/sbin/dpkg-preconfigure
--ap"...], [/* 36 vars */]) = 0
8215  execve("/usr/sbin/dpkg-preconfigure",
["/usr/sbin/dpkg-preconfigure", "--apt"], [/* 36 vars */]) = 0
8224  execve("/usr/bin/dpkg", ["/usr/bin/dpkg", "--status-fd", "19",
"--unpack", "--auto-deconfigure",
"/var/cache/apt/archives/libdvdna"...], [/* 37 vars */]) = 0
8226  execve("/usr/bin/dpkg-split", ["dpkg-split", "-Qao",
"/var/lib/dpkg/reassemble.deb", "/var/cache/apt/archives/libdvdna"...],
[/* 37 vars */] <unfinished ...>
8229  execve("/usr/bin/dpkg-deb", ["dpkg-deb", "--control",
"/var/cache/apt/archives/libdvdna"..., "/var/lib/dpkg/tmp.ci"], [/* 37
vars */] <unfinished ...>
8233  execve("/usr/bin/dpkg-deb", ["dpkg-deb", "--fsys-tarfile",
"/var/cache/apt/archives/libdvdna"...], [/* 37 vars */]) = 0
8237  execve("/usr/bin/dpkg", ["/usr/bin/dpkg", "--status-fd", "19",
"--configure", "libdvdnav4"], [/* 37 vars */]) = 0

And, in fact doing a simple text search through libapt-pkg-libc6 shows
that reference to dpkg is hardcoded into the library.
$ strings /usr/lib/libapt-pkg-libc6.4-6.so.3.53 |grep "dpkg"
got a overlong line from dpkg: '%s'
Dir::Bin::dpkg
Could not exec dpkg!
got from dpkg '
(parsed from dpkg) pkg: 
Debian dpkg interface
/var/lib/dpkg/status
/usr/bin/dpkg
dpkg was interrupted, you must manually run 'dpkg --configure -a' to
correct the problem. 
Debian dpkg status file

-- 
sktsee





More information about the ubuntu-users mailing list