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