1 .\" Copyright 2011 Lars Wirzenius <liw@liw.fi>
3 .\" This program is free software: you can redistribute it and/or modify
4 .\" it under the terms of the GNU General Public License as published by
5 .\" the Free Software Foundation, either version 3 of the License, or
6 .\" (at your option) any later version.
8 .\" This program is distributed in the hope that it will be useful,
9 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
10 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 .\" GNU General Public License for more details.
13 .\" You should have received a copy of the GNU General Public License
14 .\" along with this program. If not, see <http://www.gnu.org/licenses/>.
18 vmdebootstrap \- install basic Debian system into virtual disk image
21 \-\-image=FILE \-\-size=SIZE [\-\-mirror=URL] [\-\-distribution=NAME]
24 [\-\-output=FILE] [\-\-verbose |\-\-no-verbose] \-\-image=FILE \-\-size=SIZE
25 [\-\-tarball=FILE] [\-\-mirror=URL] [\-\-arch=ARCH] [\-\-distribution=NAME]
26 [\-\-package=PACKAGE] [\-\-custom-package=DEB] [\-\-no-kernel] [\-\-kernel-package]
27 [\-\-enable-dhcp | \-\-no-enable-dhcp] [\-\-root-password=PASSWORD]
28 [\-\-customize=SCRIPT] [\-\-hostname=HOSTNAME] [\-\-user=USER/PASSWORD]
29 [\-\-serial-console | \-\-no-serial-console] [\-\-sudo |\-\-no-sudo] [\-\-owner=OWNER]
30 [\-\-bootsize=BOOTSIZE] [\-\-boottype=FSTYPE] [\-\-roottype=FSTYPE] [\-\-foreign=PATH]
31 [\-\-variant=VARIANT] [\-\-no-extlinux] [\-\-squash] [\-\-configure-apt]
32 [\-\-grub] [\-\-apt-mirror] [\-\-pkglist]
35 installs a basic Debian system into a virtual disk image,
36 for use with virtual machines,
37 such as KVM, Qemu, or VirtualBox.
40 which does the same thing, but puts the system into a directory,
50 as root. If the \-\-verbose option is not used, no output will be
51 sent to the command line. If the \-\-log option is not used, no
52 output will be sent to any log files either.
55 you probably want to create a virtual machine using your preferred
56 virtualization technology, such as
60 Configure the virtual machine to use the image you've created.
61 Then start the virtual machine, (see
64 and log into it via its console to configure it.
65 The image has an empty root password and will not have networking
66 configured by default. Set the root password before you configure
69 The \-\-enable\-networking option uses the /etc/network/interfaces.d/
70 source directory, with the default settings for
74 being added to /etc/network/interfaces.d/setup. Other networking
75 configuration can be specified using a customisation script.
76 Localhost settings would be:
79 iface lo inet loopback
81 If \-\-enable\-dhcp is specified, these settings are also included
82 into /etc/network/interfaces.d/setup:
88 Unless the \-\-no\-extlinux or \-\-grub options are specified, the
93 is not recommended when using
96 Versions of grub2 in wheezy
97 can fail to install in the VM, at which point vmdebootstrap will fall back to
98 extlinux. It may still be possible to complete the installation of grub2 after
99 booting the VM as the problem may be related to the need to use loopback
100 devices during the grub-install operation. Details of the error will appear in the
101 vmdebootstrap log file, if enabled with the \-\-log option. Note that
104 .SH INSTALLATION IMAGES AND VIRTUAL MACHINES
106 is aimed principally at creating virtual machines, not installers or prebuilt
107 installation images. It is possible to create prebuilt installation images
108 for some devices but this depends on the specific device. (A 'prebuilt
109 installation image' is a single image file which can be written to physical
110 media in a single operation and which allows the device to boot directly
111 into a fully installed system \- in a similar way to how a virtual machine
115 assumes that all operations take place on a local image file, not a
116 physical block device / removable media.
119 is intended to be used with tools like qemu on the command line to launch
120 a new virtual machine. Not all devices have virtualisation support in hardware.
122 This has implications for
124 support in some cases. If the device can support reading the bootloader
125 from a known partition, like the beaglebone-black, then
127 can provide space for the bootloader and the image will work as a prebuilt
128 installation image. If the device expects that the bootloader exists at a
129 specific offset and therefore requires that the bootloader is written as
130 an image not as a binary which can be copied into an existing partition,
132 is unable to include that bootloader image into the virtual machine image.
134 The beagleboneblack.sh script in the examples/ directory provides a worked
135 example to create a prebuilt installation image. However, the beagleboneblack
136 itself does not support virtualisation in hardware, so is unable to launch
137 a virtual machine. Other devices, like the Cubietruck or Wandboard need
139 at a predefined offset but can launch a virtual machine using qemu, so
140 the cubietruck and wandboard6q scripts in the examples/ directory relate
141 to building images for virtual machines once the device is already
142 installed and booted into a suitable kernel.
144 It is possible to wrap
146 in such a way as to prepare a
147 .B physical block device
148 with a bootloader image and then deploy the bootstrap on top. However,
149 this does require physical media to be inserted and removed each time
150 the wrapper is executed. To do this, use the \-\-tarball option instead
151 of the \-\-image option. Then setup the physical media and bootloader
152 image manually, as required for the device, redefine the partitions to
153 make space for the rootfs, create a filesystem on the physical media and
156 tarball onto that filesystem. Once you have working media, an image can be
157 created using dd to read back from the media to an image file, allowing
158 other media to be written with a single image file.
161 write output to FILE, instead of standard output
163 report what is going on
165 put created disk image in FILE
167 create a disk image of size SIZE (1000000000)
169 tar up the disk's contents in FILE
171 use MIRROR as package source (http://http.debian.net/debian/)
173 architecture to use (amd64) - if using an architecture which the
174 host system cannot execute, ensure the \-\-foreign option is also
176 .IP \-\-distribution=NAME
177 release to use (defaults to stable). The release needs to be a valid
178 Debian or Ubuntu release name or codename.
179 .IP \-\-package=PACKAGE
180 install PACKAGE onto system
181 .IP \-\-custom-package=DEB
182 install package in DEB file onto system (not from mirror)
184 do not install a linux package
185 .IP \-\-kernel-package
186 If \-\-no-kernel is not used and the auto-selection of the
192 package is not suitable, the kernel package can be specified
196 .IP \-\-root-password=PASSWORD
198 .IP \-\-customize=SCRIPT
199 run SCRIPT after setting up system. If the script does not exist in the current
200 working directory, /usr/share/vmdebootstrap/examples/ will be checked as a
201 fallback. The script needs to be executable and is passed the root directory of
202 the debootstrap as the only argument. Use chroot if you need to execute binaries
203 within the debootstrap.
204 .IP \-\-hostname=HOSTNAME
205 set name to HOSTNAME (debian)
206 .IP \-\-user=USER/PASSWORD
207 create USER with PASSWORD
209 change the owner of the final image from root to the specified user.
210 .IP \-\-serial\-console
211 configure image to use a serial console
212 .IP \-\-serial-console-command
213 set the command to manage the serial console which will be appended to
214 /etc/inittab. Default is "/sbin/getty \-L ttyS0 115200 vt100", resulting in a line
215 .BR "S0:23:respawn:/sbin/getty \-L ttyS0 115200 vt100"
217 install sudo, and if user is created, add them to sudo group
218 .IP \-\-bootsize=BOOTSIZE
219 If specified, create a /boot partition of the given size within the image.
220 Debootstrapping will fail if this is too small for the selected kernel package.
221 .IP \-\-boottype=FSTYPE
222 Filesystem to use for the /boot partition. (default ext2)
223 .IP \-\-roottype=FSTYPE
224 Filesystem to use for the / (root) partition. (default ext4)
225 .IP \-\-swap=SWAPSIZE
226 If specified, create a swap partition of the given size within the image.
227 Debootstrapping will fail if this results in a root partition which is
228 too small for the selected packages. The minimum swap space is 256Mb as
229 the default memory allocation of QEMU is 128Mb. A default 1Gb image is
230 not likely to have enough space for a swap partition as well.
232 Path to the binfmt_handler to enable foreign support in debootstrap.
233 e.g. /usr/bin/qemu-arm-static \- note foreign debootstraps may take a signficant
234 amount of time to complete and that debootstrap will retry five times if
235 packages fail to install by default.
237 Skip installation of extlinux. needs a customize script to make the image
238 bootable. Useful for architectures where extlinux is not supportable.
239 Depending on how the image is to be booted, the \-\-mbr option may also be
240 necessary with extlinux.
242 Run mksquashfs against the final image using xz compression \- requires
243 squashfs-tools to be installed. The final file will have the .squashfs suffix.
244 By default, mksquashfs is allowed to use all processors which may result
245 in high load. Run mksquashfs separately if you need to control the number
246 of processors used per run.
247 .IP \-\-configure\-apt
248 Use the specified mirror and distribution to create a suitable apt source inside
249 the VM. Can be useful if debootstrap fails to create it automatically.
251 Use the specified mirror inside the image instead of the mirror used to
252 build the image. This is useful if you have a local mirror to make building
253 the image quicker but the image needs to run even if that mirror is not
256 Disable extlinux installation and configure grub2 instead. grub2 will be added to
257 the list of packages to install. update-grub will be called once the debootstrap is
258 complete and grub-install will be called in the image.
260 Disable installation of acpid if not required, otherwise acpid will be
261 installed if \-\-foreign is not used.
263 Output a list of package names installed inside the image. Useful if you
264 need to track the relevant source packages used inside the image for
266 .SH Configuration files and settings:
268 write out the entire current configuration
269 .IP \-\-no-default-configs
270 clear list of configuration files to read
272 add FILE to config files
275 write log entries to FILE (default is to not write log files at all);
276 use "syslog" to log to system log, or "none" to disable logging
277 .IP \-\-log-level=LEVEL
278 log at LEVEL, one of debug, info, warning, error, critical, fatal (default: debug)
280 rotate logs larger than SIZE, zero for never (default: 0)
282 keep last N logs (10)
283 .IP \-\-log-mode=MODE
284 set permissions of new log files to MODE (octal; default 0600)
286 .IP \-\-dump-memory-profile=METHOD
287 make memory profiling dumps using METHOD, which is one of:
288 none, simple, meliae, or heapy (default: simple)
289 .IP \-\-memory-dump-interval=SECONDS
290 make memory profiling dumps at least SECONDS apart
292 To create an image for the stable release of Debian:
295 sudo vmdebootstrap \-\-image test.img \-\-size 1g \\
296 \-\-log test.log \-\-log-level debug \-\-verbose \\
297 \-\-mirror http://mirror.lan/debian/
299 To run the test image, make sure it is writeable. Use the \-\-owner
300 option to set mode 0644 for the specified user or use chmod manually:
302 sudo chmod a+w ./test.img
304 Execute using qemu, e.g. on amd64 using qemu-system-x86_64:
306 qemu-system-x86_64 -drive format=raw,file=./test.img
308 (This loads the image in a new window.)
310 For further examples, including u-boot support for beaglebone-black,
311 see /usr/share/vmdebootstrap/examples
313 If you get problems with the bootstrap process, run a similar bootstrap
314 call directly and chroot into the directory to investigate the failure.
315 The actual debootstrap call is part of the vmdebootstrap logfile. The
316 debootstrap logfile, if any, will be copied into your current working
320 will download all the apt archive files into the apt cache and does not
321 remove them before starting the configuration of the packages. This can
322 mean that debootstrap can fail due to a lack of space on the device if
323 the VM size is small. vmdebootstrap cleans up the apt cache once debootstrap
324 has finished but this doesn't help if the package unpack or configuration
325 steps use up all of the space in the meantime. Avoid this problem by
326 specifying a larger size for the image.
328 Note that if you are also using a separate /boot partition in your options to
330 it may well be the boot partition which needs to be enlarged rather than
333 It is advisable to change the mirror in the example scripts to a mirror
334 closer to your location, particularly if you need to do repeated builds.
335 Use the \-\-apt\-mirror option to specify the apt mirror to be used inside
336 the image, after boot.
338 There are two types of examples for ARM devices available with
340 prebuilt installation images (like the beaglebone-black) and virtual
341 machine images (cubietruck and wandboard). ARM devices which do not
342 support hypervisor mode and which also rely on the bootloader being at
343 a specific offset instead of using a normal partition will
345 be supportable by vmdebootstrap. Similarly, devices which support
346 hypervisor will only be supported using virtual machine images, unless
347 the bootloader can be executed from a normal partition.
352 .BR qemu-system-x86_64 (1)
357 Please provide the config section of the logfile when reporting bugs, as well as the complete command line.