vmdebootstrap - install basic Debian system into virtual disk image
--image=FILE --size=SIZE [--mirror=URL]
[--output=FILE] [--verbose | --no-verbose] --image=FILE
--size=SIZE [--tarball=FILE] [--mirror=URL] [--arch=ARCH]
[--distribution=NAME] [--package=PACKAGE] [--custom-package=DEB] [--no-kernel]
[--enable-dhcp | --no-enable-dhcp] [--root-password=PASSWORD]
[--customize=SCRIPT] [--hostname=HOSTNAME] [--user=USER/PASSWORD]
[--serial-console | --no-serial-console] [--sudo | --no-sudo] [--owner=OWNER]
[--bootsize=BOOTSIZE] [--boottype=FSTYPE] [--foreign=PATH] [--variant=VARIANT]
[--no-extlinux] [--squash] [--configure-apt] [--grub]
installs a basic Debian system into a virtual disk image,
for use with virtual machines, such as KVM, Qemu, or VirtualBox. It is like
, which does the same thing, but puts the system into a
directory, for use with chroot(8)
. (In fact, vmdebootstrap
wrapper around debootstrap
You need to run vmdebootstrap
as root. If the --verbose option is not
used, no output will be sent to the command line. If the --log option is not
used, no output will be sent to any log files either.
To use the image, you probably want to create a virtual machine using your
preferred virtualization technology, such as kvm(1)
, or qemu
Configure the virtual machine to use the image you've created. Then start the
virtual machine, (see EXAMPLES
) and log into it via its console to
configure it. The image has an empty root password and will not have
networking configured by default. Set the root password before you configure
Unless the --no-extlinux or --grub options are specified, the image will use
as a boot loader. bootsize
is not recommended when
- use grub instead. Versions of grub2 in wheezy can fail
to install in the VM, at which point vmdebootstrap will fall back to extlinux.
It may still be possible to complete the installation of grub2 after booting
the VM as the problem may be related to the need to use loopback devices
during the grub-install operation. Details of the error will appear in the
vmdebootstrap log file, if enabled with the --log option. Note that
is not supported.
- write output to FILE, instead of standard output
- report what is going on
- put created disk image in FILE
- create a disk image of size SIZE (1000000000)
- tar up the disk's contents in FILE
- use MIRROR as package source (http://cdn.debian.net/debian/)
- architecture to use (amd64)
- release to use (stable)
- install PACKAGE onto system
- install package in DEB file onto system (not from mirror)
- do not install a linux package
- enable DHCP on eth0
- set root password
- run SCRIPT after setting up system. If the script does not exist in the
current working directory, /usr/share/vmdebootstrap/examples/ will be
checked as a fallback. The script needs to be executable and is passed the
root directory of the debootstrap as the only argument. Use chroot if you
need to execute binaries within the debootstrap.
- set name to HOSTNAME (debian)
- create USER with PASSWORD
- change the owner of the final image from root to the specified user.
- configure image to use a serial console
- set the command to manage the serial console which will be appended to
/etc/inittab. Default is "/sbin/getty -L ttyS0 115200 vt100",
resulting in a line S0:23:respawn:/sbin/getty -L ttyS0 115200
- install sudo, and if user is created, add them to sudo group
- If specified, create a /boot partition of the given size within the image.
Debootstrapping will fail if this is too small for the selected kernel
- Filesystem to use for the /boot partition. (default ext2)
- Path to the binfmt_handler to enable foreign support in debootstrap. e.g.
/usr/bin/qemu-arm-static - note foreign debootstraps may take a signficant
amount of time to complete and that debootstrap will retry five times if
packages fail to install by default.
- Skip installation of extlinux. needs a customize script to make the image
bootable. Useful for architectures where extlinux is not supportable.
Depending on how the image is to be booted, the --mbr option may also be
necessary with extlinux.
- Run mksquashfs against the final image using xz compression - requires
squashfs-tools to be installed. The final file will have the .squashfs
suffix. By default, mksquashfs is allowed to use all processors which may
result in high load. Run mksquashfs separately if you need to control the
number of processors used per run.
- Use the specified mirror and distribution to create a suitable apt source
inside the VM. Can be useful if debootstrap fails to create it
- Disable extlinux installation and configure grub2 instead. grub2 will be
added to the list of packages to install. update-grub will be called once
the debootstrap is complete and grub-install will be called in the
Configuration files and settings:¶
- write out the entire current configuration
- clear list of configuration files to read
- add FILE to config files
- write log entries to FILE (default is to not write log files at all); use
"syslog" to log to system log, or "none" to disable
- log at LEVEL, one of debug, info, warning, error, critical, fatal
- rotate logs larger than SIZE, zero for never (default: 0)
- keep last N logs (10)
- set permissions of new log files to MODE (octal; default 0600)
- make memory profiling dumps using METHOD, which is one of: none, simple,
meliae, or heapy (default: simple)
- make memory profiling dumps at least SECONDS apart
To create an image for the stable release of Debian:
sudo vmdebootstrap --image test.img --size 1g \
--log test.log --log-level debug --verbose \
To run the test image, make sure it is writeable. Use the --owner option to set mode 0644 for the specified user or use chmod manually:
sudo chmod a+w ./test.img
Execute using qemu, e.g. on amd64 using qemu-system-x86_64:
(This loads the image in a new window.)
For further examples, including u-boot support for beaglebone-black, see /usr/share/vmdebootstrap/examples
If you get problems with the bootstrap process, run a similar bootstrap call
directly and chroot into the directory to investigate the failure. The actual
debootstrap call is part of the vmdebootstrap logfile. The debootstrap
logfile, if any, will be copied into your current working directory on error.
will download all the apt archive files into the apt cache
and does not remove them before starting the configuration of the packages.
This can mean that debootstrap can fail due to a lack of space on the device
if the VM size is small. vmdebootstrap cleans up the apt cache once
debootstrap has finished but this doesn't help if the package unpack or
configuration steps use up all of the space in the meantime. Avoid this
problem by specifying a larger size for the image.
Note that if you are also using a separate /boot partition in your options to
vmdebootstrap, it may well be the boot partition which needs to be enlarged
rather than the entire image.
It is advisable to change the mirror in the example scripts to a mirror closer
to your location, particularly if you need to do repeated builds.
Please provide the config section of the logfile when reporting bugs, as well as
the complete command line.