6 grml-autoconfig - main bootup process of a grml system
10 None - it is a framework. See grml-autoconfig(8) for information regarding
16 By using the config framework, it is possible to customize Grml's startup in a
17 multitude of ways. It allows to:
19 - execute one or more scripts on startup
20 - install Debian packages from deb files on startup
21 - unpack configuration on startup
23 The combination of Debs, Configuration and Scripts is called DCS in Grml. DCS
24 can be read from the Live Image itself, from an arbitrary file system on the
25 local system which is marked with the volume label GRMLCFG, or from the file
26 system pointed to by the myconfig boot parameter.
28 The DCS handling is controlled by a number of boot parameters.
30 The scripts save-config and restore-config can be used to create and handle
31 files called 'grml configuration archive', abbreviated GCA. save-config stores
32 the running configuration inside a GCA; restore-config is a script to restore a
33 configuration from a GCA.
36 A GCA is a plain bzip2 compressed tar archive. All the files are generated
37 starting from the root-directory '/' so it is easy to handle. You can generate
38 configuration archives manually as well. save-config is just a frontend which
39 should make it easier to use.
41 The grml-autoconfig code has been re-worked in August 2009. This document
42 handles both the behavior of Grml releases up to 2009.05 (see
43 <<up-to-200905,section 'Behavior up to grml 2009.05'>>) and the current behavior
44 (see <<current-versions,section 'Behavior in current Grml versions'>>). Great
45 care has been taken to provide maximum backwards compatibility during the
49 Starting with grml release 2009.05 its possible to use root persistency on grml.
50 This means you can store your settings and reuse them on reboot, without having
51 to deal with this config framework. Visit
52 link:http://wiki.grml.org/doku.php?id=persistency for further information.
55 Behavior up to grml 2009.05
56 ---------------------------
58 This section applies to all Grml versions older than and including release 2009.05.
63 By default the booting process tries to mount a device labeled 'GRMLCFG'. This
64 provides the possibility to restore a configuration (named config.tbz) and
65 execute a script (named grml.sh) without the need to specify any bootparams. If
66 you want to disable this feature please take a look at the 'noautoconfig'
72 As you probably know you can adjust boot parameters on the bootprompt. You want
73 to set some boot parameters permanently? That's possible via adding a directory
74 named 'bootparams' to the Grml-ISO which has to be located at the root-directory
75 /bootparams/ (note: the directory is known as /live/image/bootparams/ on a
76 _running_ grml system then). Place a textfile inside the directory containing
77 the boot parameters which should be appended to default ones (this corresponds
78 to booting without any special parameters). If you want to be able to boot from
79 your Grml-CD you have to create a multisession CD. See the <<X7,usage
80 scenarios>> for more details how to use it or consider booting from a USB device
83 The following boot parameters are supported. Use them at the (isolinux)
84 bootprompt as documented here.
88 This parameter is for restoring configuration using the file config.tbz
89 on the specified device. Usage examples:
91 myconfig=/dev/sda1 => use file config.tbz from usb-device
92 myconfig=/dev/fd0 => use file config.tbz from floppy-disk
93 myconfig=/dev/sda1 file=config_foobar.tbz => use file config_foobar.tbz from usb-device
97 This parameter is for setting a specific partition as home directory.
100 home=/dev/sda3 => use /dev/sda3 as the homepartition
101 home=scan => scan through the available partitions and search
106 This parameter mounts the specified device in read-only mode and tries to
107 copy all files specified in /etc/grml/partconf to the Grml system. This
108 provides the possibility to use the configuration of a harddisk
109 installation. For example using the network configuration (which is
110 specified in /etc/network) is possible using this boot parameter. Usage
113 partconf=/dev/sda2 => try to mount /dev/sda2 and copy files specified
114 in /etc/grml/partconf to the booted Grml system
118 Use this parameter to restore configuration using wget to download a
119 configuration file from specified destination. Usage example:
121 netconfig=server.tld/path/to/config.tbz => restore configuration using wget to download file config.tbz
125 Extract specific directories from configuration archive. Notice: This
126 bootparam is useful only with bootparams which are able to extract
127 configuration archives.
129 extract=/home/grml => extract only /home/grml from archive
130 extract=/etc => extract only /etc from archive
131 extract=/home/grml/config => extract only $HOME/config from archive
135 This parameter executes a script located in the root-directory /scripts/ on
136 the Grml media/ISO (note: the directory is known as /live/image/scripts/ on
137 a _running_ Grml system then). Usage examples:
139 scripts => run script [/live/image]/scripts/grml.sh
140 scripts=foobar.sh => run script foobar.sh in [/live/image]/scripts/
144 This parameter restores a configuration using root-directory /config/ on the
145 Grml media/ISO (note: the directory is known as /live/image/config on a
146 _running_ Grml system then). Usage examples:
148 config => restore configuration using file config.tbz from directory [/live/image]/config/
149 config=config_foobar.tbz => restore configuration using file config_foobar.tbz from directory [/live/image]/config/
153 This parameter allows automatic installation of deb packages while booting.
154 The debian packages have to be located in the root-directory /debs/ on the
155 Grml media/ISO (note: the directory is known as /live/image/debs/ on a
156 _running_ Grml system then). Usage examples:
158 debs => install all debian packages (suffix .deb) from directory [/live/image]/debs/
159 debs=01 => install all debian packages (suffix .deb) starting with 01 in the filename from directory [/live/image]/debs/
164 Deactivate automounting. By default the command 'mount' tries to mount a
165 device with label 'GRMLCFG'. If you specify the noautoconfig bootparam the
166 automounting will be deactivated.
168 noautoconfig => disables auto mounting of label 'GRMLCFG'
171 Behavior in current Grml versions
172 ---------------------------------
174 This section applies to all Grml versions newer than release 2009.05.
176 The central concept of grml-autoconfig is the DCS directory which holds debs,
177 configuration and scripts which are used during system startup.
179 Determination of DCS directory
180 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
182 The DCS directory defaults to the root directory of the GRML live image. If a
183 file system labeled GRMLCFG is found, the DCS directory is the root directory of
184 that file system. Alternatively, the myconfig boot parameter can be used to
185 directly specify a device which is then taken as DCS directory
186 (myconfig=/dev/sda1, for example).
188 Without any additional boot parameters, the GCA at DCSDIR/config.tbz is
189 automatically unpacked and DCSDIR/scrips/grml.sh is automaitcally executed on
190 system startup. The 'noautoconfig' boot parameter disables this automatic
196 The following boot parameters are supported. Use them at the (isolinux)
197 bootprompt as documented here.
201 This parameter directly sets DCSDIR to the root directory of the specified
202 device. Usage examples:
204 myconfig=/dev/sda1 => read DCS from usb-device
205 myconfig=/dev/fd0 => read DCS from floppy-disk
209 This parameter is for setting a specific partition as home directory. Usage
212 home=/dev/sda3 => use /dev/sda3 as the homepartition
213 home=scan => scan through the available partitions and search
218 This parameter mounts the specified device in read-only mode and tries to
219 copy all files specified in /etc/grml/partconf to the Grml system. This
220 provides the possibility to use the configuration of a harddisk
221 installation. For example using the network configuration (which is
222 specified in /etc/network) is possible using this boot parameter. Usage
225 partconf=/dev/sda2 => try to mount /dev/sda2 and copy files specified
226 in /etc/grml/partconf to the booted Grml system
230 Use this parameter to restore configuration using wget to download a GCA
231 from the specified destination. Usage example:
233 netconfig=server.tld/path/to/config.tbz => restore configuration using wget to download file config.tbz
237 Extract specific directories from the GCA which needs to be specified by
240 extract=/home/grml => extract only /home/grml from archive
241 extract=/etc => extract only /etc from archive
242 extract=/home/grml/config => extract only $HOME/config from archive
246 This parameter executes scripts. If an optional path is given, it is
247 relative to DCSDIR. If it points to a directory, all scripts inside this
248 directory are executed. If the path points to a file, this single file is
249 executed. If no path is given, it defaults to scripts/grml.sh. Usage
252 scripts => run script DCSDIR/scripts/grml.sh
253 scripts=foobar.sh => run script foobar.sh in DCSDIR
254 scripts=foobar => run all scripts inside DCSDIR/foobar directory
258 This parameter restores a configuration using a GCA. If an optional path is
259 given, it is relative to DCSDIR. If no path is given, it defaults to
260 DCSDIR/config.tbz. Usage examples:
262 config => restore configuration using file DCSDIR/config.tbz
263 config=config_foobar.tbz => restore configuration using file DCSDIR/config_foobar.tbz
267 This parameter allows automatic installation of deb packages while booting.
268 The path is relative to DCSDIR, not optional and is a shell wildcard. All
269 Files matching the wildcard are installed in a single dpkg --install call.
270 For backwards compatibility, if no slash is contained in the path, it is
271 taken relative to DCSDIR/debs.
275 debs=*.deb => install all debian packages (suffix .deb) from directory DCSDIR/debs/
276 debs=foo/01*.deb => install all debian packages (suffix .deb) starting with 01 in the filename from directory DCSDIR/foo
281 Deactivate automounting. By default the scripts try to mount a device with
282 label 'GRMLCFG'. If you specify the noautoconfig bootparam this automounting
285 noautoconfig => disables auto mounting of label 'GRMLCFG'
288 Permanently adjust boot parameters
289 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
291 As you probably know you can adjust boot parameters on the bootprompt. You want
292 to set some boot parameters permanently? That's possible via adding a directory
293 named 'bootparams' to the Grml ISO which has to be located at the root-directory
294 /bootparams/ (note: the directory is known as /live/image/bootparams/ on a
295 _running_ Grml system then). Place a textfile inside the directory containing
296 the boot parameters which should be appended to default ones (this corresponds
297 to booting without any special parameters).
300 echo lang=de > bootparams/my_bootparams
302 Then burn a multisession CD where directory bootparams is located in the root
306 Not all boot parameters can be used via /bootparams/. This is a limitation of
307 the way the kernel and userspace retrieve boot parameters. Boot parameter
308 regarding the kernel definitely do *NOT* work. Boot parameter related to
309 grml-autoconfig (the main part of the boot process in Grml running in userspace,
310 being all the stuff after startup of udev) are expected to work. Boot parameter
311 related to initrd/initramfs (the part between 'Searching for GRML file' and
312 startup of udev) are *NOT* covered by /bootparams/ as well yet.
314 TIP: the application k3b (not available on the live-CD but available through the
315 Debian repositories) provides an easy to use interface for doing the
322 Personal configuration files
323 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
325 You are a fan of the editor vim? Great. You probably have your own ~/.vimrc and
326 want to use it on the Grml system. You also don't like the default zsh
327 configuration and want to use your own ~/.zshrc? How to procede? Copy your
328 .vimrc and .zshrc to $HOME of user 'grml'. Place additional files in
329 $HOME/config. Now create a configuration for your files running:
331 save-config -home -configdir
333 Now you should have a file named config.tbz containing your configuration files.
334 You can copy the archive to a webserver and restore it via downloading during
335 reboot using the following commandline on bootprompt:
337 grml netconfig=server.tld/path/to/config.tbz
339 You don't have network access but own a floppy drive? Copy the file to a floppy
342 grml myconfig=/dev/fd0
344 Floppy is to small or to slow? Ok, let's use a usb device:
346 grml myconfig=/dev/sda1
348 Network configuration
349 ~~~~~~~~~~~~~~~~~~~~~
351 You need a specific network setup and want to use your own
352 /etc/network/interfaces by default? Generate the configuration archive running
353 the following command as user root:
357 Now you should have a file named config.tbz containing your configuration files.
358 If you want to use it with a floppy disk copy the file to a floppy and boot via
359 using the following command on bootprompt:
361 grml myconfig=/dev/fd0
363 Floppy is to small or to slow? Ok, let's use a usb device:
365 grml myconfig=/dev/sda1
367 You do have an existing harddisk installation and want to use its configuration?
368 Let's say the debian system is located in /dev/sda2. You want to use the
369 directory /etc/network. This directory is activated by default in
370 /etc/grml/partconf so we don't have to do any further work. We just need to
371 activate it via using the following commandline on bootprompt:
373 grml partconf=/dev/sda2
375 Automatic installation of debian packages
376 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
378 You have a specified debian package named 'foobar.deb' and want to use it with
379 (therefore: install it on) Grml by default? Notice: this feature is useful
380 especially for grml-small (a ~100 MB ISO). If you want to use it with the large
381 version of Grml you might have to overburn the ISO.
383 Let's assume you have burned the Grml iso to a CD-RW using a commandline like:
385 cdrecord dev=/dev/hdc -v -multi -tao grml_0.5.iso
387 Now create a directory named debs and place foobar.deb in it:
389 mkdir debs/ && cp foobar.deb debs/
391 Notice: This directory will be located in /live/image after burning the second
394 Now create the second session containing this directory:
396 mkisofs -M grml_0.5.iso -C `cdrecord -msinfo dev=/dev/hdc` -R -o 2nd_session.iso debs
398 Finally append the second session to the cd using:
400 cdrecord dev=/dev/hdc -v -multi -tao 2nd_session.iso
402 TIP: the application k3b (not available on the live CD but available through the
403 Debian repositories) provides an easy to use interface for doing the
406 Now boot from your new personalized Grml CD using the debs parameter:
410 Run your own commands on startup
411 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
413 You know that booting with 'grml service=foobar' executes /etc/init.d/foobar
414 when booting Grml. But you want to setup a more complex network configuration,
415 adjust some other stuff and so on on your own? Just write a script named grml.sh
416 which does the job and use own of the mentioned bootparams. Let's say you have
417 placed grml.sh on your usb device (usb stick) then use the following commandline
420 grml myconfig=/dev/sda1
422 Or even better: create a floppy disk with label GRMLCFG running:
424 fdformat /dev/fd0 # format the floppy disk if not done already
425 mkfs.ext2 -L GRMLCFG /dev/fd0 # now create ext2 filesystem with label GRMLCFG on it:
427 TIP: several filesystems provide the possibility to provide a label. For
428 example FAT provides this through: 'mkfs.vfat -n GRMLCFG /dev/sda1' (attention:
429 this will destroy data on /dev/sda1 of course!). Take a look at the
430 documentation/manpage of the filesystem you want to use.
432 Now place your configuration archive (see save-config and the other usage
433 scenarios) and the script grml.sh on the floppy disk. Now you can boot your
434 system without specifying any bootparameters on bootprompt because devices
435 labeled with GRMLCFG are mounted readonly and used by default. If you did not
436 label your device you can use the device anyway using 'grml myconfig=/dev/ice'
442 You are responsible for a customer's system in her data center. The system has
443 failed and you need to debug from remote, and the remote hands available in the
444 data center do not have enough knowledge to get Grml booted and configure the
445 network without external help?
447 If the hard disk of the system is still available, you hopefully have saved a
448 configuration file with IP address, netmask and default gateway somewhere on
449 that hard disk. Grml can use the information found on a partition. Take a look
450 at the 'partconf' boot parameter. Usage example: 'grml partconf=/dev/sda2'
451 copies files defined in /etc/grml/partconf from /dev/sda2 to the Grml system. As
452 /etc/network is predefined in /etc/grml/partconf the configuration from
453 /dev/sda2 will be taken.
455 Or you use a standard Grml medium and have grml read IP address, netmask and
456 default gateway from another medium like a floppy or an USB stick. Take a look
457 at the script saveconfig and the boot parameter myconfig.
459 Or you put a grml.iso file on your hard disk (maybe in /boot/grml) or on an USB
460 stick, use grub to boot from there and place debs, configuration scripts or Grml
461 configuraton archives alongside the .iso.
463 Use persistent home directory
464 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
466 You want to use a persistent home directory which includes all the files located
467 in $HOME. Use the script mkpersistenthome to create such a persistent home
468 directory. You have the options to either use a specific partition as your home
469 directory or add a loopback file named grml.img on the specified partition (the
472 TIP: /dev/external in the partition selection of mkpersistenthome is an usb
473 device without partitions. /dev/external1 corresponds to the first partition on
474 an usb device (usually an usb stick).
476 After running the script mkpersistenthome you can use the boot parameter home to
477 activate the home directory. If you are using the option with the loopback file
478 (grml.img) you can boot via:
482 which will scan through the partitions and if a file grml.img is found it will
483 be mounted as your $HOME-directory. If you want to use a partition as your home
484 directory specify the device as an option. If you want to use /dev/sda2 as your
489 Notice: the files located in /etc/skel will be copied to the partition (but will
490 not overwrite any files).
494 If you find a bug please report it. See link:http://grml.org/bugs/ for details
495 about how to report bugs.
499 grml-autoconfig(8), mkpersistenthome(1), restore-config(1), save-config(1)
503 (c) 2005++, Michael Prokop <mika@grml.org>