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