9

I want to download Debian system using debootstrap (creating chroot environment) and when I run debootstrap stable ./dir $debian_ftp, debootstrap says:

E: debootstrap can only run as root

Why can't debootstrap be run without root permissions?

Kevin
  • 40,087
  • 16
  • 88
  • 112
jiwopene
  • 1,002
  • 7
  • 19

1 Answers1

9

You need to be able to create a chroot when you use debootstrap. Plus if you plan on partitioning, or doing any mounts, etc. you will need root permissions.

If you check out the debootstrap manpage you should be able to use debootstrap with the --variant=fakechroot option to use fakechroot, which installs the packages without root privileges. An example in your case would be something along the lines of this:

debootstrap --variant=fakechroot stable ./dir $debian_ftp

Please read the Wiki for more information on how to use debootstrap.

kemotep
  • 5,140
  • 7
  • 19
  • 35
  • 2
    Small addition: `debootstap` creates device nodes as well, which also requires root permissions, but that part can be faked by `fakeroot`. – Ferenc Wágner May 01 '19 at 08:05
  • I think you need to wrap debootstrap call with `fakechroot fakeroot` for it to work – pmartycz Apr 22 '21 at 13:46