Release new version 0.11.4
[grml-autoconfig.git] / doc / grml-autoconfig.1.txt
1 grml-autoconfig(1)
2 ==================
3
4 Name
5 ----
6 grml-autoconfig - main bootup process of a grml system
7
8 Synopsis
9 --------
10 None - it is a framework. See grml-autoconfig(8) for information regarding
11 the interface script.
12
13 Introduction
14 ------------
15
16 By using the config framework, it is possible to customize Grml's startup in a
17 multitude of ways. It allows to:
18
19 - execute one or more scripts on startup
20 - install Debian packages from deb files on startup
21 - unpack configuration on startup
22
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.
27
28 The DCS handling is controlled by a number of boot parameters.
29
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.
34
35 [TIP]
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.
40
41 [IMPORTANT]
42 Starting with Grml release 2009.05 its possible to use root persistency on grml.
43 This means you can store your settings and reuse them on reboot, without having
44 to deal with this config framework. Visit
45 link:http://wiki.grml.org/doku.php?id=persistency[] for further information.
46
47 [[current-versions]]
48 include::grml-autoconfig.current.txt[]
49
50 Permanently adjust boot parameters
51 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52
53 As you probably know you can adjust boot parameters on the bootprompt.  You want
54 to set some boot parameters permanently? That's possible via adding a directory
55 named 'bootparams' to the Grml ISO which has to be located at the root-directory
56 /bootparams/ (note: the directory is known as /lib/live/mount/medium/bootparams/ on a
57 _running_ Grml system then). Place a textfile inside the directory containing
58 the boot parameters which should be appended to default ones (this corresponds
59 to booting without any special parameters).
60
61   mkdir bootparams
62   echo lang=de > bootparams/my_bootparams
63
64 Then burn a multisession CD where directory bootparams is located in the root
65 directory of the CD.
66
67 [NOTE]
68 Not all boot parameters can be used via /bootparams/. This is a limitation of
69 the way the kernel and userspace retrieve boot parameters. Boot parameter
70 regarding the kernel definitely do *NOT* work. Boot parameter related to
71 grml-autoconfig (the main part of the boot process in Grml running in userspace,
72 being all the stuff after startup of udev) are expected to work. Boot parameter
73 related to initrd/initramfs (the part between 'Searching for GRML file' and
74 startup of udev) are *NOT* covered by /bootparams/ as well yet.
75
76 TIP: the application k3b (not available on the live-CD but available through the
77 Debian repositories) provides an easy to use interface for doing the
78 multisession task.
79
80 [[X7]]
81 Usage scenarios
82 ---------------
83
84 Personal configuration files
85 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
86
87 You are a fan of the editor vim? Great. You probably have your own ~/.vimrc and
88 want to use it on the Grml system. You also don't like the default zsh
89 configuration and want to use your own ~/.zshrc?  How to procede? Copy your
90 .vimrc and .zshrc to $HOME of user 'grml'.  Place additional files in
91 $HOME/config. Now create a configuration for your files running:
92
93   save-config -home -configdir
94
95 Now you should have a file named config.tbz containing your configuration files.
96 You can copy the archive to a webserver and restore it via downloading during
97 reboot using the following commandline on bootprompt:
98
99   grml netconfig=server.tld/path/to/config.tbz
100
101 You don't have network access but own a USB device? Copy the file to a USB
102 device and boot with something like:
103
104   grml myconfig=/dev/sda1
105
106 Network configuration
107 ~~~~~~~~~~~~~~~~~~~~~
108
109 You need a specific network setup and want to use your own
110 /etc/network/interfaces by default? Generate the configuration archive running
111 the following command as user root:
112
113   save-config -etc
114
115 Now you should have a file named config.tbz containing your configuration files.
116 If you want to use it with a USB device copy the file to it and boot via
117 using the following command on boot prompt:
118
119   grml myconfig=/dev/sda1
120
121 You do have an existing harddisk installation and want to use its configuration?
122 Let's say the Debian system is located in /dev/sda2. You want to use the
123 directory /etc/network. This directory is activated by default in
124 /etc/grml/partconf so we don't have to do any further work.  We just need to
125 activate it via using the following commandline on bootprompt:
126
127   grml partconf=/dev/sda2
128
129 Automatic installation of debian packages
130 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
131
132 You have a specified debian package named 'foobar.deb' and want to use it with
133 (therefore: install it on) Grml by default? Notice: this feature is useful
134 especially for grml-small (a ~100 MB ISO). If you want to use it with the large
135 version of Grml you might have to overburn the ISO.
136
137 Let's assume you have burned the Grml iso to a CD-RW using a commandline like:
138
139   cdrecord dev=/dev/hdc -v -multi -tao grml_0.5.iso
140
141 Now create a directory named debs and place foobar.deb in it:
142
143   mkdir debs/ && cp foobar.deb debs/
144
145 Notice: This directory will be located in /lib/live/mount/medium after burning the second
146 session.
147
148 Now create the second session containing this directory:
149
150   mkisofs -M grml_0.5.iso -C `cdrecord -msinfo dev=/dev/hdc` -R -o 2nd_session.iso debs
151
152 Finally append the second session to the cd using:
153
154   cdrecord dev=/dev/hdc -v -multi -tao 2nd_session.iso
155
156 TIP: the application k3b (not available on the live CD but available through the
157 Debian repositories) provides an easy to use interface for doing the
158 multisession task.
159
160 Now boot from your new personalized Grml CD using the debs parameter:
161
162   grml debs
163
164 Run your own commands on startup
165 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
166
167 You know that booting with 'grml services=foobar' executes /etc/init.d/foobar
168 when booting Grml. But you want to setup a more complex network configuration,
169 adjust some other stuff and so on on your own? Just write a script named grml.sh
170 which does the job and use own of the mentioned bootparams. Let's say you have
171 placed grml.sh on your usb device (usb stick) then use the following commandline
172 on bootprompt:
173
174   grml myconfig=/dev/sda1
175
176 Or even better: create a device with label GRMLCFG running (adjust /dev/sdX1
177 according to your needs):
178
179   mkfs.ext3 -L GRMLCFG /dev/sdX1  # warning: this destroys all data from /dev/sdX1
180
181 TIP: several filesystems provide the possibility to provide a label.  For
182 example FAT provides this through: 'mkfs.vfat -n GRMLCFG /dev/sda1' (attention:
183 this will destroy data on /dev/sda1 of course!). Take a look at the
184 documentation/manpage of the filesystem you want to use.
185
186 Now place your configuration archive (see save-config and the other usage
187 scenarios) and the script grml.sh on the device. Now you can boot your system
188 without specifying any bootparameters on bootprompt because devices labeled with
189 GRMLCFG are mounted readonly and used by default. If you did not label your
190 device you can use the device anyway using 'grml myconfig=/dev/sdX' (adjust
191 /dev/sdX) on the bootprompt.
192
193 Debug remote systems
194 ~~~~~~~~~~~~~~~~~~~~
195
196 You are responsible for a customer's system in her data center. The system has
197 failed and you need to debug from remote, and the remote hands available in the
198 data center do not have enough knowledge to get Grml booted and configure the
199 network without external help?
200
201 If the hard disk of the system is still available, you hopefully have saved a
202 configuration file with IP address, netmask and default gateway somewhere on
203 that hard disk. Grml can use the information found on a partition. Take a look
204 at the 'partconf' boot parameter.  Usage example: 'grml partconf=/dev/sda2'
205 copies files defined in /etc/grml/partconf from /dev/sda2 to the Grml system. As
206 /etc/network is predefined in /etc/grml/partconf the configuration from
207 /dev/sda2 will be taken.
208
209 Or you use a standard Grml medium and have grml read IP address, netmask and
210 default gateway from another medium like a USB stick. Take a look at the script
211 saveconfig and the boot parameter myconfig.
212
213 Or you put a grml.iso file on your hard disk (maybe in /boot/grml) or on an USB
214 stick, use grub to boot from there and place debs, configuration scripts or Grml
215 configuraton archives alongside the .iso.
216
217 Bugs
218 ----
219 If you find a bug please report it. See link:http://grml.org/bugs/[] for details
220 about how to report bugs.
221
222 See also
223 --------
224 grml-autoconfig(8), restore-config(1), save-config(1)
225
226 Author
227 ------
228 (c) 2005++, Michael Prokop <mika@grml.org>