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
124 Use this parameter to download and run a script from specified
125 destination: Usage example:
127 netcript=server.tld/path/to/script => download and run script/executable from server
131 Extract specific directories from configuration archive. Notice: This
132 bootparam is useful only with bootparams which are able to extract
133 configuration archives.
135 extract=/home/grml => extract only /home/grml from archive
136 extract=/etc => extract only /etc from archive
137 extract=/home/grml/config => extract only $HOME/config from archive
141 This parameter executes a script located in the root-directory /scripts/ on
142 the Grml media/ISO (note: the directory is known as /live/image/scripts/ on
143 a _running_ Grml system then). Usage examples:
145 scripts => run script [/live/image]/scripts/grml.sh
146 scripts=foobar.sh => run script foobar.sh in [/live/image]/scripts/
150 This parameter restores a configuration using root-directory /config/ on the
151 Grml media/ISO (note: the directory is known as /live/image/config on a
152 _running_ Grml system then). Usage examples:
154 config => restore configuration using file config.tbz from directory [/live/image]/config/
155 config=config_foobar.tbz => restore configuration using file config_foobar.tbz from directory [/live/image]/config/
159 This parameter allows automatic installation of deb packages while booting.
160 The debian packages have to be located in the root-directory /debs/ on the
161 Grml media/ISO (note: the directory is known as /live/image/debs/ on a
162 _running_ Grml system then). Usage examples:
164 debs => install all debian packages (suffix .deb) from directory [/live/image]/debs/
165 debs=01 => install all debian packages (suffix .deb) starting with 01 in the filename from directory [/live/image]/debs/
170 Deactivate automounting. By default the command 'mount' tries to mount a
171 device with label 'GRMLCFG'. If you specify the noautoconfig bootparam the
172 automounting will be deactivated.
174 noautoconfig => disables auto mounting of label 'GRMLCFG'
177 Behavior in current Grml versions
178 ---------------------------------
180 This section applies to all Grml versions newer than release 2009.05.
182 The central concept of grml-autoconfig is the DCS directory which holds debs,
183 configuration and scripts which are used during system startup.
185 Determination of DCS directory
186 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
188 The DCS directory defaults to the root directory of the GRML live image. If a
189 file system labeled GRMLCFG is found, the DCS directory is the root directory of
190 that file system. Alternatively, the myconfig boot parameter can be used to
191 directly specify a device which is then taken as DCS directory
192 (myconfig=/dev/sda1, for example).
194 Without any additional boot parameters, the GCA at DCSDIR/config.tbz is
195 automatically unpacked and DCSDIR/scrips/grml.sh is automaitcally executed on
196 system startup. The 'noautoconfig' boot parameter disables this automatic
202 The following boot parameters are supported. Use them at the (isolinux)
203 bootprompt as documented here.
207 This parameter directly sets DCSDIR to the root directory of the specified
208 device. Usage examples:
210 myconfig=/dev/sda1 => read DCS from usb-device
211 myconfig=/dev/fd0 => read DCS from floppy-disk
215 This parameter is for setting a specific partition as home directory. Usage
218 home=/dev/sda3 => use /dev/sda3 as the homepartition
219 home=scan => scan through the available partitions and search
224 This parameter mounts the specified device in read-only mode and tries to
225 copy all files specified in /etc/grml/partconf to the Grml system. This
226 provides the possibility to use the configuration of a harddisk
227 installation. For example using the network configuration (which is
228 specified in /etc/network) is possible using this boot parameter. Usage
231 partconf=/dev/sda2 => try to mount /dev/sda2 and copy files specified
232 in /etc/grml/partconf to the booted Grml system
236 Use this parameter to restore configuration using wget to download a GCA
237 from the specified destination. Usage example:
239 netconfig=server.tld/path/to/config.tbz => restore configuration using wget to download file config.tbz
243 Extract specific directories from the GCA which needs to be specified by
246 extract=/home/grml => extract only /home/grml from archive
247 extract=/etc => extract only /etc from archive
248 extract=/home/grml/config => extract only $HOME/config from archive
252 This parameter executes scripts. If an optional path is given, it is
253 relative to DCSDIR. If it points to a directory, all scripts inside this
254 directory are executed. If the path points to a file, this single file is
255 executed. If no path is given, it defaults to scripts/grml.sh. Usage
258 scripts => run script DCSDIR/scripts/grml.sh
259 scripts=foobar.sh => run script foobar.sh in DCSDIR
260 scripts=foobar => run all scripts inside DCSDIR/foobar directory
264 This parameter restores a configuration using a GCA. If an optional path is
265 given, it is relative to DCSDIR. If no path is given, it defaults to
266 DCSDIR/config.tbz. Usage examples:
268 config => restore configuration using file DCSDIR/config.tbz
269 config=config_foobar.tbz => restore configuration using file DCSDIR/config_foobar.tbz
273 This parameter allows automatic installation of deb packages while booting.
274 The path is relative to DCSDIR, not optional and is a shell wildcard. All
275 Files matching the wildcard are installed in a single dpkg --install call.
276 For backwards compatibility, if no slash is contained in the path, it is
277 taken relative to DCSDIR/debs.
281 debs=*.deb => install all debian packages (suffix .deb) from directory DCSDIR/debs/
282 debs=foo/01*.deb => install all debian packages (suffix .deb) starting with 01 in the filename from directory DCSDIR/foo
287 Deactivate automounting. By default the scripts try to mount a device with
288 label 'GRMLCFG'. If you specify the noautoconfig bootparam this automounting
291 noautoconfig => disables auto mounting of label 'GRMLCFG'
294 Permanently adjust boot parameters
295 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
297 As you probably know you can adjust boot parameters on the bootprompt. You want
298 to set some boot parameters permanently? That's possible via adding a directory
299 named 'bootparams' to the Grml ISO which has to be located at the root-directory
300 /bootparams/ (note: the directory is known as /live/image/bootparams/ on a
301 _running_ Grml system then). Place a textfile inside the directory containing
302 the boot parameters which should be appended to default ones (this corresponds
303 to booting without any special parameters).
306 echo lang=de > bootparams/my_bootparams
308 Then burn a multisession CD where directory bootparams is located in the root
312 Not all boot parameters can be used via /bootparams/. This is a limitation of
313 the way the kernel and userspace retrieve boot parameters. Boot parameter
314 regarding the kernel definitely do *NOT* work. Boot parameter related to
315 grml-autoconfig (the main part of the boot process in Grml running in userspace,
316 being all the stuff after startup of udev) are expected to work. Boot parameter
317 related to initrd/initramfs (the part between 'Searching for GRML file' and
318 startup of udev) are *NOT* covered by /bootparams/ as well yet.
320 TIP: the application k3b (not available on the live-CD but available through the
321 Debian repositories) provides an easy to use interface for doing the
328 Personal configuration files
329 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
331 You are a fan of the editor vim? Great. You probably have your own ~/.vimrc and
332 want to use it on the Grml system. You also don't like the default zsh
333 configuration and want to use your own ~/.zshrc? How to procede? Copy your
334 .vimrc and .zshrc to $HOME of user 'grml'. Place additional files in
335 $HOME/config. Now create a configuration for your files running:
337 save-config -home -configdir
339 Now you should have a file named config.tbz containing your configuration files.
340 You can copy the archive to a webserver and restore it via downloading during
341 reboot using the following commandline on bootprompt:
343 grml netconfig=server.tld/path/to/config.tbz
345 You don't have network access but own a floppy drive? Copy the file to a floppy
348 grml myconfig=/dev/fd0
350 Floppy is to small or to slow? Ok, let's use a usb device:
352 grml myconfig=/dev/sda1
354 Network configuration
355 ~~~~~~~~~~~~~~~~~~~~~
357 You need a specific network setup and want to use your own
358 /etc/network/interfaces by default? Generate the configuration archive running
359 the following command as user root:
363 Now you should have a file named config.tbz containing your configuration files.
364 If you want to use it with a floppy disk copy the file to a floppy and boot via
365 using the following command on bootprompt:
367 grml myconfig=/dev/fd0
369 Floppy is to small or to slow? Ok, let's use a usb device:
371 grml myconfig=/dev/sda1
373 You do have an existing harddisk installation and want to use its configuration?
374 Let's say the debian system is located in /dev/sda2. You want to use the
375 directory /etc/network. This directory is activated by default in
376 /etc/grml/partconf so we don't have to do any further work. We just need to
377 activate it via using the following commandline on bootprompt:
379 grml partconf=/dev/sda2
381 Automatic installation of debian packages
382 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
384 You have a specified debian package named 'foobar.deb' and want to use it with
385 (therefore: install it on) Grml by default? Notice: this feature is useful
386 especially for grml-small (a ~100 MB ISO). If you want to use it with the large
387 version of Grml you might have to overburn the ISO.
389 Let's assume you have burned the Grml iso to a CD-RW using a commandline like:
391 cdrecord dev=/dev/hdc -v -multi -tao grml_0.5.iso
393 Now create a directory named debs and place foobar.deb in it:
395 mkdir debs/ && cp foobar.deb debs/
397 Notice: This directory will be located in /live/image after burning the second
400 Now create the second session containing this directory:
402 mkisofs -M grml_0.5.iso -C `cdrecord -msinfo dev=/dev/hdc` -R -o 2nd_session.iso debs
404 Finally append the second session to the cd using:
406 cdrecord dev=/dev/hdc -v -multi -tao 2nd_session.iso
408 TIP: the application k3b (not available on the live CD but available through the
409 Debian repositories) provides an easy to use interface for doing the
412 Now boot from your new personalized Grml CD using the debs parameter:
416 Run your own commands on startup
417 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
419 You know that booting with 'grml service=foobar' executes /etc/init.d/foobar
420 when booting Grml. But you want to setup a more complex network configuration,
421 adjust some other stuff and so on on your own? Just write a script named grml.sh
422 which does the job and use own of the mentioned bootparams. Let's say you have
423 placed grml.sh on your usb device (usb stick) then use the following commandline
426 grml myconfig=/dev/sda1
428 Or even better: create a floppy disk with label GRMLCFG running:
430 fdformat /dev/fd0 # format the floppy disk if not done already
431 mkfs.ext2 -L GRMLCFG /dev/fd0 # now create ext2 filesystem with label GRMLCFG on it:
433 TIP: several filesystems provide the possibility to provide a label. For
434 example FAT provides this through: 'mkfs.vfat -n GRMLCFG /dev/sda1' (attention:
435 this will destroy data on /dev/sda1 of course!). Take a look at the
436 documentation/manpage of the filesystem you want to use.
438 Now place your configuration archive (see save-config and the other usage
439 scenarios) and the script grml.sh on the floppy disk. Now you can boot your
440 system without specifying any bootparameters on bootprompt because devices
441 labeled with GRMLCFG are mounted readonly and used by default. If you did not
442 label your device you can use the device anyway using 'grml myconfig=/dev/ice'
448 You are responsible for a customer's system in her data center. The system has
449 failed and you need to debug from remote, and the remote hands available in the
450 data center do not have enough knowledge to get Grml booted and configure the
451 network without external help?
453 If the hard disk of the system is still available, you hopefully have saved a
454 configuration file with IP address, netmask and default gateway somewhere on
455 that hard disk. Grml can use the information found on a partition. Take a look
456 at the 'partconf' boot parameter. Usage example: 'grml partconf=/dev/sda2'
457 copies files defined in /etc/grml/partconf from /dev/sda2 to the Grml system. As
458 /etc/network is predefined in /etc/grml/partconf the configuration from
459 /dev/sda2 will be taken.
461 Or you use a standard Grml medium and have grml read IP address, netmask and
462 default gateway from another medium like a floppy or an USB stick. Take a look
463 at the script saveconfig and the boot parameter myconfig.
465 Or you put a grml.iso file on your hard disk (maybe in /boot/grml) or on an USB
466 stick, use grub to boot from there and place debs, configuration scripts or Grml
467 configuraton archives alongside the .iso.
469 Use persistent home directory
470 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
472 You want to use a persistent home directory which includes all the files located
473 in $HOME. Use the script mkpersistenthome to create such a persistent home
474 directory. You have the options to either use a specific partition as your home
475 directory or add a loopback file named grml.img on the specified partition (the
478 TIP: /dev/external in the partition selection of mkpersistenthome is an usb
479 device without partitions. /dev/external1 corresponds to the first partition on
480 an usb device (usually an usb stick).
482 After running the script mkpersistenthome you can use the boot parameter home to
483 activate the home directory. If you are using the option with the loopback file
484 (grml.img) you can boot via:
488 which will scan through the partitions and if a file grml.img is found it will
489 be mounted as your $HOME-directory. If you want to use a partition as your home
490 directory specify the device as an option. If you want to use /dev/sda2 as your
495 Notice: the files located in /etc/skel will be copied to the partition (but will
496 not overwrite any files).
500 If you find a bug please report it. See link:http://grml.org/bugs/ for details
501 about how to report bugs.
505 grml-autoconfig(8), mkpersistenthome(1), restore-config(1), save-config(1)
509 (c) 2005++, Michael Prokop <mika@grml.org>