On Fri, Jun 20, 2014 at 11:42 AM, <berenger.mo...@neutralite.org> wrote: > > First, a warning: I am basically trying to reinvent a wheel, only for my > pleasure and knowledge. So, yes, there are easier ways to do the things. > > 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 ( / ). > > Note that I did not tried debootstrap(*). > > What I tried to do was basically to "replace" the debian installer: > > On an external hard disk: > > Basic setup: > * using gparted to partition and format according to my wishes ( a portable > system able to boot from kali live-cd, tail live-cd, an installed Debian > testing, a partition dedicated to experimenting another linux-based distro, > and a partition to boot a BSD kernel based system. Yes, probably > Debian/kFreeBSD in a first time, since I have some knowledge about how > Debian works, so that I would not start from void. Of course, other utility > partition for /home, /tmp and /share for windows interaction, can be useful. > Something odd and stupid enough to allow me to lose a lot of time in > tinkering :p ) > * mounted the future "/" partition on "/mnt" > * created the basic filesystem, mirroring what I have on my working system ( > /root, /mnt, /boot, /var, /etc, et cetera ) > * mounted partitions on their mount points > > Some tinkering: > * created the dpkg's var tree: "cd /mnt; mkdir -p /var/lib/dpkg; touch > /var/lib/dpkg/available; /var/lib/dpkg/status" > * made an alias for dpkg so that I would not do an error: "alias dpkg=dpkg > --root=/mnt" > > Identifying the first set of packages to install so that things would be > configured by standard dpkg's methodology: > * I want dpkg to be correctly configured, not only a hand-made tree, so it > is my first target. > * dpkg depends on various packages ( on my testing current system ), namely: > libc6, tar, libselinux1, liblzma5, libbz2-1.0, zlib1g. From those ones, I > know that the one which will be need by almost all packages is libc6, so > let's identify which packages it needs. > * libc6's dependencies: libgcc1, which depends on libc6, gcc-4.9-base ( > which depends on nothing, nice! ) but most importantly, pre-depends on > multiarch-support ( which depends itself on libc6 ). > > Trying to install the first set of ( 4 ) packages through dpkg: > * dpkg --root /mnt -i /var/cache/apt/archives/libc6_*.deb > /var/cache/apt/archives/gcc-4.9-base_*.deb > /var/cache/apt/archives/libgcc1_*.deb > /var/cache/apt/archives/multiarch-support_*.deb > > 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 ). > I have tried to fool dpkg by creating those files, making them empty and > executable, the error is the same, so my guess is that dpkg really can find > them ( since it can delete them ). Maybe a right problem? I did not at the > moment tried to set the rights to 777 on /var/lib/dpkg. > Setting to maximum the debugging options of dpkg did not helped at all, too > ( almost no informations ) and same when I tried the --force-all option. I > still did not tried to just copy stuff, which could work since I believe > that it's what debootstrap does (not checked in source code, programming in > bash is still very obscure for me. I might try to take a look at > cdebootstrap thought, since it is written in C which is far more readable > for me). > > Any idea of tricks I might try or stuff I might read? In dpkg's man, it is > said that package's managers which want to understand how dpkg install their > packages should not refer to this man, so I guess it would be a good start > to know where is stored the recommended doc for them. I'm not a package > maintainer, but it sounds obvious that for this small game of mine, I need a > real knowledge of dpkg. > > *: I do not use debootstrap, but I perfectly know that it is made to install > from a running GNU/Linux distro. > I "just" want to experiment, after all, for learning. And I think that it > might have some issues with my intent: > * should I use debootstrap or cdebootstrap? > * It seems it is possible to specify various list of packages to installs, > but can I tweak them? Each time I install from a strictly minimal scratch, I > spend some times to remove packages that I know I will not need, and to set > many, many other as automatically installed. ( and only after that, I am > adding packages which are really useful to me, so that I can have "really" > minimal systems ) > * it seems it needs the user to chroot after the bootstrap, which means the > user have to be root. I do not see why it should be mandatory to be root ( > with all problems it might cause ) to install a distro on an external drive. > > How to specify which packages to install -- since I always remove a lot of > packages after a strictly minimal Debian installation... which is made from > debootstrap if I have understood correctly the few source lines of this > script I have read -- ? And how could it be possible to do a remote install? > How can it be used without being root? And I think those things might be > avoided with dpkg. Except that... I had some issues I did not understood, of > course.
It's too bad that apt-get doesn't have the equivalent of yum's "--installroot" because you wouldn't have to download and feed dpkg debs and their dependencies. Since Debian has debootstrap, an apt "--installroot" option isn't really necessary. The debootstrap "--variant=minbase" option installs the following: # debootstrap --arch=amd64 --print-debs --variant=minbase sid /home/minbase http://ftp.uk.debian.org/debian/ W: Cannot check Release signature; keyring file not available /usr/share/keyrings/debian-archive-keyring.gpg I: Retrieving Release I: Retrieving Packages I: Validating Packages I: Resolving dependencies of required packages... I: Resolving dependencies of base packages... I: Found additional required dependencies: insserv libaudit-common libaudit1 libbz2-1.0 libcap2 libdb5.3 libdebconfclient0 libsemanage-common libsemanage1 libslang2 libustr-1.0-1 I: Found additional base dependencies: debian-archive-keyring gnupg gpgv libapt-pkg4.12 libreadline6 libstdc++6 libusb-0.1-4 readline-common base-files base-passwd bash bsdutils coreutils dash debconf debconf-i18n debianutils diffutils dpkg e2fslibs e2fsprogs findutils gcc-4.7-base gcc-4.8-base gcc-4.9-base grep gzip hostname initscripts insserv libacl1 libattr1 libaudit-common libaudit1 libblkid1 libbz2-1.0 libc-bin libc6 libcap2 libcomerr2 libdb5.3 libdebconfclient0 libgcc1 liblocale-gettext-perl liblzma5 libmount1 libncurses5 libpam-modules libpam-modules-bin libpam-runtime libpam0g libpcre3 libselinux1 libsemanage-common libsemanage1 libsepol1 libslang2 libss2 libtext-charwidth-perl libtext-iconv-perl libtext-wrapi18n-perl libtinfo5 libustr-1.0-1 libuuid1 login lsb-base mawk mount multiarch-support ncurses-base ncurses-bin passwd perl-base sed sensible-utils startpar sysv-rc sysvinit sysvinit-core sysvinit-utils tar tzdata util-linux zlib1g apt debian-archive-keyring gnupg gpgv libapt-pkg4.12 libreadline6 libstdc++6 libusb-0.1-4 readline-common I: Deleting target directory Two guesses: If there's a package in the above list that you don't want to install, you can use "--exclude=" but since they look like their priorities are "essential" and "required", I'd be surprised if they could be excluded. However if you want to exclude "net-tools", for example, from a debootstrap run without "--variant=minbase", you should be able to do so because its priority is "important". -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/CAOdo=SyFCyn_N5KZmu97SaxNei2Ejx==JjYtYJsbm=ocdta...@mail.gmail.com