Unify use of /etc/grml/fai/grml/grml_cleanup_chroot
[grml-live.git] / docs / grml-live.txt
1 grml-live(8)
2 ============
3
4 Name
5 ----
6
7 grml-live - build framework based on FAI for generating a grml and Debian based
8 Linux Live system (CD/ISO)
9
10 Synopsis
11 --------
12
13 grml-live [-c <classe[s]>] [-t <target_directory>] [-s <suite>] [-Fvh]
14
15 *******************************************************************************
16 Important! This document is growing as requested. If you have questions which
17 aren't answered by this document yet please let me know: <mika@grml.org>!
18 *******************************************************************************
19
20 Description
21 -----------
22
23 grml-live provides the build system for creating a grml and Debian based Linux
24 Live-CD. The build system is based on
25 link:http://www.informatik.uni-koeln.de/fai/[FAI] (Fully Automatic
26 Installation). grml-live uses the "fai dirinstall" feature to generate a chroot
27 system based on the class concept of FAI (see later sections for further
28 details) and provides the framework to be able to generate a full-featured ISO.
29 It does not use all the FAI features by default though and you don't have to
30 know FAI to be able to use it.
31
32 The use of FAI gives you the flexibility to choose the packages you would like
33 to include on your very own Linux Live-CD without having to deal with all the
34 details of a build process.
35
36 CAUTION: grml-live does **not** use /etc/fai for configuration but instead
37 provides and uses /etc/grml/fai. This ensures that it does not clash with
38 default FAI configuration and packages, so you can use grml-live and FAI
39 completely independent at the same time!
40
41 [NOTE]
42
43 Please notice that you should have a fast network connection as all the Debian
44 packages will be downloaded and installed via network. If you want to use a
45 local mirror (strongly recommended if you plan to use grml-live more than once)
46 checkout mkdebmirror (see /usr/share/doc/grml-live/examples/mkdebmirror),
47 debmirror(1), reprepro(1) (see /usr/share/doc/grml-live/examples/reprepro/ for a
48 sample configuration) and approx(8). To avoid downloading the base system again
49 and again check out FAI's NFSROOT (see FAQ of this document for details).
50
51 Options
52 -------
53
54   -c **CLASSES**::
55
56 Specify the CLASSES to be used for building the ISO via FAI.  By default only
57 the classes GRMLBASE and I386 are assumed, resulting in a small base system
58 (being about ~150MB total ISO size) for x86 (32bit).
59
60   -s **SUITE**::
61
62 Specify the Debian suite you want to use for your live-system.  Defaults to
63 "etch" (being current Debian/stable). Supported values are: etch, lenny, sid,
64 stable, testing, unstable.
65
66   -t **TARGET_DIRECTORY**::
67
68 Main output directory of the build process of FAI.  Some directories are created
69 inside this target directory, being: grml_cd (where the files for creating the
70 ISO are located, including the compressed squashfs file), grml_chroot (the
71 chroot system) and grml_isos (where the resulting ISO is stored).
72
73   -F::
74
75 Force execution and do not prompt for acknowledgment of configuration.
76
77   -h::
78
79 Display short usage information and exit.
80
81   -v::
82
83 Increase verbosity in the build process.
84
85 How to get your own Live-CD - the easy, fast and simple way
86 -----------------------------------------------------------
87
88 To get a small, Debian-stable and grml-based Live-CD using /grml/grml-live
89 as build and output directory just run:
90
91   # grml-live
92
93 To get a small Debian-unstable and grml-small based Live-CD using
94 /home/mika/grml-live as build and output directory just use:
95
96   # grml-live -c GRMLBASE,GRML_SMALL,I386 -t /home/mika/grml-live
97
98 [NOTE]
99
100 If you have about 700MB of free space inside /dev/shm (being a tmpfs, usually
101 you should have >=1GB of RAM) just run "mount -o remount,suid,dev,rw /dev/shm"
102 and use /dev/shm as build and output directory - resulting in very fast build
103 process.  But please be aware of the fact that rebooting your system will result
104 in an empty /dev/shm, so please another directory for $CHROOT_TARGET,
105 $BUILD_TARGET and $ISO_TARGET if you plan to create more persistent output. :)
106
107 Main features of grml-live
108 --------------------------
109
110 * create a grml-/Debian-based Linux Live-CD with one single command
111
112 * class based concept, providing a maximum of flexibility
113
114 * supports integration of own hooks, scripts and configuration
115
116 * supports use and integration of own Software and/or Kernels via simple use of
117 Debian repositories
118
119 * native support of FAI features
120
121 * multi-arch support (work in progress)
122
123 The class concept
124 -----------------
125
126 grml-live uses FAI and its class based concept for adjusting configuration and
127 setup according to your needs. This gives you flexibility and strength without
128 losing the simplicity in the build process.
129
130 The main and base class provided by grml-live is named GRMLBASE. It's strongly
131 recommended to **always** use the class GRMLBASE when building an ISO using
132 grml-live, as well as the architecture dependend class which provides the kernel
133 (being 'I386' for x86_32 currently only). The following files and directories
134 are relevant for class GRMLBASE by default:
135
136   /etc/grml/fai/config/scripts/GRMLBASE/
137   /etc/grml/fai/config/debconf/GRMLBASE
138   /etc/grml/fai/config/class/GRMLBASE.var
139   /etc/grml/fai/config/hooks/instsoft.GRMLBASE
140   /etc/grml/fai/config/package_config/GRMLBASE
141
142 Take a look at the next section for information about the concept of those
143 files/directories.
144
145 If you want to use your own configuration, extend an existing configuration
146 and/or add additional packages to your ISO just invent a new class (or extend an
147 existing one). For example if you want to use your own class named "FOOBAR" just
148 extend CLASSES="GRMLBASE,I386" inside /etc/grml/grml-live.conf to
149 CLASSES="GRMLBASE,I386,FOOBAR" or invoke grml-live using the classes option:
150 "grml-live -c GRMLBASE,I386,FOOBAR ...".
151
152 More details regarding the class concept can be found in the documentation of
153 FAI itself (being available at /usr/share/doc/fai-doc/).
154
155 Files
156 -----
157
158 Notice that grml-live ships FAI configuration files that do not use the same
159 namespace as the FAI packages itself. This ensures that grml-live does not clash
160 with your usual FAI configuration, so instead of /etc/fai/fai.conf (package
161 fai-client) grml uses /etc/grml/fai/fai.conf instead. For more details see
162 below. To get an idea how another configuration or example files could look like
163 check out /usr/share/doc/fai-doc/examples/simple/ (provided by Debian package
164 fai-doc). Furthermore /usr/share/doc/fai-doc/fai-guide.html/ch-config.html
165 provides documentation regarding configuration possibilities.
166
167   /usr/sbin/grml-live
168
169 Script for the main build process. Requires root permissions for execution.
170
171   /etc/grml/grml-live.conf
172
173 Main configuration file for grml-live. All the important steps can be configured
174 at this stage.
175
176   /etc/grml/fai/fai.conf
177
178 Main configuration file for FAI which specifies where all the configuration
179 files and scripts for FAI/grml-live can be found. By default it is set to
180 FAI_CONFIGDIR=/etc/grml/fai/config, a directory shipped by grml-live
181 out-of-the-box so you shouldn't have to configure anything in this file.
182
183   /etc/grml/fai/make-fai-nfsroot.conf
184
185 This file is used by make-fai-nfsroot(8) only. Usually you don't have to change
186 anything inside this file. If you want to modify NFSROOT though you can adjust
187 it there.
188
189   /etc/grml/fai/NFSROOT
190
191 This file specifies the package list for creating the NFSROOT.
192
193   /etc/grml/fai/apt/sources.list
194
195 This file specifies which mirrors should be used for retreiving the Debian
196 packages used for creating the main chroot (including all the software you would
197 like to see included). If you want to use a local mirror you either have to
198 adjust this file or use the GRML_LIVE_SOURCES variable inside
199 /etc/grml/grml-live.conf which modifies /etc/grml/fai/apt/sources.list
200 on-the-fly then.
201
202   /etc/grml/fai/config/
203
204 The main directory for configuration of FAI/grml-live. More details below.
205
206   /etc/grml/fai/config/class/
207
208 This directory contains files which specify main configuration variables for the
209 FAI classes.
210
211   /etc/grml/fai/config/debconf/
212
213 This directory provides the files for preseeding/configuration of debconf
214 through files.
215
216   /etc/grml/fai/config/hooks/
217
218 This directory provides files for customising the build process through hooks.
219 Hooks are user defined programs or scripts, which are called during the
220 installation process.
221
222   /etc/grml/fai/config/package_config/
223
224 Directory with lists of software packages to be installed or removed.  The
225 different classes describe what should find its way to your ISO.  When running
226 "grml-live -c GRMLBASE,I386 ..." only the files from the directories GRMLBASE
227 and I386 will be taken, if you use 'grml-live -c GRMLBASE,I386,FOOBAR ...' then
228 the files of GRMLBASE, I386 **plus** the files from FOOBAR will be taken. So
229 just create a new class to adjust the package selection according to your needs.
230 Please notice that the directory GRMLBASE contains a package list defining a
231 minimum but still reasonable package configuration.
232
233   /etc/grml/fai/config/scripts/
234
235 Scripts for customising the ISO within the build process.
236
237   /etc/grml/fai/files/
238
239 This directory provides files used inside the scripts of
240 /etc/grml/fai/config/scripts/*. For a full documentation what happens with the
241 files please refer to the source of the scripts.
242
243   /etc/grml/fai/live-initramfs/
244
245 This directory provides the files used for building the initramfs/initrd via
246 live-initramfs(8).
247
248 Requirements for the build system
249 ---------------------------------
250
251 * any Debian based system should be sufficient (if not it's a bug, so please
252 send us a bug report then) [a usual link:http://grml.org/grml2hd/[grml2hd]
253 harddisk installation ships all you need]
254
255 * enough free disk space; at least 800MB are required for a minimal grml-live
256 run (\~400MB for the chroot [$CHROOT_TARGET], \~150MB for the build target
257 [$BUILD_TARGET] and \~150MB for the resulting ISO [$ISO_TARGET] plus some
258 temporary files), if you plan to use GRML_FULL you should have at least 4GB of
259 total free disk space
260
261 * fast network access for retreiving the Debian packages used for creating the
262 chroot (check out "local mirror" and "NFSROOT" to workaround this problem as far
263 as possiblbe)
264
265 FAQ
266 ---
267
268 Help, I'm using Debian etch and I don't have FAI version >3.2
269 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
270
271   wget http://www.informatik.uni-koeln.de/fai/download/etch/fai-client_3.2.1_all.deb \
272        http://www.informatik.uni-koeln.de/fai/download/etch/fai-server_3.2.1_all.deb
273   dpkg -i fai-client_3.2.1_all.deb fai-server_3.2.1_all.deb
274
275 or check out the link:http://www.informatik.uni-koeln.de/fai/[FAI-homepage] for
276 further details.
277
278 I've problems with the build process. How to start debugging?
279 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
280
281 Check out the logs inside /var/log/fai/dirinstall/... If you don't have the time
282 to debug the problem in further detail or don't know how to proceed just send a
283 copy of your config, logs and the commandline with a short problem description
284 to <mika@grml.org>:
285
286   # history | grep grml-live > /etc/grml/grml_live.cmdline
287   # tar zcf grml_live_problem.tar.gz /etc/grml/grml-live.conf \
288             /var/log/fai/dirinstall /etc/grml/fai
289
290 Can I use my own (local) Debian mirror?
291 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
292
293 Sure. Just adjust the variables GRML_LIVE_SOURCES and FAI_DEBOOTSTRAP (if not
294 already using NFSROOT's base.tgz) inside /etc/grml/grml-live.conf according to
295 your needs. Please don't forget that you should use the grml servers as well
296 (see default configuration) so all the grml packages can be downloaded as well.
297
298 If you want to use a local (for example NFS mount) mirror additionally, just
299 adjust MIRROR_DIRECTORY and MIRROR_SOURCES insede /etc/grml/grml-live.conf as
300 well.
301
302 Unless you specify GRML_LIVE_SOURCES and/or FAI_DEBOOTSTRAP the default from
303 /etc/grml/fai/apt/sources.list and /etc/grml/fai/make-fai-nfsroot.conf will be
304 taken. If you customise the variables in /etc/grml/grml-live.conf then the two
305 files will be adjusted during runtime automatically.
306
307 If MIRROR_DIRECTORY and MIRROR_SOURCES are specified the local mirror will be
308 taken as first entry in the generated sources.list so it's prefered over
309 non-local mirrors. Using a fallback mirror (via providing several mirrors in
310 GRML_LIVE_SOURCES as used by default) is a recommended setting.
311
312 How do I add additional Debian package(s) to my CD/ISO?
313 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
314
315 Just create a new class (using the package_config directory):
316
317   # cat > /etc/grml/fai/config/package_config/MIKA << EOF
318   PACKAGES aptitude
319
320   vim
321   another_name_of_a_debian_package
322   and_another_one
323   EOF
324
325 and specify it when invoking grml-live then:
326
327   # grml-live -c GRMLBASE,I386,MIKA
328
329 I fscked up my grml-live configuration. How do I reset it to the defaults?
330 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
331
332 Notice: this deletes all your grml-live configuration files. If that's really
333 what you are searching for just run:
334
335   rm -rf /etc/grml/fai /etc/grml/grml-live.conf
336   dpkg -i --force-confnew --force-confmiss /path/to/grml-live_..._all.deb
337
338 [NOTE]
339
340 If you don't control your /etc using a version control system (VCS) yet it's a
341 good chance to start using it now. Check out
342 link:http://michael-prokop.at/blog/2007/03/14/maintain-etc-with-mercurial-on-debian/[http://michael-prokop.at/blog/2007/03/14/maintain-etc-with-mercurial-on-debian/]
343 for more details how to maintain /etc using the mercurial VCS.
344
345 How do I create a base.tgz for use as NFSROOT?
346 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
347
348 First of all build the chroot system:
349
350   mkdir /tmp/nfsroot && cd /tmp/nfsroot
351   debootstrap etch /tmp/nfsroot/ http://ftp.de.debian.org/debian
352   tar zcf base.tgz ./
353
354 Then check out where your NFSROOT is located:
355
356   # grep '^NFSROOT' /etc/grml/fai/make-fai-nfsroot.conf
357   NFSROOT=/grml/fai/nfsroot
358
359 So as /grml/fai/nfsroot is your NFSROOT place the file under
360 /grml/fai/nfsroot/live/filesystem.dir/var/tmp/:
361
362   mv base.tgz /grml/fai/nfsroot/live/filesystem.dir/var/tmp/base.tgz
363
364 Now running "grml-live ..." will use this file as main system instead of
365 executing debootstrap. Check out the output for the following lines:
366
367   [...]
368   Calling task_extrbase
369   Unpacking Debian base archive
370   Extracting /grml/fai/nfsroot/live/filesystem.dir/var/tmp/base.tgz
371   Calling task_mirror
372   [...]
373
374 I've a question which isn't answered by this document
375 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
376
377 Don't hesitate to ask on IRC (channel #grml on irc.freenode.org) or just drop me
378 a mail: <mika@grml.org>
379
380 Known TODOs
381 -----------
382
383 * "fai dirinstall" does not seem to always exit according to what happend during
384 the build; make sure to exit on any error (check logs for stuff like "dpkg:
385 error processing" [software.log], "FAILED with exit code" [shell.log],...)
386
387 * support something like a directory /etc/grml/fai/packages to install
388 additional Debian packages without the need for a Debian repository
389
390 * document the available classes in more detail (GRMLBASE, LATEX_CLEANUP,
391 NO_ONLINE, REMOVE_DOCS, GRML_SMALL,...)
392
393 * add a check to make sure $TARGET is mounted rw,suid,dev?
394
395 * add support for amd64 [gebi?] + ppc [formorer?] (and identify all packages
396 that are arch specific so we have a clean package list in all classes)
397
398 * support different grml-flavours through classes right out-of-the-box (being:
399 grml and  grml-small (done), each for x86, amd64 and ppc)
400
401 * support signed apt repositories (currently it's deactivated via FAI's
402 FAI_ALLOW_UNSIGNED=1 for some packages in the toolchain)
403
404 * support setting stuff like ISO name, version,... on-the-fly (especially for
405 stuff inside boot/isolinux/*)
406
407 * support "final builds" (including stuff like generating md5sums, gpg,... -
408 create a grml_release-directory including all the details about the build
409 process like dpkg selection, logs,...)
410
411 * the grml-live class(es) should send output to stdout and stderr as used inside
412 FAI as well (so it's not as verbose unless you specify it, make it configurable
413 though); check for errors inside the logs then as well
414
415 * provide possibility for cleanup of all created build directories and
416 a smart summary of the buildprocess (including "took ... minutes/seconds to
417 build...")
418
419 * check out how FAI_DEBMIRROR of /etc/grml/fai/fai.conf could be merged with our
420 MIRROR_DIRECTORY and MIRROR_SOURCES feature of /etc/grml/grml-live.conf
421
422 * support hooks to allow further customisation of the build process
423
424 Long term goals
425 ---------------
426
427 * Provide all upcoming grml releases based on grml-live.
428
429 * Provide a console interface (using dialog) for easy and common use of
430 grml-live.
431
432 * Provide a graphical interface (for example using pygtk) for easy and common
433 use of grml-live.
434
435 Download / install grml-live as a Debian package
436 ------------------------------------------------
437
438 Debian packages will be available through the grml-repository at
439 link:http://deb.grml.org/[http://deb.grml.org/] as soon as the grml-team
440 considers grml-live as stable enough. In the meantime just build the package on
441 your own:
442
443   hg clone http://hg.grml.org/grml-live
444   cd grml-live
445   debuild -us -uc
446
447 Source
448 ------
449
450 The source of grml-live is available at
451 link:http://hg.grml.org/grml-live/[http://hg.grml.org/grml-live/]
452
453 Bugs
454 ----
455
456 Please report feedback, link:http://grml.org/bugs/[bugreports] and wishes
457 link:http://grml.org/contact/[to the grml-team]!
458
459 Authors
460 -------
461 Michael Prokop <mika@grml.org>.
462
463 /////////////////////////////////////
464 // vim:ai tw=80 ft=asciidoc expandtab
465 /////////////////////////////////////