From: Michael Prokop Date: Mon, 2 Mar 2009 14:29:20 +0000 (+0100) Subject: Make grub the default bootloader, add support for bsd4grml, update docs X-Git-Tag: v0.9.2~24 X-Git-Url: http://git.grml.org/?p=grml2usb.git;a=commitdiff_plain;h=a77a833735d806dada52650aaf0d885fe7abdbf0 Make grub the default bootloader, add support for bsd4grml, update docs --- diff --git a/TODO b/TODO index eccc129..b6b870f 100644 --- a/TODO +++ b/TODO @@ -1,12 +1,12 @@ TODOs ----- -* implement missing options (--grub, --kernel, --initrd, --squashfs, --uninstall) -* validate partition schema/layout: is the partition schema ok and the bootable flag set? (--validate?) -* provide --create-partition option? -* provide --verify to check md5sums of files on usb device -* implement logic for storing information about copied files (register every file in a set()?) -* the last line in bootsplash (boot.msg) should mention all installed grml flavours +* implement missing options (--kernel, --initrd, --squashfs, --uninstall) +* provide --create-partition[s] option +* provide --verify to check md5sums/sha1sums of files on usb device +* validate partition schema/layout: is the partition schema ok and the bootable flag set? (--validate) +* implement logic for storing information about copied files (register every file in a set()) +* the last line in bootsplash (boot.msg) of syslinux should mention all installed grml flavours (attention, the line should become too long :)) * code improvements: - improve error handling wherever possible :) => especially disk full, any other known test cases? diff --git a/debian/changelog b/debian/changelog index d57600a..3e843a6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,11 +5,12 @@ grml2usb (0.9.2) UNRELEASED; urgency=low directly invoke "grml2usb /path/to/iso /dev/sdb1" - initial multi-iso / multi-boot support [Closes: issue501] [Closes: issue584] - - provide *several* new options like --mbr, --bootoptions=... + - provide *several* new options like --bootloader-only, --bootoptions=... check out the manpage for all the glory details! - get rid of "polution" of root directory on usb-pen [Closes: issue466] - - always write a default MBR [Closes: issue295] + - always write a default MBR (thanks a lot to the work + and help of Thorsten Glaser!) [Closes: issue295] - fix regressions for temporary mountpoints / wrong directories [Closes: issue603] [Closes: issue602] * Update debian stuff: @@ -19,7 +20,7 @@ grml2usb (0.9.2) UNRELEASED; urgency=low - drop mtools from depends - slightly improve long description - -- Michael Prokop Sat, 28 Feb 2009 17:20:47 +0100 + -- Michael Prokop Mon, 02 Mar 2009 14:58:12 +0100 grml2usb (0.9.1) unstable; urgency=low diff --git a/doc/mbr.8.txt b/doc/mbr.8.txt index 63c9fba..4460b04 100644 --- a/doc/mbr.8.txt +++ b/doc/mbr.8.txt @@ -90,44 +90,6 @@ Write new, clean MBR: lilo -M /dev/sdz -s /dev/null -Troubleshooting and Pitfalls when booting ------------------------------------------ - -/////////////////////////////////////////////////////////// -TODO: better list type for the error message / reason part? -See http://www.methods.co.nz/asciidoc/userguide.html -/////////////////////////////////////////////////////////// - -[horizontal] -*Error message*:: ran out of input data. System halted - -*Reason*:: Everything OK, except for the filesystem used on your usb device. So -instead of fat16 you use for example fat32. Fix: use the appropriate filesystem -(fat16 for usb pens usually). The Bootsplash might be displayed, the kernel -loads but you very soon get the error message. - -*Error message*:: Invalid operating system - -*Reason*:: the partition layout is not ok. Very probably there’s no primary - partition or none has the flag ‘bootable’ set. - -*Error message*:: No operating system found. - -*Reason*:: you forgot to set the boot-flag on the partition. Or there really isn't -any operating system at all. - -*Error message*:: kernel-panic: unable to mount root-fs... - -*Reason*:: Kernel boots but fails to find the root filesystem. root= argument in -your kernel commandline is pointing to the wrong device. Adjust root=..., -consider using root=UUID=.... - -*Error message*:: Could not find kernel image: ... - -*Reason*:: either a broken isolinux/syslinux version or a broken BIOS. Check out -whether the vendor provides a BIOS update or if using bootloader grub instead of -isolinux/syslinux fixes the problem. - USB modes --------- diff --git a/grml2usb b/grml2usb index 31da2ca..2f9fb87 100755 --- a/grml2usb +++ b/grml2usb @@ -46,22 +46,22 @@ parser.add_option("--fat16", dest="fat16", action="store_true", help="format specified partition with FAT16") parser.add_option("--force", dest="force", action="store_true", help="force any actions requiring manual interaction") -parser.add_option("--grub", dest="grub", action="store_true", - help="install grub bootloader instead of syslinux") parser.add_option("--initrd", dest="initrd", action="store", type="string", help="install specified initrd instead of the default [TODO]") parser.add_option("--kernel", dest="kernel", action="store", type="string", help="install specified kernel instead of the default [TODO]") -parser.add_option("--lilo", dest="lilo", action="store", type="string", +parser.add_option("--lilo-binary", dest="lilobin", action="store", type="string", help="lilo executable to be used for installing MBR") parser.add_option("--mbr-manager", dest="mbrmgr", action="store_true", - help="enable boot manager menu in MBR") + help="enable interactive boot manager menu in MBR") parser.add_option("--quiet", dest="quiet", action="store_true", help="do not output anything but just errors on console") parser.add_option("--skip-addons", dest="skipaddons", action="store_true", help="do not install /boot/addons/ files") parser.add_option("--skip-mbr", dest="skipmbr", action="store_true", help="do not install a master boot record (MBR) on the device") +parser.add_option("--syslinux", dest="syslinux", action="store_true", + help="install syslinux bootloader instead of grub") parser.add_option("--syslinux-mbr", dest="syslinuxmbr", action="store_true", help="install syslinux master boot record (MBR) instead of default") parser.add_option("--squashfs", dest="squashfs", action="store", type="string", @@ -272,6 +272,11 @@ menuentry "FreeDOS" { initrd /boot/addons/balder10.imz } +menuentry "MirBSD" { + set root=(hd0,%(install_partition)s) + linux /boot/addons/bsd4grml/ldbsd.com +} + menuentry "Boot OS of first partition on first disk" { set root=(hd0,1) chainloader +1 @@ -423,6 +428,20 @@ title %(grml_flavour)s - Default boot (using 1024x768 framebuffer) kernel (hd0,%(install_partition)s)/boot/release/%(grml_flavour)s/linux26 apm=power-off lang=us vga=791 quiet boot=live nomce module=%(grml_flavour)s initrd (hd0,%(install_partition)s)/boot/release/%(grml_flavour)s/initrd.gz +title Memory test (memtest86+) +kernel (hd0,%(install_partition)s)/boot/addons/memtest + +title Grub - all in one image +kernel (hd0,%(install_partition)s)/boot/addons/memdisk +initrd (hd0,%(install_partition)s)/boot/addons/allinone.img + +title FreeDOS +kernel (hd0,%(install_partition)s)/boot/addons/memdisk +initrd (hd0,%(install_partition)s)/boot/addons/balder10.imz + +title MirBSD +kernel (hd0,%(install_partition)s)/boot/addons/bsd4grml/ldbsd.com + """ % {'grml_flavour': grml_flavour, 'local_datestamp': local_datestamp, 'bootoptions': bootoptions, 'install_partition': install_partition } ) @@ -493,6 +512,11 @@ MENU LABEL dos KERNEL /boot/addons/memdisk APPEND initrd=/boot/addons/balder10.imz +# bsd +LABEL bsd +MENU LABEL bsd +KERNEL /boot/addons/bsd4grml/ldbsd.com + ## end of global configuration """ % {'grml_flavour': grml_flavour, 'local_datestamp': local_datestamp, 'bootoptions': bootoptions} ) @@ -601,22 +625,21 @@ def install_bootloader(device): @device: partition where bootloader should be installed to""" - # Install bootloader on the device (/dev/sda), - # not on the partition itself (/dev/sda1)? - #if partition[-1:].isdigit(): - # device = re.match(r'(.*?)\d*$', partition).group(1) - #else: - # device = partition - - if options.grub: - install_grub(device) - else: + # by default we use grub, so install syslinux only on request + if options.syslinux: try: install_syslinux(device) except CriticalException, error: logging.critical("Fatal: %s" % error) cleanup() sys.exit(1) + else: + try: + install_grub(device) + except CriticalException, error: + logging.critical("Fatal: %s" % error) + cleanup() + sys.exit(1) def install_lilo_mbr(lilo, device): @@ -748,8 +771,8 @@ def handle_syslinux_mbr(device): else: lilo = '/usr/share/grml2usb/lilo/lilo.static.i386' # finally prefer a specified lilo executable - if options.lilo: - lilo = options.lilo + if options.lilobin: + lilo = options.lilobin if not is_exe(lilo): raise Exception("lilo executable can not be execute") @@ -974,6 +997,15 @@ def copy_addons(iso_mount, target): proc = subprocess.Popen(["install", "--mode=664", allinoneimg, addons + 'allinone.img']) proc.wait() + # bsd imag + bsdimg = search_file('bsd4grml', iso_mount) + if bsdimg is None: + logging.warn("Warning: bsd4grml not found - can not install it") + else: + logging.debug("cp -a %s %s" % (bsdimg, addons + '/')) + proc = subprocess.Popen(["cp", "-a", bsdimg, addons + '/']) + proc.wait() + # freedos image balderimg = search_file('balder10.imz', iso_mount) if balderimg is None: @@ -1132,7 +1164,7 @@ def handle_grub1_config(grml_flavour, install_partition, grub_target, bootopt): main_identifier = re.compile(".*main config generated at: %s.*" % re.escape(str(DATESTAMP))) if not re.match(main_identifier, string): grub1_config_file = open(grub1_cfg, 'w') - logging.info("Note: grml flavour %s is being installed as the default booting system." % grml_flavour) + # logging.info("Note: grml flavour %s is being installed as the default booting system." % grml_flavour) grub1_config_file.write(generate_main_grub1_config(grml_flavour, install_partition, bootopt)) grub1_config_file.close() else: @@ -1143,7 +1175,7 @@ def handle_grub1_config(grml_flavour, install_partition, grub_target, bootopt): grub_flavour_config = True if os.path.isfile(grub1_cfg): string = open(grub1_cfg).readlines() - logging.info("Note: you can boot flavour %s using '%s' on the commandline." % (grml_flavour, grml_flavour)) + # logging.info("Note: you can boot flavour %s using '%s' on the commandline." % (grml_flavour, grml_flavour)) flavour = re.compile("grml2usb for %s: %s" % (re.escape(grml_flavour), re.escape(str(DATESTAMP)))) for line in string: if flavour.match(line): @@ -1271,10 +1303,10 @@ def handle_syslinux_config(grml_flavour, target): def handle_bootloader_config(grml_flavour, device, target): """TODO""" - if options.grub: - handle_grub_config(grml_flavour, device, target) - else: + if options.syslinux: handle_syslinux_config(grml_flavour, target) + else: + handle_grub_config(grml_flavour, device, target) def handle_iso(iso, device): diff --git a/grml2usb.8.txt b/grml2usb.8.txt index 346b7e9..f4cf9bf 100644 --- a/grml2usb.8.txt +++ b/grml2usb.8.txt @@ -23,6 +23,14 @@ boot on the bootbrompt then. Note that the *first* ISO specified on the grml2usb command line will become the default one (that's the one that will boot when just pressing enter on the bootprompt or wait until the boot timeout matches). +[IMPORTANT] +By default a compatible master boot record (MBR) is installed on the device +(being for example /dev/sdb when executing 'grml2usb grml.iso /dev/sdb1') +and grub is being used as default bootloader. Avoid installation of the +default MBR using the --skip-mbr option or if you encounter any problems +with the default MBR consider using --syslinux-mbr instead. If bootloader +grub doesn't work for you check out the --syslinux option. + Options ------- @@ -42,7 +50,9 @@ Use specified bootoptions as default. *--bootloader-only*:: -Do *not* copy files but instead just install a bootloader. +Do *not* copy files but instead just install a bootloader. Note that the boot +addons are copied to /boot/addons at this stage as well. If you want to skip +copying the boot addons consider using the --skip-addons option. *--copy-only*:: @@ -63,10 +73,6 @@ Format specified partition with FAT16. Force any (possible dangerous) actions requiring manual interaction (like --fat16). - *--grub*:: - -Install grub bootloader instead of syslinux. - *--help*:: Display usage information and exit. @@ -83,12 +89,20 @@ Install specified kernel instead of the default. You might want to specify option *--initrd* as well. (Be aware when using multiboot setup.) [Notice: not implemented yet.] - *--lilo=...*:: + *--lilo-binary=...*:: + +Use specified lilo executable for installing master boot record (MBR) when using +the --syslinux-mbr option. By default any system wide (from $PATH) lilo +executable is taken. If there can not be find any lilo executable the +statically compiled version of the grml2usb Debian package (see +/usr/share/grml2usb/lilo/lilo.static.[amd64|i386]) is taken. + + *--mbr-manager=...*:: -Use specified lilo executable for installing master boot record (MBR). By -default any system wide (from $PATH) lilo executable is taken. If there can not -be find any lilo executable the statically compiled version of the grml2usb -Debian package (see /usr/share/grml2usb/lilo/lilo.static.[amd64|i386]) is taken. +Install master boot record (MBR) with integrated boot manager, providing a +simple selection for specifying the device for booting from. This options is +available only when using the default MBR and won't work if using the +--syslinux-mbr option. *--quiet*:: @@ -98,6 +112,25 @@ Do not output anything but just errors on console. Do not install /boot/addons/ files (like dos, grub, memdisk,...). + *--skip-mbr*:: + +Do not touch/install the master boot record (MBR). + + *--syslinux*:: + +Install syslinux bootloader instead of the default (being grub). + + *--syslinux-mbr*:: + +Install syslinux master boot record (MBR) instead of the default one. By +default a very compatible MBR is installed, if you can encounter any problems +with it you can try using the syslinux MBR instead. If that works for you please +<> so we can adjust our default MBR accordingly. + +[NOTE] +When using the --syslinux-mbr option also lilo is executed so the according +partitions are set active. + *--squashfs=*:: Install specified squashfs file instead of the default. @@ -124,20 +157,20 @@ Directory layout on usb device boot/ -> |-- addons/ - | |-- allinone.img - | |-- balder10.imz - | |-- chain.c32 - | |-- memdisk - | `-- menu.c32 + | |-- allinone.img [grub - all in one image] + | |-- bsd4grml/ [MirBSD] + | |-- balder10.imz [FreeDOS] + | |-- memdisk [chainloading helper] + | |-- memtest [memtest86+] |-- release/ | |-- grml/ - | | |-- linux26 - | | |-- initrd.gz + | | |-- linux26 [Kernel] + | | |-- initrd.gz [initramfs] | |-- grml64 - | | |-- linux26 - | | |-- initrd.gz + | | |-- linux26 [Kernel] + | | |-- initrd.gz [initramfs] | |-- grml-medium - | | |-- linux26 + | | |-- linux26 [...] | | |-- initrd.gz | |-- grml64-medium | | |-- linux26 @@ -149,14 +182,16 @@ Directory layout on usb device | |-- linux26 | |-- initrd.gz |-- grub/ - | |-- menu.lst - | |-- splash.xpm.gz - | `-- stage2_eltorito + | |-- grml.png [splash screen for grub2] + | |-- grub.cfg [configuration file for grub2] + | |-- menu.lst [configuration file for grub1] + | |-- splash.xpm.gz [splash screen for grub1] + | `-- stage2_eltorito [stage 2 loader for grub1] `-- syslinux/ - |-- boot.msg - |-- f1 - |-- f2 - |-- f3 + |-- boot.msg [boot splash for syslinux] + |-- f1 [screen when pressing f1] + |-- f2 [screen when pressing f2] + |-- f3 [...] |-- f4 |-- f5 |-- f6 @@ -164,17 +199,17 @@ Directory layout on usb device |-- f8 |-- f9 |-- f10 - |-- logo.16 - `-- syslinux.cfg + |-- logo.16 [graphical part of boot splash] + `-- syslinux.cfg [configuration file for syslinux] grml/ - |-- grml2usb.txt - |-- grml-cheatcodes.txt - |-- grml-version.txt - |-- LICENSE.txt - |-- md5sums - |-- README.txt - `-- web/ + |-- grml2usb.txt [not yet implemented] + |-- grml-cheatcodes.txt [list of bootoptions for grml] + |-- grml-version.txt [file containing information about grml-version] + |-- LICENSE.txt [license information] + |-- md5sums [md5sums of original ISO] + |-- README.txt [informational text] + `-- web/ [browser related files] |-- index.html |-- style.css `-- images/ @@ -184,11 +219,11 @@ Directory layout on usb device `-- logo.png live/ - |-- filesystem.module - |-- grml.squashfs - |-- grml-medium.module - |-- grml-medium.squashfs - |-- grml-small.module + |-- filesystem.module [file specifying which squashfs should be used by default] + |-- grml.squashfs [squashfs file] + |-- grml-medium.module [module specifying which squashfs should be used for grml-medium] + |-- grml-medium.squashfs [squashfs file for grml-medium] + |-- grml-small.module [...] |-- grml-small.squashfs |-- grml64.module |-- grml64.squashfs @@ -230,6 +265,48 @@ Performance tracing # blktrace -d /dev/sdb -o - | blkparse -i - # grml2usb grml_2008.11.iso /dev/sdb1 +[[X6]] +Troubleshooting and Pitfalls when booting +----------------------------------------- + +Here is a list of common error messages from BIOS/bootloader when trying to boot +from USB. + +/////////////////////////////////////////////////////////// +TODO: better list type for the error message / reason part? +See http://www.methods.co.nz/asciidoc/userguide.html +/////////////////////////////////////////////////////////// + +[horizontal] +*Error message*:: ran out of input data. System halted + +*Reason*:: Everything OK, except for the filesystem used on your usb device. So +instead of fat16 you are using for example fat32. Fix: use the appropriate +filesystem (fat16 for usb pens usually). The Bootsplash might be displayed, the +kernel loads but you very soon get the error message. + +*Error message*:: Invalid operating system + +*Reason*:: the partition layout is not ok. Very probably there's no primary + partition (/dev/sdX{1..4}) or none has the flag 'bootable' set. + +*Error message*:: No operating system found. + +*Reason*:: you forgot to set the boot-flag on the partition. Or there really isn't +any operating system at all. :) + +*Error message*:: kernel-panic: unable to mount root-fs... + +*Reason*:: Kernel boots but fails to find the root filesystem. The root= +argument in your kernel commandline is pointing to the wrong device. Adjust +root=..., consider using root=UUID=.... + +*Error message*:: Could not find kernel image: ... + +*Reason*:: either a broken isolinux/syslinux version or a broken BIOS. Check out +whether the vendor provides a BIOS update or if using bootloader grub instead of +isolinux/syslinux fixes the problem. + Frequently Asked Questions (FAQ) -------------------------------- @@ -248,18 +325,32 @@ faster, you don't need to burn a new CD when a new ISO version arrives (just install the new ISO using grml2usb) and you can carry additional files on a writable medium with yourself. +Why is there a menu.lst and a grub.cfg inside /boot/grub/? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +grml2usb supports grub version 1 (grub1) as well as grub version 2 (grub2). +Whereas grub1 uses menu.lst the new version grub2 needs grub.cfg. +Providing both files allows grml2usb to install grub on the target device +no matter which grub version is available on the host where grml2usb is +executed on. + Why do I have to use a FAT16 filesystem? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -You have to use a FAT16 filesystem if you consider using syslinux (being the -default). Syslinux currently does not support any other filesystems. If you want -to use another filesystem (like ext2/3) consider using the --grub option -instead. +You have to use a FAT16 filesystem only if you consider using syslinux, Syslinux +(currently) does not support any other filesystems. If you want to use another +filesystem (like ext2/3) just don't use syslinux (drop the --syslinux option) +but use the default bootloader (grub) instead. I think I've got a really cool idea! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Please <>. Or even better: send us a patch. +Please <>. Or even better: send us a patch. :) + +I've problems with booting from USB. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Check out <>. I've found a bug! ~~~~~~~~~~~~~~~~~ @@ -287,10 +378,10 @@ is reached). Install specified ISO on device /dev/sdb1 and format partition /dev/sdb1 with FAT16 filesystem. - # grml2usb --grub /home/grml/grml_2008.11.iso /dev/sdb1 + # grml2usb --syslinux /home/grml/grml_2008.11.iso /dev/sdb1 -Install specified ISO on device /dev/sdb1 and use Grub as bootloader -(instead of syslinux being the default). +Install specified ISO on device /dev/sdb1 and use syslinux as bootloader +(instead of grub being the default). # grml2usb --kernel=/boot/vmlinuz-2.6.28-grml --initrd=/boot/initrd.img-2.6.28-grml \ /home/grml/grml_2008.11.iso /dev/sdb1