Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to install Debian on a loopback device (/dev/loop0).

I can easily access the command prompt by booting off the DVD and asking for a shell, and I'm assuming it should also be easy to mount the loopback device on /.

The part that I don't know is: how do I manually run the installer, after I have mounted /?

share|improve this question
The regular installer already does this but doesn't require the target directory to be the root directory. Examine the debian-installer sources. – tripleee Jan 31 '13 at 7:27

Debian installs into /target by default. You will have to skip some of the install steps and have a file ready for loopback mounting. Run mkfs.ext2 (or similar) on the file before mounting -o loop.

mkdir /target
mount /path/to/file /target -o loop

Normally, with special purpose installs, I skip the debian installer and use debootstrap and apt:

debootstrap wheezy /target http://debmirror/debian
mount -bind /dev /target/dev
''      ''  /proc  ''
''      ''  /sys   ''
''      ''  /dev/pts /target/dev/pts
chroot /target
apt-get install linux-image grub

... the remainder depends on how you want to deploy the image
(setup grub and linux with debconf)(remember no mbr on fs image)
(edit /etc/fstab)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.