Write GRUB2 config even if the target is a directory.
[grml2usb.git] / grml2usb.8.txt
1 grml2usb(8)
2 ==========
3
4 Name
5 ----
6 grml2usb - install grml ISO(s) on usb device for booting
7
8 Synopsis
9 --------
10 grml2usb [ options ] <ISO[s]> <device>
11
12 *******************************************************************************
13 Important! The grml team does not take responsibility for loss of any data!
14 *******************************************************************************
15
16 Introduction
17 ------------
18
19 grml2usb installs grml on a given partition of your usb device and makes it
20 bootable. It provides multi-iso support, meaning you can specify several grml
21 ISOs on the command line at once and select the grml flavour you would like to
22 boot on the bootprompt then. Note that the *first* ISO specified on the grml2usb
23 command line will become the default one (that's the one that will boot when
24 just pressing enter on the bootprompt or wait until the boot timeout matches).
25
26 [IMPORTANT]
27 By default a compatible master boot record (MBR) is installed on the device
28 (being for example /dev/sdx when executing 'grml2usb grml.iso /dev/sdx1')
29 and grub is being used as default bootloader. Avoid installation of the
30 default MBR using the --skip-mbr option or if you encounter any problems
31 with the default MBR consider using --syslinux-mbr instead. If bootloader
32 grub doesn't work for you check out the --syslinux option.
33
34 Options
35 -------
36
37 The ISO[s] should be the path to one or multiple grml-ISOs and/or the path to
38 the currently running live-system (being /live/image).
39
40 The device either might be a device name like /dev/sdx1 or a directory. When
41 specifying a device name the device is mounted automatically. When specifying a
42 directory grml2usb is assuming that you did set up a bootloader on your own (or
43 don't need one) and a bootloader won't be installed automatically.
44
45 The following options are supported:
46
47   *\--bootoptions=...*::
48
49 Use specified bootoptions as default.
50
51   *\--bootloader-only*::
52
53 Do *not* copy files but instead just install a bootloader.  Note that the boot
54 addons are copied to /boot/addons at this stage as well.  If you want to skip
55 copying the boot addons consider using the --skip-addons option.
56
57   *\--copy-only*::
58
59 Copy files only but do *not* install a bootloader.
60
61   *\--dry-run*::
62
63 Avoid executing commands, instead show what would be executed.
64 Warning: please notice that the ISO has to be mounted anyway, otherwise
65 identifying the grml flavour would not be possible.
66
67   *\--fat16*::
68
69 Format specified partition with FAT16.
70 **Important:** this will destroy any existing data on the specified partition!
71
72   *\--force*::
73
74 Force any (possible dangerous) actions requiring manual interaction (like --fat16).
75
76   *\--help*::
77
78 Display usage information and exit.
79
80 //////////////////////////////////////////////////////////////////////////
81   *\--initrd=...*::
82
83 Install specified initrd instead of the default. You might want to specify
84 option *--kernel* as well. (Be aware when using multiboot setup.)
85 [Notice: not implemented yet.]
86 //////////////////////////////////////////////////////////////////////////
87
88 //////////////////////////////////////////////////////////////////////////
89   *\--kernel=...*::
90
91 Install specified kernel instead of the default. You might want to specify
92 option *--initrd* as well. (Be aware when using multiboot setup.)
93 [Notice: not implemented yet.]
94 //////////////////////////////////////////////////////////////////////////
95
96   *\--lilo-binary=...*::
97
98 Use specified lilo executable for installing master boot record (MBR) when using
99 the --syslinux-mbr option. By default any system wide (from $PATH) lilo
100 executable is taken.  If there can not be find any lilo executable the
101 statically compiled version of the grml2usb Debian package (see
102 /usr/share/grml2usb/lilo/lilo.static.[amd64|i386]) is taken.
103
104   *\--mbr-menu*::
105
106 Install master boot record (MBR) with integrated boot menu: interactively choose
107 the partition to boot from, with a timeout to load the default partition, or
108 boot from floppy. When NOT using the --mbr-menu option a MBR with LBA and large
109 disc support but without an integrated boot menu is installed (so it's not
110 visible at all but instead directly jumps to the bootloader - being grub or
111 syslinux). Note: This options is available only when using the default MBR and
112 won't have any effect if you're using the --syslinux-mbr option.
113
114   *\--quiet*::
115
116 Do not output anything but just errors on console.
117
118   *\--skip-addons*::
119
120 Do not install /boot/addons/ files (like dos, grub, memdisk,...).
121
122   *\--skip-grub-config*::
123
124 Skip generation of grub configuration files. By default the configuration
125 files for syslinux *and* grub will be written so you've a working configuration
126 file no matter whether you're using grub or syslinux as bootloader.
127
128   *\--skip-mbr*::
129
130 Do not touch/install the master boot record (MBR).
131
132   *\--skip-syslinux-config*::
133
134 Skip generation of syslinux configuration files. By default the configuration
135 files for syslinux *and* grub will be written so you've a working configuration
136 file no matter whether you're using grub or syslinux as bootloader.
137
138   *\--syslinux*::
139
140 Install syslinux bootloader instead of the default (being grub).
141
142   *\--syslinux-mbr*::
143
144 Install syslinux' master boot record (MBR, which is booting from the partition
145 with the "active" flag set) instead of the default one.  If you encounter any
146 problems with the default MBR you can try using the syslinux MBR instead. If
147 that works for you please <<X7,let us know>> so we can adjust our default MBR
148 accordingly.  Note: When using the --syslinux-mbr option lilo is executed before
149 the MBR is installed so the according partitions are set active.
150
151 //////////////////////////////////////////////////////////////////////////
152   *\--squashfs=*::
153
154 Install specified squashfs file instead of the default.
155 [Notice: not implemented yet.]
156 //////////////////////////////////////////////////////////////////////////
157
158 //////////////////////////////////////////////////////////////////////////
159   *\--uninstall*::
160
161 Uninstall grml ISO files.
162 [Notice: not implemented yet.]
163 //////////////////////////////////////////////////////////////////////////
164
165   *-v*, *\--version*::
166
167 Return version and exit.
168
169   *\--verbose*::
170
171 Enable verbose mode.
172
173 Developers Corner
174 -----------------
175
176 Directory layout on usb device
177 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
178
179   boot/ ->
180     |-- addons/
181     |   |-- allinone.img     [grub - all in one image]
182     |   |-- bsd4grml/        [MirBSD]
183     |   |-- balder10.imz     [FreeDOS]
184     |   |-- memdisk          [chainloading helper]
185     |   |-- memtest          [memtest86+]
186     |-- release/
187     |   |-- grml/
188     |   |   |-- linux26      [Kernel]
189     |   |   |-- initrd.gz    [initramfs]
190     |   |-- grml64
191     |   |   |-- linux26      [Kernel]
192     |   |   |-- initrd.gz    [initramfs]
193     |   |-- grml-medium
194     |   |   |-- linux26      [...]
195     |   |   |-- initrd.gz
196     |   |-- grml64-medium
197     |   |   |-- linux26
198     |   |   |-- initrd.gz
199     |   |-- grml-small
200     |   |   |-- linux26
201     |   |   |-- initrd.gz
202     |   `-- grml64-small
203     |       |-- linux26
204     |       |-- initrd.gz
205     |-- grub/
206     |   |-- grml.png         [splash screen for grub2]
207     |   |-- grub.cfg         [configuration file for grub2]
208     |   |-- menu.lst         [configuration file for grub1]
209     |   |-- splash.xpm.gz    [splash screen for grub1]
210     `-- syslinux/
211         |-- boot.msg         [boot splash for syslinux]
212         |-- f1               [screen when pressing f1]
213         |-- f2               [screen when pressing f2]
214         |-- f3               [...]
215         |-- f4
216         |-- f5
217         |-- f6
218         |-- f7
219         |-- f8
220         |-- f9
221         |-- f10
222         |-- logo.16          [graphical part of boot splash]
223         `-- syslinux.cfg     [configuration file for syslinux]
224
225   grml/
226     |-- grml2usb.txt         [not yet implemented]
227     |-- grml-cheatcodes.txt  [list of bootoptions for grml]
228     |-- grml-version.txt     [file containing information about grml-version]
229     |-- LICENSE.txt          [license information]
230     |-- md5sums              [md5sums of original ISO]
231     |-- README.txt           [informational text]
232     `-- web/                 [browser related files]
233         |-- index.html
234         |-- style.css
235         `-- images/
236             |-- button.png
237             |-- favicon.png
238             |-- linux.jpg
239             `-- logo.png
240
241   live/
242     |-- grml/
243     |   |-- filesystem.module    [module specifying which squashfs should be used for grml]
244     |   `-- grml.squashfs        [squashfs file for grml]
245     |-- grml-medium/
246     |   |-- filesystem.module    [module specifying which squashfs should be used for grml-medium]
247     |   `-- grml-medium.squashfs [squashfs file for grml-medium]
248     |-- grml-small/
249     |   |-- filesystem.module    [module specifying which squashfs should be used for grml-medium]
250     |   `-- grml-small.squashfs  [squashfs file for grml-small]
251     `-- ...
252
253 Grabbing the source
254 ~~~~~~~~~~~~~~~~~~~
255
256   % git clone git://git.grml.org/grml2usb.git
257
258 Developers Debugging Hints
259 ~~~~~~~~~~~~~~~~~~~~~~~~~~
260
261 To play with grml2usb you can avoid using a real device via a loopback file
262 setup, like:
263
264   # dd if=/dev/zero of=~/loopback bs=1M count=100 # adjust size to your needs
265   # losetup /dev/loop1 ~/loopback
266
267 Then create according partitions either running for example:
268
269   # echo -en "n\np\n1\n\n\nt\n6\na\n1\n w\n" | fdisk /dev/loop1
270
271 or:
272
273   # parted /dev/loop1 -s "mkpart primary fat16 0 -1s mkfs 1 fat16"
274
275 Finally create a filesystem and execute grml2usb as needed:
276
277   # mkfs.vfat /dev/loop1
278   # grml2usb --bootloader-only /grml/isos/grml-small_2009.05.iso /dev/loop1
279
280 Performance tracing
281 ~~~~~~~~~~~~~~~~~~~
282
283   # blktrace -d /dev/sdx -o - | blkparse -i -
284   # grml2usb grml_2009.05.iso /dev/sdx1
285
286 [[X6]]
287 Troubleshooting and Pitfalls when booting
288 -----------------------------------------
289
290 Here is a list of common error messages from BIOS/bootloader when trying to boot
291 from USB.
292
293 ///////////////////////////////////////////////////////////
294 TODO: better list type for the error message / reason part?
295 See http://www.methods.co.nz/asciidoc/userguide.html
296 ///////////////////////////////////////////////////////////
297
298 [horizontal]
299 *Error message*:: ran out of input data. System halted
300
301 *Reason*:: Everything OK, except for the filesystem used on your usb device. So
302 instead of fat16 you are using for example fat32. Fix: use the appropriate
303 filesystem (fat16 for usb pens usually). The Bootsplash might be displayed, the
304 kernel loads but you very soon get the error message.
305
306 *Error message*:: Invalid operating system
307
308 *Reason*:: the partition layout is not ok. Very probably there's no primary
309   partition (/dev/sdX{1..4}) or none has the flag 'bootable' set.
310
311 *Error message*:: No operating system found.
312
313 *Reason*:: you forgot to set the boot-flag on the partition. Or there really isn't
314 any operating system at all. :)
315
316 *Error message*:: kernel-panic: unable to mount root-fs...
317
318 *Reason*:: Kernel boots but fails to find the root filesystem. The root=
319 argument in your kernel commandline is pointing to the wrong device. Adjust
320 root=..., consider using root=UUID=....
321
322 *Error message*::  Could not find kernel image: ...
323
324 *Reason*:: either a broken isolinux/syslinux version or a broken BIOS. Check out
325 whether the vendor provides a BIOS update or if using bootloader grub instead of
326 isolinux/syslinux fixes the problem.
327
328 Frequently Asked Questions (FAQ)
329 --------------------------------
330
331 [[X5]]
332 Where can I get grml2usb?
333 ~~~~~~~~~~~~~~~~~~~~~~~~~
334
335 grml2usb is available as Debian package via link:http://deb.grml.org/[the
336 grml-testing Debian repository]. Please make sure you really have the Debian
337 package installed as having just the grml2usb script available is definitely
338 *NOT* enough!
339
340 If you do NOT have a Debian based system but still want to be able to use
341 grml2usb you can use the provided
342 link:http://grml.org/grml2usb/grml2usb.tgz[http://grml.org/grml2usb/grml2usb.tgz]
343 (link:http://grml.org/grml2usb/grml2usb.tgz.md5.asc[gpg signed md5 hash]).
344 Download and extract the tarball and execute the provided script 'install.sh'.
345
346 What's the difference between grml2hd and grml2usb?
347 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
348
349 grml2hd installs a running grml system to a harddisk. When rebooting the
350 harddisk installation can be modified and changes will find their way to the
351 harddisk immediately.  grml2usb copies just the compressed chroot filesystem
352 (being the squashfs file), some further informational files and a bootloader to
353 your device. This way you don't need as much space as with a harddisk
354 installation (just a USB device with >=ISO size) and when rebooting the system
355 your changes will be lost (unless you are using the persistency feature, see
356 link:http://wiki.grml.org/doku.php?id=persistency[http://wiki.grml.org/doku.php?id=persistency]).
357 Think of using a better CD version: booting is (usually) faster, you don't need
358 to burn a new CD when a new ISO version arrives (just install the new ISO using
359 grml2usb) and you can carry additional files on a writable medium with yourself.
360
361 Why is there a menu.lst and a grub.cfg inside /boot/grub/?
362 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
363
364 grml2usb supports grub version 1 (grub1) as well as grub version 2 (grub2).
365 Whereas grub1 uses menu.lst the new version grub2 needs grub.cfg.
366 Providing both files allows grml2usb to install grub on the target device
367 no matter which grub version is available on the host where grml2usb is
368 executed on.
369
370 grub-install fails with 'The file ../boot/grub/stage1 not read correctly"?!
371 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
372
373 Check whether the partition has the right partition type. For example do NOT use
374 FAT16 (partition type 6) when using a ext3 filesystem on the partition but
375 instead use the correct partition type ('83' - Linux) then.
376
377 grub-install complains about /sbin/grub-install and/or xfs_freeze?!
378 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
379
380 The following message:
381
382   You shouldn't call /sbin/grub-install. Please call /usr/sbin/grub-install instead!
383   xfs_freeze: specified file ["/tmp/tmpqaBK6z/boot/grub"] is not on an XFS filesystem
384
385 ... is "normal". grub-install sends those messages to stderr. To avoid hiding any
386 possible real error messages grml2usb doesn't ignore those messages.
387
388 grub-install complains about /boot/grub/device.map?!
389 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
390
391 The following message:
392
393   grub-probe: error: Cannot open `/boot/grub/device.map'
394
395 ... is "normal" (at least with grub1). This isn't a problem, because the
396 device.map file will be generated on the target device anyway.
397
398 grub-install complains about a unary operator?!
399 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
400
401 The following message:
402
403   '/usr/sbin/grub-install: line 374: [: =: unary operator expected'
404
405 ... is "normal". Just ignore it.
406
407 I'm getting something like "Error: /usr/share/grml2usb/grub/splash.xpm.gz can not be read"!?
408 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
409
410 Looks like you've only the grml2usb script itself available. Please make sure
411 you've the grml2usb Debian package installed. The most resent stable version is
412 available via link:http://deb.grml.org/[the grml-testing Debian repository].  If
413 you do not have a Debian system please see section <<X5,Where can I get
414 grml2usb?>> in this FAQ.
415
416 Why do I have to use a FAT16 filesystem?
417 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
418
419 You have to use a FAT16 filesystem only if you consider using syslinux. Syslinux
420 (currently) does not support any other filesystems. If you want to use another
421 filesystem (like ext2/3) just don't use syslinux (drop the \--syslinux option)
422 but use the default bootloader (grub) instead.
423
424 I think I've got a really cool idea!
425 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
426
427 Great! Please check out
428 link:http://git.grml.org/?p=grml2usb.git;a=blob;f=TODO;hb=HEAD[the TODO file].
429 Feel free to <<X7,report your wishes to the author>>. Patches highly
430 appreciated.
431
432 I've problems with booting from USB.
433 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
434
435 Check out <<X6,Troubleshooting and Pitfalls when booting>>.
436
437 I've found a bug!
438 ~~~~~~~~~~~~~~~~~
439
440 Please <<X7,report it to the author>>. Please provide usage examples and output
441 of your grml2usb commandline (consider using the "\--verbose" option).
442
443 Usage examples
444 --------------
445
446   # grml2usb /home/grml/grml_2009.05.iso /dev/sdx1
447
448 Install specified ISO on device /dev/sdx1.
449
450   # grml2usb /home/grml/grml_2009.05.iso /home/grml/grml_small_2009.05.iso /dev/sdx1
451
452 Install specified ISOs on device /dev/sdx1 for multibooting ISOs.
453 Note: boot "grml" as usual, for booting grml-small use "grml-small on the
454 bootprompt, for grml64 use "grml64" and so on... The *first* specified ISO is
455 the one being the default (when just pressing enter or waiting until the timeout
456 is reached).
457
458   # grml2usb /live/image /dev/sdx1
459
460 Install currently running grml live system on device /dev/sdx1.
461
462   # grml2usb /live/image /home/grml/grml_2009.05.iso /dev/sdx1
463
464 Install currently running grml live system and the specified
465 ISO on device /dev/sdx1 for multibooting.
466
467   # grml2usb --fat16 /home/grml/grml_2009.05.iso /dev/sdx1
468
469 Install specified ISO on device /dev/sdx1 and format partition /dev/sdx1 with
470 FAT16 filesystem.
471
472   # grml2usb --syslinux /home/grml/grml_2009.05.iso /dev/sdx1
473
474 Install specified ISO on device /dev/sdx1 and use syslinux as bootloader
475 (instead of grub being the default).
476
477 ///////////////////////////////////////////////////////////////////////////////////////
478   # grml2usb --kernel=/boot/vmlinuz-2.6.28-grml --initrd=/boot/initrd.img-2.6.28-grml \
479              /home/grml/grml_2009.05.iso /dev/sdx1
480
481 Install specified ISO on device /dev/sdx1 but use given kernel and initrd
482 instead of the ones provided by the ISO.
483
484   # grml2usb --squashfs=/grml/grml-live/grml_cd/live/grml.squashfs \
485              /home/grml/grml_2009.05.iso /dev/sdx1
486
487 Install specified ISO on device /dev/sdx1 but use given squashfs
488 file instead of the one provided by the ISO.
489 ///////////////////////////////////////////////////////////////////////////////////////
490
491   # grml2usb --bootoptions="lang=de ssh=mysecret" grml_2009.05.iso /dev/sdx1
492
493 Install specified ISO on device /dev/sdx1 and use "lang=de ssh=mysecret" as
494 default bootoptions.
495
496 Online Ressources
497 -----------------
498
499 Check out the link:http://grml.org/grml2usb/[grml2usb webpage] and the
500 link:http://git.grml.org/?p=grml2usb.git[grml2usb git repository].
501
502 Bugs
503 ----
504 Please report feedback, bugreports and wishes <<X7,to the author>>.
505
506 [[X7]]
507 Author
508 ------
509 Michael Prokop <mika@grml.org>
510
511 /////////////////////////////////////////////////////////////////
512 http://wiki.grml.org/doku.php?id=tips#multiboot_usb_pen
513 http://www.startx.ro/sugar/isotostick.sh
514 https://help.ubuntu.com/community/Installation/FromUSBStick
515 http://unetbootin.sourceforge.net/
516 http://www.tux.org/pub/people/kent-robotti/looplinux/rip/mkusb.sh
517 https://fedorahosted.org/liveusb-creator/
518 /////////////////////////////////////////////////////////////////