]> git.siccegge.de Git - forks/vmdebootstrap.git/blob - vmdebootstrap.8.in
aecc792454670b7d9dfcef5aa1bd0e5cbdcd713a
[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]
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 BOOTLOADERS
69 Unless the \-\-no\-extlinux or \-\-grub options are specified, the
70 image will use
71 .BR extlinux (1)
72 as a boot loader.
73 .B bootsize
74 is not recommended when using
75 .B extlinux
76 \- use grub instead.
77 Versions of grub2 in wheezy
78 can fail to install in the VM, at which point vmdebootstrap will fall back to
79 extlinux. It may still be possible to complete the installation of grub2 after
80 booting the VM as the problem may be related to the need to use loopback
81 devices during the grub-install operation. Details of the error will appear in the
82 vmdebootstrap log file, if enabled with the \-\-log option. Note that
83 .B grub-legacy
84 is not supported.
85 .SH INSTALLATION IMAGES AND VIRTUAL MACHINES
86 .B vmdebootstrap
87 is aimed principally at creating virtual machines, not installers or prebuilt
88 installation images. It is possible to create prebuilt installation images
89 for some devices but this depends on the specific device. (A 'prebuilt
90 installation image' is a single image file which can be written to physical
91 media in a single operation and which allows the device to boot directly
92 into a fully installed system \- in a similar way to how a virtual machine
93 would behave.)
94 .PP
95 .B vmdebootstrap
96 assumes that all operations take place on a local image file, not a
97 physical block device / removable media.
98 .PP
99 .B vmdebootstrap
100 is intended to be used with tools like qemu on the command line to launch
101 a new virtual machine. Not all devices have virtualisation support in hardware.
102 .PP
103 This has implications for
104 .B u-boot
105 support in some cases. If the device can support reading the bootloader
106 from a known partition, like the beaglebone-black, then
107 .B vmdebootstrap
108 can provide space for the bootloader and the image will work as a prebuilt
109 installation image. If the device expects that the bootloader exists at a
110 specific offset and therefore requires that the bootloader is written as
111 an image not as a binary which can be copied into an existing partition,
112 .B vmdebootstrap
113 is unable to include that bootloader image into the virtual machine image.
114 .PP
115 The beagleboneblack.sh script in the examples/ directory provides a worked
116 example to create a prebuilt installation image. However, the beagleboneblack
117 itself does not support virtualisation in hardware, so is unable to launch
118 a virtual machine. Other devices, like the Cubietruck or Wandboard need
119 .B u-boot
120 at a predefined offset but can launch a virtual machine using qemu, so
121 the cubietruck and wandboard6q scripts in the examples/ directory relate
122 to building images for virtual machines once the device is already
123 installed and booted into a suitable kernel.
124 .PP
125 It is possible to wrap
126 .B vmdebootstrap
127 in such a way as to prepare a
128 .B physical block device
129 with a bootloader image and then deploy the bootstrap on top. However,
130 this does require physical media to be inserted and removed each time
131 the wrapper is executed. To do this, use the \-\-tarball option instead
132 of the \-\-image option. Then setup the physical media and bootloader
133 image manually, as required for the device, redefine the partitions to
134 make space for the rootfs, create a filesystem on the physical media and
135 unpack the
136 .B vmdebootstrap
137 tarball onto that filesystem. Once you have working media, an image can be
138 created using dd to read back from the media to an image file, allowing
139 other media to be written with a single image file.
140 .SH OPTIONS
141 .IP \-\-output=FILE
142 write output to FILE, instead of standard output
143 .IP \-\-verbose
144 report what is going on
145 .IP \-\-image=FILE
146 put created disk image in FILE
147 .IP \-\-size=SIZE
148 create a disk image of size SIZE (1000000000)
149 .IP \-\-tarball=FILE
150 tar up the disk's contents in FILE
151 .IP \-\-mirror=URL
152 use MIRROR as package source (http://http.debian.net/debian/)
153 .IP \-\-arch=ARCH
154 architecture to use (amd64) - if using an architecture which the
155 host system cannot execute, ensure the \-\-foreign option is also
156 used.
157 .IP \-\-distribution=NAME
158 release to use (defaults to stable). The release needs to be a valid
159 Debian or Ubuntu release name or codename.
160 .IP \-\-package=PACKAGE
161 install PACKAGE onto system
162 .IP \-\-custom-package=DEB
163 install package in DEB file onto system (not from mirror)
164 .IP \-\-no-kernel
165 do not install a linux package
166 .IP \-\-kernel-package
167 If \-\-no-kernel is not used and the auto-selection of the
168 .B linux-image\$arch
169 package is not suitable, the kernel package can be specified
170 explicitly.
171 .IP \-\-enable-dhcp
172 enable DHCP on eth0
173 .IP \-\-root-password=PASSWORD
174 set root password
175 .IP \-\-customize=SCRIPT
176 run SCRIPT after setting up system. If the script does not exist in the current
177 working directory, /usr/share/vmdebootstrap/examples/ will be checked as a
178 fallback. The script needs to be executable and is passed the root directory of
179 the debootstrap as the only argument. Use chroot if you need to execute binaries
180 within the debootstrap.
181 .IP \-\-hostname=HOSTNAME
182 set name to HOSTNAME (debian)
183 .IP \-\-user=USER/PASSWORD
184 create USER with PASSWORD
185 .IP \-\-owner=OWNER
186 change the owner of the final image from root to the specified user.
187 .IP \-\-serial\-console
188 configure image to use a serial console
189 .IP \-\-serial-console-command
190 set the command to manage the serial console which will be appended to
191 /etc/inittab. Default is "/sbin/getty \-L ttyS0 115200 vt100", resulting in a line
192 .BR "S0:23:respawn:/sbin/getty \-L ttyS0 115200 vt100"
193 .IP \-\-sudo
194 install sudo, and if user is created, add them to sudo group
195 .IP \-\-bootsize=BOOTSIZE
196 If specified, create a /boot partition of the given size within the image.
197 Debootstrapping will fail if this is too small for the selected kernel package.
198 .IP \-\-boottype=FSTYPE
199 Filesystem to use for the /boot partition. (default ext2)
200 .IP \-\-roottype=FSTYPE
201 Filesystem to use for the / (root) partition. (default ext4)
202 .IP \-\-swap=SWAPSIZE
203 If specified, create a swap partition of the given size within the image.
204 Debootstrapping will fail if this results in a root partition which is
205 too small for the selected packages. The minimum swap space is 256Mb as
206 the default memory allocation of QEMU is 128Mb. A default 1Gb image is
207 not likely to have enough space for a swap partition as well.
208 .IP \-\-foreign=PATH
209 Path to the binfmt_handler to enable foreign support in debootstrap.
210 e.g. /usr/bin/qemu-arm-static \- note foreign debootstraps may take a signficant
211 amount of time to complete and that debootstrap will retry five times if
212 packages fail to install by default.
213 .IP \-\-no\-extlinux
214 Skip installation of extlinux. needs a customize script to make the image
215 bootable. Useful for architectures where extlinux is not supportable.
216 Depending on how the image is to be booted, the \-\-mbr option may also be
217 necessary with extlinux.
218 .IP \-\-squash
219 Run mksquashfs against the final image using xz compression \- requires
220 squashfs-tools to be installed. The final file will have the .squashfs suffix.
221 By default, mksquashfs is allowed to use all processors which may result
222 in high load. Run mksquashfs separately if you need to control the number
223 of processors used per run.
224 .IP \-\-configure\-apt
225 Use the specified mirror and distribution to create a suitable apt source inside
226 the VM. Can be useful if debootstrap fails to create it automatically.
227 .IP \-\-apt\-mirror
228 Use the specified mirror inside the image instead of the mirror used to
229 build the image. This is useful if you have a local mirror to make building
230 the image quicker but the image needs to run even if that mirror is not
231 available.
232 .IP \-\-grub
233 Disable extlinux installation and configure grub2 instead. grub2 will be added to
234 the list of packages to install. update-grub will be called once the debootstrap is
235 complete and grub-install will be called in the image.
236 .IP \-\-pkglist
237 Output a list of package names installed inside the image. Useful if you
238 need to track the relevant source packages used inside the image for
239 licence compliance.
240 .SH Configuration files and settings:
241 .IP \-\-dump-config
242 write out the entire current configuration
243 .IP \-\-no-default-configs
244 clear list of configuration files to read
245 .IP \-\-config=FILE
246 add FILE to config files
247 .SH Logging:
248 .IP \-\-log=FILE
249 write log entries to FILE (default is to not write log files at all);
250 use "syslog" to log to system log, or "none" to disable logging
251 .IP \-\-log-level=LEVEL
252 log at LEVEL, one of debug, info, warning, error, critical, fatal (default: debug)
253 .IP \-\-log-max=SIZE
254 rotate logs larger than SIZE, zero for never (default: 0)
255 .IP \-\-log-keep=N
256 keep last N logs (10)
257 .IP \-\-log-mode=MODE
258 set permissions of new log files to MODE (octal; default 0600)
259 .SH Peformance:
260 .IP \-\-dump-memory-profile=METHOD
261 make memory profiling dumps using METHOD, which is one of:
262 none, simple, meliae, or heapy (default: simple)
263 .IP \-\-memory-dump-interval=SECONDS
264 make memory profiling dumps at least SECONDS apart
265 .SH EXAMPLE
266 To create an image for the stable release of Debian:
267 .nf
268 .IP
269 sudo vmdebootstrap \-\-image test.img \-\-size 1g \\
270 \-\-log test.log \-\-log-level debug \-\-verbose \\
271 \-\-mirror http://mirror.lan/debian/
272 .PP
273 To run the test image, make sure it is writeable. Use the \-\-owner
274 option to set mode 0644 for the specified user or use chmod manually:
275 .IP
276 sudo chmod a+w ./test.img
277 .PP
278 Execute using qemu, e.g. on amd64 using qemu-system-x86_64:
279 .IP
280 qemu-system-x86_64 ./test.img
281 .PP
282 (This loads the image in a new window.)
283 .PP
284 For further examples, including u-boot support for beaglebone-black,
285 see /usr/share/vmdebootstrap/examples
286 .SH NOTES
287 If you get problems with the bootstrap process, run a similar bootstrap
288 call directly and chroot into the directory to investigate the failure.
289 The actual debootstrap call is part of the vmdebootstrap logfile. The
290 debootstrap logfile, if any, will be copied into your current working
291 directory on error.
292 .PP
293 .B debootstrap
294 will download all the apt archive files into the apt cache and does not
295 remove them before starting the configuration of the packages. This can
296 mean that debootstrap can fail due to a lack of space on the device if
297 the VM size is small. vmdebootstrap cleans up the apt cache once debootstrap
298 has finished but this doesn't help if the package unpack or configuration
299 steps use up all of the space in the meantime. Avoid this problem by
300 specifying a larger size for the image.
301 .PP
302 Note that if you are also using a separate /boot partition in your options to
303 .B vmdebootstrap
304 it may well be the boot partition which needs to be enlarged rather than
305 the entire image.
306 .PP
307 It is advisable to change the mirror in the example scripts to a mirror
308 closer to your location, particularly if you need to do repeated builds.
309 Use the \-\-apt\-mirror option to specify the apt mirror to be used inside
310 the image, after boot.
311 .PP
312 There are two types of examples for ARM devices available with
313 .B vmdebootstrap:
314 prebuilt installation images (like the beaglebone-black) and virtual
315 machine images (cubietruck and wandboard). ARM devices which do not
316 support hypervisor mode and which also rely on the bootloader being at
317 a specific offset instead of using a normal partition will
318 .B not
319 be supportable by vmdebootstrap. Similarly, devices which support
320 hypervisor will only be supported using virtual machine images, unless
321 the bootloader can be executed from a normal partition.
322 .PP
323 .SH "SEE ALSO"
324 .BR debootstrap (8)
325 ,
326 .BR qemu-system-x86_64 (1)
327 ,
328 .BR grub-install (8)
329 .
330 .SH BUGS
331 Please provide the config section of the logfile when reporting bugs, as well as the complete command line.