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

Bug#350635: Using debootstrap: dpkg needs leading / to be able to find archives



tags 350635 pending
thanks

On Mon, Jan 30, 2006 at 09:50:48PM +0100, Patrik Arvhult wrote:
> debootstrap, debootstrap somewhat patched as described for bug # 350583.
> 
> If running:
> 
> Puter#~/> debootstrap --arch i386 sarge /mnt/debinst \
> 		http://ftp.se.debian.org/debian
> 
> on a Slackware Linux 1.2.3 system,
> 
> the debootstrap package,  downloads  packages properly and executes this 
> command:
> 
> chroot /mnt/debinst dpkg --force-all --install \
> 	var/cache/apt/archives/<package name>
> 
> and fails.
> 
> if trying manually, i find that:
> 
> chroot /mnt/debinst dpkg --force-all \
> 	--install /var/cache/apt/archives/<package name>
> 
> does work. So a leading slash does help.

I strongly suspect that the real bug here is in fact in your chroot
program. If implemented properly, the chroot program does:

  chroot(newroot);
  chdir("/");

However, your chroot program might just do the first system call, in
which case the current working directory will be left *outside* the new
root filesystem - a perfectly possible and sometimes even useful
situation, although one which makes it easy to break out of the chroot
using fchdir() so it isn't generally done that way. The result of that,
of course, is that relative paths don't work, but absolute paths do.

> Looking into scripts sarge and sarge.build I see these paths are generated by 
> the script named "functions", and is emitted at row 369 by a utility function 
> "debfor".
> 
> change:
> script named functions, row 369 was:
> 
> 	echo $path
> 
> changed to
> 
> 	echo /$path
> 
> 
> This seems to help in my particular case. debootstrap moves on unpacking and 
> configuring packages.
> 
> But in general I suspect it to be a bad solution. Maybe the need of this 
> extra / should be user-supplied in some better way or the need of it beeing 
> calculated/tested.

It would be better to fix the real bug, but I doubt that's practical in
this case!

I think it's OK to prepend /, although I prefer a slightly different
location for that (in the "deb" case of apt_dest). I'll commit that for
the next version of debootstrap.

Thanks,

-- 
Colin Watson                                       [cjwatson@debian.org]



Reply to: