Re: experimenting with dpkg: installing on a different system
On 2014-06-20 17:42 +0200, berenger.morel@neutralite.org wrote:
> First, a warning: I am basically trying to reinvent a wheel, only for
> my pleasure and knowledge.
Good luck. As you had already noticed, this wheel is going to have some
rough corners, and just using debootstrap is much easier.
> Yesterday, I was experimenting with dpkg ( for my own fun, and to
> learn things ), especially with the parameter "--root" which change
> the targeted system. Or, to be more exact, to change the directories
> where it tries to retrieve it's own informations ( /var/lib/dpkg ) and
> where it tries to deploy stuff ( / ).
You can do this, but the directory you pass as "--root" argument better
have some standard utilities on it, since dpkg requires them.
> * dpkg depends on various packages ( on my testing current system ),
> namely: libc6, tar, libselinux1, liblzma5, libbz2-1.0, zlib1g.
It also needs some programs from essential packages on which it does not
explicitly depend. And the maintainer scripts will use those as well.
> When it comes to libc6, dpkg report an error of being unable to find
> various scripts, like IIRC "/var/lib/dpkg/tmp.ci/preinst" ( in the
> chrooted environment, so /mnt/var/lib/dpkg/tmp.ci/preinst ).
This could be because the interpreter for those scripts, typically
/bin/sh, is missing. Note that the exec(3) family of functions return
ENOENT in that case which often confuses users.
Besides a shell for the maintainer scripts, dpkg needs some utilities
like rm(1) for proper operation. It checks for those at startup, but
that does not work with the "--root" option.
Maybe this gives you some idea why debootstrap has been invented in the
first place.
Cheers,
Sven
Reply to: