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 /?

  • 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)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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