I was trying to dist-upgrade chroot'd environment. I created configuration file with: RootDir "/tmp/mychroot"; and pointed APT_CONFIG to it. Then I ran: # export APT_CONFIG # apt-get update # apt-get dist-upgrade apt-get dist-upgrade failed after downloading packages as it was not able to extract templates. Many errors were reported saying: E: Could not open file /var/cache/apt/archives/<package> - open (2: No such file or directory) E: Unable to determine the file size - fstat (9: Bad file descriptor) E: Read error - read (9: Bad file descriptor) It suggests, that apt-extracttemplates (and maybe other components) does not honor RootDir option. The packages were downloaded to the chroot'd environment, but apt-extracttemplated looked them up in the primary environment. I was able to workaround this with setting: Dpkg::Chroot-Directory "/tmp/mychroot"; in the APT_CONFIG file. However, this caused dpkg to be chrooted to /tmp/mychroot/tmp/mychroot, which obviously does not exist. The only possible workaround seems to be to chroot whole 'apt-get dist-upgrade'. # chroot /tmp/mychroot apt-get dist-upgrade
We will need to check if this applies to APT/wheezy and/or APT/unstable.
It could be that rev 1561.1.206 solves this:
apt (0.8.12) unstable; urgency=low
…
* apt-pkg/contrib/fileutl.cc, apt-pkg/deb/dpkgpm.cc:
- honor Dpkg::Chroot-Directory in the RunScripts*() methods
…
-- Michael Vogt <mvo@debian.org> Thu, 10 Mar 2011 14:46:48 +0100
as apt-extracttemplate is not directly executed from APT.
I remember that we had some changes in that area as well, I just can't
seem to find them just yet.
Would be nice if you could test this in wheezy as I never used these options
myself so far so I don't know the "usecase" to properly test it.
Best regards
David Kalnischkies
Hi David, I've given it a try on wheezy (apt 0.9.7.6). I suppose, the new apt-get chroots into the new env before apt-extracttemplates is executed, right? Setting just RootDir made apt-extracttemplates complain about missing APT_CONFIG configuration - which is obvious as it was stored in the parent environment. (APT_CONFIG points to my temporary configuration file which is stored in /tmp. It contains the necessary tweaks and is not part of usual configuration.) However, it passed. And then chroot was done (probably once again) before /usr/bin/dpkg. And there is failed with status 100. Setting RootDir along with Dpkg::Chroot-directory makes no good. It makes apt-get chroot into RootDir/chroot-directory (like /tmp/altroot/tmp/altroot). Needless to say that /usr/bin/apt-listchanges could have not been started from there and failed with status 100. With the recent dpkg::chroot-directory changes you probably mean bug# 659387. I saw that but I don't think it applies to this case. Best regards, Milan Cermak Dne 25.11.2012 14:07, David Kalnischkies napsal(a):