New option -b for build-only
[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 [-a <architecture>] [-c <classe[s]>] [-g <grml_name>] [-i <iso_name> ]
14 [-o <output_directory>] [-r <release_name>] [-s <suite>] [-t
15 <template_directory>] [-v <version_number>] [-bFVhuz]
16
17 *******************************************************************************
18 Important! This document is growing as requested. If you have questions which
19 aren't answered by this document yet please let me know: <mika@grml.org>!
20 This document currently applies to grml-live version 0.0.13.
21 *******************************************************************************
22
23 Description
24 -----------
25
26 grml-live provides the build system for creating a grml and Debian based Linux
27 Live-CD. The build system is based on
28 link:http://www.informatik.uni-koeln.de/fai/[FAI] (Fully Automatic
29 Installation). grml-live uses the "fai dirinstall" feature to generate a chroot
30 system based on the class concept of FAI (see later sections for further
31 details) and provides the framework to be able to generate a full-featured ISO.
32 It does not use all the FAI features by default though and you don't have to
33 know FAI to be able to use it.
34
35 The use of FAI gives you the flexibility to choose the packages you would like
36 to include on your very own Linux Live-CD without having to deal with all the
37 details of a build process.
38
39 CAUTION: grml-live does **not** use /etc/fai for configuration but instead
40 provides and uses /etc/grml/fai. This ensures that it does not clash with
41 default FAI configuration and packages, so you can use grml-live and FAI
42 completely independent at the same time!
43
44 [NOTE]
45
46 Please notice that you should have a fast network connection as all the Debian
47 packages will be downloaded and installed via network. If you want to use a
48 local mirror (strongly recommended if you plan to use grml-live more than once)
49 checkout mkdebmirror (see /usr/share/doc/grml-live/examples/mkdebmirror),
50 debmirror(1), reprepro(1) (see /usr/share/doc/grml-live/examples/reprepro/ for a
51 sample configuration), apt-cacher(1) and approx(8). To avoid downloading the
52 base system again and again check out FAI's NFSROOT (see FAQ of this document
53 for details).
54
55 Options
56 -------
57
58   -a **ARCHITECTURE**::
59
60 Use the specified architecture instead of the currently running one.  This
61 allows building a 32bit system on a 64bit host. Please notice that real
62 crosscompiling (like building a ppc system on x86) isn't possible due to the
63 nature and the need of working in a chroot.
64
65   -b::
66
67 Build the ISO without updating the chroot via FAI. This option is useful for
68 example when working on stable releases: if you have a working base
69 system/chroot and do not want to execute any further updates (via "-u" option)
70 but intend to only build the ISO. (Notice: This option requires a feature within
71 FAI which is not yet part of the official FAI release yet.)
72
73   -c **CLASSES**::
74
75 Specify the CLASSES to be used for building the ISO via FAI.  By default only
76 the classes GRMLBASE, GRML_SMALL and I386 are assumed, resulting in a small base
77 system (being about ~150MB total ISO size). If using a non-I386 system (like
78 amd64) you should specify the appropriate architecture as well. Additionally you
79 can specify a class providing a grml-kernel (see
80 /etc/grml/fai/config/package_config/ for a full list).  So instead of GRML_SMALL
81 you can also use GRML_MEDIUM and GRML_FULL instead.
82
83   -C **CONFIGURATION_FILE**::
84
85 The specified file is used as configuration file for grml-live. By default
86 /etc/grml/grml-live.conf is used for main configuration. If a file named
87 /etc/grml/grml-live.local exists it is used as well (sourced after reading
88 /etc/grml/grml-live.conf to allow overriding settings). As a last option the
89 specified configuration file is sourced so it is possible to override settings
90 of /etc/grml/grml-live.conf as well as of /etc/grml/grml-live.local. Please
91 notice that all configuration files have to be adjusted during execution of
92 grml-live, so please make sure you use /etc/grml/grml-live.conf as a base for
93 your own configuration file. Please also notice that the configuration file
94 specified via this option is **not** (yet) supported inside the
95 scripts/hooks/classes at /etc/grml/fai/config. Instead use
96 /etc/grml/grml-live.conf and/or /etc/grml/grml-live.local for configuration
97 stuff used inside /etc/grml/fai/config.
98
99   -F::
100
101 Force execution and do not prompt for acknowledgment of configuration.
102
103   -g **GRML_NAME**::
104
105 Set the grml flavour name. Common usage examples: grml, grml-small, grml64.
106
107   -h::
108
109 Display short usage information and exit.
110
111   -i **ISO_NAME**::
112
113 Specify name of ISO which will be available inside $OUTPUT_DIRECTORY/grml_isos
114 by default.
115
116   -o **OUTPUT_DIRECTORY**::
117
118 Main output directory of the build process of FAI.  Some directories are created
119 inside this target directory, being: grml_cd (where the files for creating the
120 ISO are located, including the compressed squashfs file), grml_chroot (the
121 chroot system) and grml_isos (where the resulting ISO is stored).
122
123   -r **RELEASENAME**::
124
125 Specify name of the release.
126
127   -s **SUITE**::
128
129 Specify the Debian suite you want to use for your live-system.  Defaults to
130 "etch" (being current Debian/stable). Supported values are: etch, lenny, sid.
131
132   -t **TEMPLATE_DIRECTORY**::
133
134 Specify place of the templates used for building the ISO. By default
135 (and if not manually specified) this is /usr/share/grml-live/templates/.
136
137   -u::
138
139 Update existing chroot instead of rebuilding it from scratch. This option is
140 based on the softupdate feature of FAI.
141
142   -v **VERSION_NUMBER**::
143
144 Specify version number of the release.
145
146   -V::
147
148 Increase verbosity in the build process.
149
150   -z::
151
152 Use ZLIB instead of LZMA compression in mksquashfs part of the build process.
153
154 Usage examples
155 --------------
156
157 To get a small, Debian-stable and grml-based Live-CD using /grml/grml-live
158 as build and output directory just run:
159
160   # grml-live
161
162 To get a small Debian-unstable and grml-small based Live-CD using
163 /home/mika/grml-live as build and output directory just use:
164
165   # grml-live -c GRMLBASE,GRML_SMALL,I386 -o /home/mika/grml-live
166
167 To get a small, Debian-unstable and grml-based Live-CD using /tmp as build and
168 output directory and use grml_0.0-3.iso as ISO name (placed inside
169 /tmp/grml_isos) just invoke:
170
171   # grml-live -o /tmp -c GRMLBASE,GRML_SMALL,I386 -s sid -i grml_0.0-3.iso
172
173 [NOTE]
174
175 If you have about 700MB of free space inside /dev/shm (being a tmpfs, usually
176 you should have >=1GB of RAM) just run "mount -o remount,suid,dev,rw /dev/shm"
177 and use /dev/shm as build and output directory - resulting in very fast build
178 process.  But please be aware of the fact that rebooting your system will result
179 in an empty /dev/shm, so please another directory for $CHROOT_OUTPUT,
180 $BUILD_OUTPUT and $ISO_OUTPUT if you plan to create more persistent output. :)
181
182 Main features of grml-live
183 --------------------------
184
185 * create a grml-/Debian-based Linux Live-CD with one single command
186
187 * class based concept, providing a maximum of flexibility
188
189 * supports integration of own hooks, scripts and configuration
190
191 * supports use and integration of own Software and/or Kernels via simple use of
192 Debian repositories
193
194 * native support of FAI features
195
196 * multi-arch support (work in progress)
197
198 The class concept
199 -----------------
200
201 grml-live uses FAI and its class based concept for adjusting configuration and
202 setup according to your needs. This gives you flexibility and strength without
203 losing the simplicity in the build process.
204
205 The main and base class provided by grml-live is named GRMLBASE. It's strongly
206 recommended to **always** use the class GRMLBASE when building an ISO using
207 grml-live, as well as the architecture dependent class which provides the kernel
208 (being 'I386' for x86_32 and 'AMD64' for x86_64) and a GRML_* class (like
209 GRML_SMALL, GRML_MEDIUM or GRML_FULL). The following files and directories are
210 relevant for class GRMLBASE by default:
211
212   /etc/grml/fai/config/scripts/GRMLBASE/
213   /etc/grml/fai/config/debconf/GRMLBASE
214   /etc/grml/fai/config/class/GRMLBASE.var
215   /etc/grml/fai/config/hooks/instsoft.GRMLBASE
216   /etc/grml/fai/config/package_config/GRMLBASE
217
218 Take a look at the next section for information about the concept of those
219 files/directories.
220
221 If you want to use your own configuration, extend an existing configuration
222 and/or add additional packages to your ISO just invent a new class (or extend an
223 existing one). For example if you want to use your own class named "FOOBAR" just
224 extend CLASSES="GRMLBASE,GRML_SMALL,I386" inside /etc/grml/grml-live.conf to
225 CLASSES="GRMLBASE,GRML_SMALL,I386,FOOBAR" or invoke grml-live using the classes
226 option: "grml-live -c GRMLBASE,GRML_SMALL,I386,FOOBAR ...".
227
228 More details regarding the class concept can be found in the documentation of
229 FAI itself (being available at /usr/share/doc/fai-doc/).
230
231 Available classes
232 -----------------
233
234 Documentation to be done...
235
236 Files
237 -----
238
239 Notice that grml-live ships FAI configuration files that do not use the same
240 namespace as the FAI packages itself. This ensures that grml-live does not clash
241 with your usual FAI configuration, so instead of /etc/fai/fai.conf (package
242 fai-client) grml uses /etc/grml/fai/fai.conf instead. For more details see
243 below. To get an idea how another configuration or example files could look like
244 check out /usr/share/doc/fai-doc/examples/simple/ (provided by Debian package
245 fai-doc). Furthermore /usr/share/doc/fai-doc/fai-guide.html/ch-config.html
246 provides documentation regarding configuration possibilities.
247
248   /usr/sbin/grml-live
249
250 Script for the main build process. Requires root permissions for execution.
251
252   /etc/grml/grml-live.conf
253
254 Main configuration file for grml-live. All the important steps can be configured
255 at this stage.
256
257   /etc/grml/fai/fai.conf
258
259 Main configuration file for FAI which specifies where all the configuration
260 files and scripts for FAI/grml-live can be found. By default it is set to
261 FAI_CONFIGDIR=/etc/grml/fai/config, a directory shipped by grml-live
262 out-of-the-box so you shouldn't have to configure anything in this file.
263
264   /etc/grml/fai/make-fai-nfsroot.conf
265
266 This file is used by make-fai-nfsroot(8) only. Usually you don't have to change
267 anything inside this file. If you want to modify NFSROOT though you can adjust
268 it there.
269
270   /etc/grml/fai/NFSROOT
271
272 This file specifies the package list for creating the NFSROOT.
273
274   /etc/grml/fai/apt/sources.list
275
276 This file specifies which mirrors should be used for retreiving the Debian
277 packages used for creating the main chroot (including all the software you would
278 like to see included). If you want to use a local mirror you either have to
279 adjust this file or use the GRML_LIVE_SOURCES variable inside
280 /etc/grml/grml-live.conf which modifies /etc/grml/fai/apt/sources.list
281 on-the-fly then.
282
283   /etc/grml/fai/config/
284
285 The main directory for configuration of FAI/grml-live. More details below.
286
287   /etc/grml/fai/config/class/
288
289 This directory contains files which specify main configuration variables for the
290 FAI classes.
291
292   /etc/grml/fai/config/debconf/
293
294 This directory provides the files for preseeding/configuration of debconf
295 through files.
296
297   /etc/grml/fai/config/hooks/
298
299 This directory provides files for customising the build process through hooks.
300 Hooks are user defined programs or scripts, which are called during the
301 installation process.
302
303   /etc/grml/fai/config/package_config/
304
305 Directory with lists of software packages to be installed or removed.  The
306 different classes describe what should find its way to your ISO.  When running
307 "grml-live -c GRMLBASE,GRML_SMALL,I386 ..." only the configuration of GRMLBASE,
308 GRML_SMALL and and I386 will be taken. If you use 'grml-live -c
309 GRMLBASE,GRML_SMALL,I386,FOOBAR ...' then the files of GRMLBASE, GRML_SMALL,
310 I386 **plus** the files from FOOBAR will be taken. So just create a new class to
311 adjust the package selection according to your needs.  Please notice that the
312 directory GRMLBASE contains a package list defining a minimum but still
313 reasonable package configuration.
314
315   /etc/grml/fai/config/scripts/
316
317 Scripts for customising the ISO within the build process.
318
319   /etc/grml/fai/files/
320
321 This directory provides files used inside the scripts of
322 /etc/grml/fai/config/scripts/*. For a full documentation what happens with the
323 files please refer to the source of the scripts.
324
325   /etc/grml/fai/live-initramfs/
326
327 This directory provides the files used for building the initramfs/initrd via
328 live-initramfs(8).
329
330 Available log files
331 -------------------
332
333 grml-live itself logs to /var/log/grml-live.log. Unless you set ZERO_LOGFILE in
334 /etc/grml/grml-live.conf the output is appended to the file. If you set the
335 ZERO_LOGFILE configuration option the logfile will be truncated on each new
336 invocation of grml-live.
337
338 The FAI part of grml-live logs to /var/log/fai/$HOSTNAME/ - so the
339 default being /var/log/fai/grml/.
340
341 If you are using the grml-live buildd you will find the logs of the grml-live
342 run at /var/log/grml-buildd.stdout and /var/log/grml-buildd.stderr.
343
344 Requirements for the build system
345 ---------------------------------
346
347 * any Debian based system should be sufficient (if not it's a bug, so please
348 send us a bug report then) [a usual link:http://grml.org/grml2hd/[grml2hd]
349 harddisk installation ships all you need]
350
351 * enough free disk space; at least 800MB are required for a minimal grml-live
352 run (\~400MB for the chroot [$CHROOT_OUTPUT], \~150MB for the build target
353 [$BUILD_OUTPUT] and \~150MB for the resulting ISO [$ISO_OUTPUT] plus some
354 temporary files), if you plan to use GRML_FULL you should have at least 4GB of
355 total free disk space
356
357 * fast network access for retreiving the Debian packages used for creating the
358 chroot (check out "local mirror" and "NFSROOT" to workaround this problem as far
359 as possiblbe)
360
361 FAQ
362 ---
363
364 Help, I'm using Debian etch and I don't have FAI version >3.2
365 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
366
367   wget http://www.informatik.uni-koeln.de/fai/download/etch/fai-client_3.2.3_all.deb \
368        http://www.informatik.uni-koeln.de/fai/download/etch/fai-server_3.2.3_all.deb \
369        http://www.informatik.uni-koeln.de/fai/download/etch/fai-doc_3.2.3_all.deb
370   dpkg -i fai-client_3.2.3_all.deb fai-server_3.2.3_all.deb fai-doc_3.2.3_all.deb
371
372 or check out the link:http://www.informatik.uni-koeln.de/fai/[FAI-homepage] for
373 further details.
374
375 I've problems with the build process. How to start debugging?
376 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
377
378 Check out the logs inside /var/log/fai/... If you don't have the time to debug
379 the problem in further detail or don't know how to proceed just send a copy of
380 your config, logs and the commandline with a short problem description to
381 <mika@grml.org>:
382
383   # history | grep grml-live > /etc/grml/grml_live.cmdline
384   # tar zcf grml_live_problem.tar.gz /etc/grml/grml-live.conf \
385             /etc/grml/grml-buildd.conf /var/log/fai /etc/grml/fai
386
387 Can I use my own (local) Debian mirror?
388 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
389
390 Sure. Just adjust the variables GRML_LIVE_SOURCES and FAI_DEBOOTSTRAP (if not
391 already using NFSROOT's base.tgz) inside /etc/grml/grml-live.conf according to
392 your needs. Please don't forget that you should use the grml servers as well
393 (see default configuration) so all the grml packages can be downloaded as well.
394
395 If you want to use a local (for example NFS mount) mirror additionally, just
396 adjust MIRROR_DIRECTORY and MIRROR_SOURCES inside /etc/grml/grml-live.conf as
397 well.
398
399 Unless you specify GRML_LIVE_SOURCES and/or FAI_DEBOOTSTRAP the default from
400 /etc/grml/fai/apt/sources.list and /etc/grml/fai/make-fai-nfsroot.conf will be
401 taken. If you customise the variables in /etc/grml/grml-live.conf then the two
402 files will be adjusted during runtime automatically.
403
404 If MIRROR_DIRECTORY and MIRROR_SOURCES are specified the local mirror will be
405 taken as first entry in the generated sources.list so it's prefered over
406 non-local mirrors. Using a fallback mirror (via providing several mirrors in
407 GRML_LIVE_SOURCES as used by default) is a recommended setting.
408
409 How do I add additional Debian package(s) to my CD/ISO?
410 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
411
412 Just create a new class (using the package_config directory):
413
414   # cat > /etc/grml/fai/config/package_config/MIKA << EOF
415   PACKAGES aptitude
416
417   vim
418   another_name_of_a_debian_package
419   and_another_one
420   EOF
421
422 and specify it when invoking grml-live then:
423
424   # grml-live -c GRMLBASE,GRML_SMALL,I386,MIKA
425
426 I fscked up my grml-live configuration. How do I reset it to the defaults?
427 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
428
429 Notice: this deletes all your grml-live configuration files. If that's really
430 what you are searching for just run:
431
432   rm -rf /etc/grml/fai /etc/grml/grml-live.conf
433   dpkg -i --force-confnew --force-confmiss /path/to/grml-live_..._all.deb
434
435 [NOTE]
436
437 If you don't control your /etc using a version control system (VCS) yet it's a
438 good chance to start using it now. Check out
439 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/]
440 for more details how to maintain /etc using the mercurial VCS.
441
442 How do I create a base.tgz for use as NFSROOT?
443 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
444
445 First of all build the chroot system:
446
447   mkdir /tmp/nfsroot && cd /tmp/nfsroot
448   debootstrap etch /tmp/nfsroot/ http://ftp.de.debian.org/debian
449   tar zcf base.tgz ./
450
451 Then check out where your NFSROOT is located:
452
453   # grep '^NFSROOT' /etc/grml/fai/make-fai-nfsroot.conf
454   NFSROOT=/grml/fai/nfsroot
455
456 So as /grml/fai/nfsroot is your NFSROOT place the file under
457 /grml/fai/nfsroot/live/filesystem.dir/var/tmp/:
458
459   mv base.tgz /grml/fai/nfsroot/live/filesystem.dir/var/tmp/base.tgz
460
461 or even better use /etc/grml/fai/config/basefiles/$CLASSNAME.tar.gz instead.
462 Use I386 as $CLASSNAME for i386 builds and AMD64 for amd64 builds.
463
464 Now running "grml-live ..." will use this file as main system instead of
465 executing debootstrap. Check out the output for the following lines if using
466 NFSROOT:
467
468   [...]
469   Calling task_extrbase
470   Unpacking Debian base archive
471   Extracting /grml/fai/nfsroot/live/filesystem.dir/var/tmp/base.tgz
472   Calling task_mirror
473   [...]
474
475 or if using /etc/grml/fai/config/basefiles/$CLASSNAME.tar.gz for:
476
477   [...]
478   ftar: extracting /etc/grml/fai/config/basefiles///AMD64.tar.gz to
479   /grml-live/grml-live_20071029.22138/grml_chroot//
480   [...]
481
482 Set up apt-cacher for use with grml-live
483 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
484
485 Make sure /etc/grml/grml-live.conf provides according GRML_LIVE_SOURCES and
486 FAI_DEBOOTSTRAP:
487
488   # cat /etc/grml/grml-live.conf
489   [...]
490   GRML_LIVE_SOURCES="
491   deb http://localhost:3142/deb.grml.org grml-stable  main
492   deb http://localhost:3142/deb.grml.org grml-testing main
493   deb http://localhost:3142/ftp.de.debian.org/debian etch main contrib non-free
494   "
495   [...]
496   FAI_DEBOOTSTRAP="etch http://localhost:3142/ftp.de.debian.org/debian etch main contrib non-free"
497
498 Make sure apt-cacher is running (/etc/init.d/apt-cacher restart). That's it.
499 All downloaded files will be cached in /var/cache/apt-cacher/ now.
500
501 Set up approx for use with grml-live
502 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
503
504 Make sure /etc/grml/grml-live.conf provides according GRML_LIVE_SOURCES and
505 FAI_DEBOOTSTRAP:
506
507   # cat /etc/grml/grml-live.conf
508   [...]
509   GRML_LIVE_SOURCES="
510   deb http://localhost:9999/grml            grml-stable  main
511   deb http://localhost:9999/grml            grml-testing main
512   deb http://localhost:9999/debian etch     main contrib non-free
513   "
514   FAI_DEBOOTSTRAP="etch http://localhost:9999/debian"
515
516 Configure approx:
517
518   # cat /etc/approx/approx.conf
519   [...]
520   debian http://ftp.at.debian.org/debian
521   grml   http://deb.grml.org/
522
523 Don't forget to restart approx (/etc/init.d/approx restart). That's it.
524 All downloaded files will be cached in /var/cache/approx now.
525
526 I've a question which isn't answered by this document
527 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
528
529 Don't hesitate to ask on IRC (channel #grml on irc.freenode.org) or just drop me
530 a mail: <mika@grml.org>
531
532 Download / install grml-live as a Debian package
533 ------------------------------------------------
534
535 Debian packages are available through the grml-repository at
536 link:http://deb.grml.org/pool/main/g/grml-live/[deb.grml.org].  If you want to
537 build a Debian package on your own (using for example a specific version or the
538 current development tree), just execute:
539
540   hg clone http://hg.grml.org/grml-live
541   cd grml-live
542   debuild -us -uc
543
544 Source
545 ------
546
547 The source of grml-live is available at
548 link:http://hg.grml.org/grml-live/[http://hg.grml.org/grml-live/]
549
550 TODO list
551 ---------
552
553 Check out link:http://wiki.grml.org/doku.php?id=grml-live[grml-live@grml-wiki]
554 for details.
555
556 Bugs
557 ----
558
559 Please report feedback, link:http://grml.org/bugs/[bugreports] and wishes
560 link:http://grml.org/contact/[to the grml-team]!
561
562 Authors
563 -------
564 Michael Prokop <mika@grml.org>.
565
566 /////////////////////////////////////
567 // vim:ai tw=80 ft=asciidoc expandtab
568 /////////////////////////////////////