]> git.siccegge.de Git - forks/vmdebootstrap.git/blob - vmdebootstrap.8.in
29e0f6861532a218e74fe611f879c30b15d3ae08
[forks/vmdebootstrap.git] / vmdebootstrap.8.in
1 .\" Copyright 2011 Lars Wirzenius <liw@liw.fi>
2 .\"
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.
7 .\"
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.
12 .\"
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/>.
15 .\"
16 .TH VMDEBOOTSTRAP 8
17 .SH NAME
18 vmdebootstrap \- install basic Debian system into virtual disk image
19 .SH SYNOPSIS
20 .B vmdebootstrap
21 \-\-image=FILE \-\-size=SIZE [\-\-mirror=URL] [\-\-distribution=NAME]
22 .PP
23 .B vmdebootstrap
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] [\-\-use\-efi] [\-\-efi\-size]
33 .SH DESCRIPTION
34 .B vmdebootstrap
35 installs a basic Debian system into a virtual disk image,
36 for use with virtual machines,
37 such as KVM, Qemu, or VirtualBox.
38 It is like
39 .BR debootstrap (8),
40 which does the same thing, but puts the system into a directory,
41 for use with
42 .BR chroot (8).
43 (In fact,
44 .B vmdebootstrap
45 is a wrapper around
46 .BR debootstrap ).
47 .PP
48 You need to run
49 .B vmdebootstrap
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.
53 .PP
54 To use the image,
55 you probably want to create a virtual machine using your preferred
56 virtualization technology, such as
57 .BR kvm (1),
58 or
59 .BR qemu (1).
60 Configure the virtual machine to use the image you've created.
61 Then start the virtual machine, (see
62 .B EXAMPLES
63 )
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
67 networking.
68 .SH NETWORKING
69 The \-\-enable\-networking option uses the /etc/network/interfaces.d/
70 source directory, with the default settings for
71 .B lo
72 and
73 .B eth0
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:
77
78 auto lo
79 iface lo inet loopback
80
81 If \-\-enable\-dhcp is specified, these settings are also included
82 into /etc/network/interfaces.d/setup:
83
84 auto eth0
85 iface eth0 inet dhcp
86
87 .SH BOOTLOADERS
88 Unless the \-\-no\-extlinux or \-\-grub options are specified, the
89 image will use
90 .BR extlinux (1)
91 as a boot loader.
92 .B bootsize
93 is not recommended when using
94 .B extlinux
95 \- use grub instead.
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
102 .B grub-legacy
103 is not supported.
104 .B vmdebootstrap
105 also supports
106 .B EFI.
107 Use \-\-use\-uefi to use grub\-efi instead of grub\-pc. If the default 5Mb
108 is not enough space, use the \-\-esp\-size option to specify a different
109 size for the EFI partition. Registered firmware is not supported as it
110 would need to be done after boot. If the system you are creating is for
111 more than just a VM or live image, you will likely need a larger ESP,
112 up to 500Mb.
113 .B UBoot
114 needs manual configuration via the customisation hook scripts,
115 typically support requires adding u\-boot using \-\-package and then
116 copying or manipulating the relevant u\-boot files in the customisation
117 script. Examples are included for beaglebone-black.
118 .SH INSTALLATION IMAGES AND VIRTUAL MACHINES
119 .B vmdebootstrap
120 is aimed principally at creating virtual machines, not installers or prebuilt
121 installation images. It is possible to create prebuilt installation images
122 for some devices but this depends on the specific device. (A 'prebuilt
123 installation image' is a single image file which can be written to physical
124 media in a single operation and which allows the device to boot directly
125 into a fully installed system \- in a similar way to how a virtual machine
126 would behave.)
127 .PP
128 .B vmdebootstrap
129 assumes that all operations take place on a local image file, not a
130 physical block device / removable media.
131 .PP
132 .B vmdebootstrap
133 is intended to be used with tools like qemu on the command line to launch
134 a new virtual machine. Not all devices have virtualisation support in hardware.
135 .PP
136 This has implications for
137 .B u-boot
138 support in some cases. If the device can support reading the bootloader
139 from a known partition, like the beaglebone-black, then
140 .B vmdebootstrap
141 can provide space for the bootloader and the image will work as a prebuilt
142 installation image. If the device expects that the bootloader exists at a
143 specific offset and therefore requires that the bootloader is written as
144 an image not as a binary which can be copied into an existing partition,
145 .B vmdebootstrap
146 is unable to include that bootloader image into the virtual machine image.
147 .PP
148 The beagleboneblack.sh script in the examples/ directory provides a worked
149 example to create a prebuilt installation image. However, the beagleboneblack
150 itself does not support virtualisation in hardware, so is unable to launch
151 a virtual machine. Other devices, like the Cubietruck or Wandboard need
152 .B u-boot
153 at a predefined offset but can launch a virtual machine using qemu, so
154 the cubietruck and wandboard6q scripts in the examples/ directory relate
155 to building images for virtual machines once the device is already
156 installed and booted into a suitable kernel.
157 .PP
158 It is possible to wrap
159 .B vmdebootstrap
160 in such a way as to prepare a
161 .B physical block device
162 with a bootloader image and then deploy the bootstrap on top. However,
163 this does require physical media to be inserted and removed each time
164 the wrapper is executed. To do this, use the \-\-tarball option instead
165 of the \-\-image option. Then setup the physical media and bootloader
166 image manually, as required for the device, redefine the partitions to
167 make space for the rootfs, create a filesystem on the physical media and
168 unpack the
169 .B vmdebootstrap
170 tarball onto that filesystem. Once you have working media, an image can be
171 created using dd to read back from the media to an image file, allowing
172 other media to be written with a single image file.
173 .SH OPTIONS
174 .IP \-\-output=FILE
175 write output to FILE, instead of standard output
176 .IP \-\-verbose
177 report what is going on
178 .IP \-\-image=FILE
179 put created disk image in FILE
180 .IP \-\-size=SIZE
181 create a disk image of size SIZE (1000000000)
182 .IP \-\-tarball=FILE
183 tar up the disk's contents in FILE
184 .IP \-\-mirror=URL
185 use MIRROR as package source (http://http.debian.net/debian/)
186 .IP \-\-arch=ARCH
187 architecture to use (amd64) - if using an architecture which the
188 host system cannot execute, ensure the \-\-foreign option is also
189 used.
190 .IP \-\-distribution=NAME
191 release to use (defaults to stable). The release needs to be a valid
192 Debian or Ubuntu release name or codename.
193 .IP \-\-package=PACKAGE
194 install PACKAGE onto system
195 .IP \-\-custom-package=DEB
196 install package in DEB file onto system (not from mirror)
197 .IP \-\-no-kernel
198 do not install a linux package
199 .IP \-\-kernel-package
200 If \-\-no-kernel is not used and the auto-selection of the
201 .B linux-image-586
202 or
203 .B linux-image-armmp
204 or
205 .B linux-image-$ARCH
206 package is not suitable, the kernel package can be specified
207 explicitly.
208 .IP \-\-enable-dhcp
209 enable DHCP on eth0
210 .IP \-\-root-password=PASSWORD
211 set root password
212 .IP \-\-customize=SCRIPT
213 run SCRIPT after setting up system. If the script does not exist in the current
214 working directory, /usr/share/vmdebootstrap/examples/ will be checked as a
215 fallback. The script needs to be executable and is passed the root directory of
216 the debootstrap as the only argument. Use chroot if you need to execute binaries
217 within the debootstrap.
218 .IP \-\-hostname=HOSTNAME
219 set name to HOSTNAME (debian)
220 .IP \-\-user=USER/PASSWORD
221 create USER with PASSWORD
222 .IP \-\-owner=OWNER
223 change the owner of the final image from root to the specified user.
224 .IP \-\-serial\-console
225 configure image to use a serial console
226 .IP \-\-serial-console-command
227 set the command to manage the serial console which will be appended to
228 /etc/inittab. Default is "/sbin/getty \-L ttyS0 115200 vt100", resulting in a line
229 .BR "S0:23:respawn:/sbin/getty \-L ttyS0 115200 vt100"
230 .IP \-\-sudo
231 install sudo, and if user is created, add them to sudo group
232 .IP \-\-bootsize=BOOTSIZE
233 If specified, create a /boot partition of the given size within the image.
234 Debootstrapping will fail if this is too small for the selected kernel package.
235 .IP \-\-boottype=FSTYPE
236 Filesystem to use for the /boot partition. (default ext2)
237 .IP \-\-roottype=FSTYPE
238 Filesystem to use for the / (root) partition. (default ext4)
239 .IP \-\-swap=SWAPSIZE
240 If specified, create a swap partition of the given size within the image.
241 Debootstrapping will fail if this results in a root partition which is
242 too small for the selected packages. The minimum swap space is 256Mb as
243 the default memory allocation of QEMU is 128Mb. A default 1Gb image is
244 not likely to have enough space for a swap partition as well.
245 .IP \-\-foreign=PATH
246 Path to the binfmt_handler to enable foreign support in debootstrap.
247 e.g. /usr/bin/qemu-arm-static \- note foreign debootstraps may take a signficant
248 amount of time to complete and that debootstrap will retry five times if
249 packages fail to install by default.
250 .IP \-\-no\-extlinux
251 Skip installation of extlinux. needs a customize script to make the image
252 bootable. Useful for architectures where extlinux is not supportable.
253 Depending on how the image is to be booted, the \-\-mbr option may also be
254 necessary with extlinux.
255 .IP \-\-squash
256 Run mksquashfs against the final image using xz compression \- requires
257 squashfs-tools to be installed. The final file will have the .squashfs suffix.
258 By default, mksquashfs is allowed to use all processors which may result
259 in high load. Run mksquashfs separately if you need to control the number
260 of processors used per run. squashfs can also have issues with large image
261 files (where large is a factor of the amount of data inside the image rather
262 than the size of the image itself). These errors can result in invalid
263 images (e.g. image does not boot) or corrupted images (truncated file).
264 This is a known bug in squashfs. Avoid using the \-\-squash option and
265 consider squashing the loopback mounted directory tree of the image.
266 .B
267 vmdebootstrap
268 will check if the squashed filesystem is less than 1MB and leave the
269 unsquashed image in place with a warning about a possible squashfs
270 failure.
271 .IP \-\-configure\-apt
272 Use the specified mirror and distribution to create a suitable apt source inside
273 the VM. Can be useful if debootstrap fails to create it automatically.
274 .IP \-\-apt\-mirror
275 Use the specified mirror inside the image instead of the mirror used to
276 build the image. This is useful if you have a local mirror to make building
277 the image quicker but the image needs to run even if that mirror is not
278 available.
279 .IP \-\-grub
280 Disable extlinux installation and configure grub2 instead. grub2 will be added to
281 the list of packages to install. update-grub will be called once the debootstrap is
282 complete and grub-install will be called in the image.
283 .IP \-\-no\-acpid
284 Disable installation of acpid if not required, otherwise acpid will be
285 installed if \-\-foreign is not used.
286 .IP \-\-pkglist
287 Output a list of package names installed inside the image. Useful if you
288 need to track the relevant source packages used inside the image for
289 licence compliance.
290 .SH Configuration files and settings:
291 .IP \-\-dump-config
292 write out the entire current configuration
293 .IP \-\-no-default-configs
294 clear list of configuration files to read
295 .IP \-\-config=FILE
296 add FILE to config files
297 .SH Logging:
298 .IP \-\-log=FILE
299 write log entries to FILE (default is to not write log files at all);
300 use "syslog" to log to system log, or "none" to disable logging
301 .IP \-\-log-level=LEVEL
302 log at LEVEL, one of debug, info, warning, error, critical, fatal (default: debug)
303 .IP \-\-log-max=SIZE
304 rotate logs larger than SIZE, zero for never (default: 0)
305 .IP \-\-log-keep=N
306 keep last N logs (10)
307 .IP \-\-log-mode=MODE
308 set permissions of new log files to MODE (octal; default 0600)
309 .SH Peformance:
310 .IP \-\-dump-memory-profile=METHOD
311 make memory profiling dumps using METHOD, which is one of:
312 none, simple, meliae, or heapy (default: simple)
313 .IP \-\-memory-dump-interval=SECONDS
314 make memory profiling dumps at least SECONDS apart
315 .SH EXAMPLE
316 To create an image for the stable release of Debian:
317 .nf
318 .IP
319 sudo vmdebootstrap \-\-image test.img \-\-size 1g \\
320 \-\-log test.log \-\-log-level debug \-\-verbose \\
321 \-\-mirror http://mirror.lan/debian/
322 .PP
323 To run the test image, make sure it is writeable. Use the \-\-owner
324 option to set mode 0644 for the specified user or use chmod manually:
325 .IP
326 sudo chmod a+w ./test.img
327 .PP
328 Execute using qemu, e.g. on amd64 using qemu-system-x86_64:
329 .IP
330 qemu-system-x86_64 -drive format=raw,file=./test.img
331 .PP
332 (This loads the image in a new window.)
333 .PP
334 For further examples, including u-boot support for beaglebone-black,
335 see /usr/share/vmdebootstrap/examples
336 .SH NOTES
337 If you get problems with the bootstrap process, run a similar bootstrap
338 call directly and chroot into the directory to investigate the failure.
339 The actual debootstrap call is part of the vmdebootstrap logfile. The
340 debootstrap logfile, if any, will be copied into your current working
341 directory on error.
342 .PP
343 .B debootstrap
344 will download all the apt archive files into the apt cache and does not
345 remove them before starting the configuration of the packages. This can
346 mean that debootstrap can fail due to a lack of space on the device if
347 the VM size is small. vmdebootstrap cleans up the apt cache once debootstrap
348 has finished but this doesn't help if the package unpack or configuration
349 steps use up all of the space in the meantime. Avoid this problem by
350 specifying a larger size for the image.
351 .PP
352 Note that if you are also using a separate /boot partition in your options to
353 .B vmdebootstrap
354 it may well be the boot partition which needs to be enlarged rather than
355 the entire image.
356 .PP
357 It is advisable to change the mirror in the example scripts to a mirror
358 closer to your location, particularly if you need to do repeated builds.
359 Use the \-\-apt\-mirror option to specify the apt mirror to be used inside
360 the image, after boot.
361 .PP
362 There are two types of examples for ARM devices available with
363 .B vmdebootstrap:
364 prebuilt installation images (like the beaglebone-black) and virtual
365 machine images (cubietruck and wandboard). ARM devices which do not
366 support hypervisor mode and which also rely on the bootloader being at
367 a specific offset instead of using a normal partition will
368 .B not
369 be supportable by vmdebootstrap. Similarly, devices which support
370 hypervisor will only be supported using virtual machine images, unless
371 the bootloader can be executed from a normal partition.
372 .PP
373 .SH "SEE ALSO"
374 .BR debootstrap (8)
375 ,
376 .BR qemu-system-x86_64 (1)
377 ,
378 .BR grub-install (8)
379 .
380 .SH BUGS
381 Please provide the config section of the logfile when reporting bugs, as well as the complete command line.