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