[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: experimenting with dpkg: installing on a different system





Le 20.06.2014 18:43, Sven Joachim a écrit :
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.

Indeed. But I do this on my spare time, without any constraint or order from anyone, and since I consider this for pleasure, using debootstrap would be a little like using a cheat. Of course, I know that I risk to generate noise here with that, but I think I was clear enough: I want fun and learn, not especially something which works out of the box.

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.

Now you mention it, it's true that dpkg's man says it uses a chroot. And indeed since the new root does not have anything, it can't run a script... did not thought about that.

* 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.

I did not read the debootstrap script enough to notice those tools.


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.

As I said, it's mostly for playing and fun. I understand why debootstrap was made (automated things which are painful otherwise). Trying to reinvent the wheel, or to be more precise, to reproduce it's behavior in my case, is not a good thing and I do not do it: at work. But for learning and understanding, it is a nice way imho. And I take some fun when tinkering around egg and chicken problems.


Cheers,
       Sven

Thanks for your reply.


Reply to: