summaryrefslogtreecommitdiff
path: root/vmdebootstrap.8.in
blob: 74f3e30c452e83089adb1a65e00f4f8a6b571680 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
.\" Copyright 2011 Lars Wirzenius <liw@liw.fi>
.\" 
.\" This program is free software: you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation, either version 3 of the License, or
.\" (at your option) any later version.
.\" 
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
.\" GNU General Public License for more details.
.\" 
.\" You should have received a copy of the GNU General Public License
.\" along with this program.  If not, see <http://www.gnu.org/licenses/>.
.\"
.TH VMDEBOOTSTRAP 8
.SH NAME
vmdebootstrap \- install basic Debian system into virtual disk image
.SH SYNOPSIS
.B vmdebootstrap
--image=FILE --size=SIZE [--mirror=URL] [--distribution=NAME]
.PP
.B vmdebootstrap
[--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]
.SH DESCRIPTION
.B vmdebootstrap
installs a basic Debian system into a virtual disk image,
for use with virtual machines,
such as KVM, Qemu, or VirtualBox.
It is like
.BR debootstrap (8),
which does the same thing, but puts the system into a directory,
for use with
.BR chroot (8).
(In fact,
.B vmdebootstrap
is a wrapper around
.BR debootstrap ).
.PP
You need to run
.B 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.
.PP
To use the image,
you probably want to create a virtual machine using your preferred
virtualization technology, such as 
.BR kvm (1),
or
.BR qemu (1).
Configure the virtual machine to use the image you've created.
Then start the virtual machine,
and log into it via its console to configure it.
.PP
Unless the \-\-no\-extlinux option is specified, the image will use
.BR extlinux (1)
as a boot loader.
The imagehas an empty root password and will not have networking configured.
Set the root password before you configure networking.
.SH OPTIONS
.IP \-\-output=FILE
write output to FILE, instead of standard output
.IP \-\-verbose
report what is going on
.IP \-\-image=FILE
put created disk image in FILE
.IP \-\-size=SIZE
create a disk image of size SIZE (1000000000)
.IP \-\-tarball=FILE
tar up the disk's contents in FILE
.IP \-\-mirror=URL
use MIRROR as package source (http://cdn.debian.net/debian/)
.IP \-\-arch=ARCH
architecture to use (amd64)
.IP \-\-distribution=NAME
release to use (stable)
.IP \-\-package=PACKAGE
install PACKAGE onto system
.IP \-\-custom-package=DEB
install package in DEB file onto system (not from mirror)
.IP \-\-no-kernel
do not install a linux package
.IP \-\-enable-dhcp
enable DHCP on eth0
.IP \-\-root-password=PASSWORD
set root password
.IP \-\-customize=SCRIPT
run SCRIPT after setting up system
.IP \-\-hostname=HOSTNAME
set name to HOSTNAME (debian)
.IP \-\-user=USER/PASSWORD
create USER with PASSWORD
.IP \-\-owner=OWNER
change the owner of the final image from root to the specified user.
.IP \-\-serial\-console
configure image to use a serial console
.IP \-\-serial-console-command
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
.BR "S0:23:respawn:/sbin/getty -L ttyS0 115200 vt100"
.IP \-\-sudo
install sudo, and if user is created, add them to sudo group
.IP \-\-bootsize=BOOTSIZE
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 package.
.IP \-\-boottype=FSTYPE
Filesystem to use for the /boot partition. (default ext2)
.IP \-\-foreign=PATH
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.
.IP \-\-no\-extlinux
Skip installation of extlinux. needs a customize script to make the image bootable. Useful for architectures where extlinux is not supportable.
.IP \-\-squash
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.
.IP\-\-configure\-apt
Use the specified mirror and distribution to create a suitable apt source inside
the VM.
.SH Configuration files and settings:
.IP \-\-dump-config
write out the entire current configuration
.IP \-\-no-default-configs
clear list of configuration files to read
.IP \-\-config=FILE
add FILE to config files
.SH Logging:
.IP \-\-log=FILE
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 logging
.IP \-\-log-level=LEVEL
log at LEVEL, one of debug, info, warning, error, critical, fatal (default: debug)
.IP \-\-log-max=SIZE
rotate logs larger than SIZE, zero for never (default: 0)
.IP \-\-log-keep=N
keep last N logs (10)
.IP \-\-log-mode=MODE
set permissions of new log files to MODE (octal;  default 0600)
.SH Peformance:
.IP \-\-dump-memory-profile=METHOD
make memory profiling dumps using METHOD, which is one of:
none, simple, meliae, or heapy (default: simple)
.IP \-\-memory-dump-interval=SECONDS
make memory profiling dumps at least SECONDS apart
.SH EXAMPLE
To create an image for the stable release of Debian:
.nf
.IP
sudo vmdebootstrap --image test.img --size 1g \\
    --log test.log --log-level debug --verbose \\
    --mirror http://mirror.lan/debian/
.PP
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:
.IP
sudo chmod a+w ./test.img
.PP
Execute using qemu, e.g. on amd64 using qemu-system-x86_64:
.IP
qemu-system-x86_64 ./test.img
.PP
(This loads the image in a new window.)
.SH NOTES
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.
.PP
.B debootstrap
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.
.PP
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.
.PP
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.
.PP
.SH "SEE ALSO"
.BR debootstrap (8)
,
.BR qemu (1)
.
.SH BUGS
Please provide the config section of the logfile when reporting bugs, as well as the complete command line.