Difference between revisions of "User:Rpeters"

From Info Wiki
Jump to: navigation, search
Line 59: Line 59:
 
=== GRUB (aka GRUB 2 ) ===
 
=== GRUB (aka GRUB 2 ) ===
   
  +
GRUB 2 is now the most frequently used bootloader in Linux, but has many remaining issues. Some work-arounds:
  +
 
==== "on-the-fly" Mode ====
 
==== "on-the-fly" Mode ====
   
Line 64: Line 66:
   
 
grub> set root='hd0,gpt10'
 
grub> set root='hd0,gpt10'
  +
 
grub> linux /boot/vmlinuz root=/dev/sda10
 
grub> linux /boot/vmlinuz root=/dev/sda10
  +
 
grub> initrd /boot/initrd
 
grub> initrd /boot/initrd
  +
 
grub> boot
 
grub> boot
   
Line 96: Line 101:
 
Indeed, "info grub2" recommends avoid all automated installs & configs by
 
Indeed, "info grub2" recommends avoid all automated installs & configs by
 
distro. Instead, manually grub2-install then write a simple, static
 
distro. Instead, manually grub2-install then write a simple, static
/boot/grub2/grub.cfg.
+
/boot/grub2/grub.cfg. See below for outline of this procedure.
   
As of Jan 2014 and following application of two patches to GRUB in openSUSE 13.1, its GRUB has been broughtto ver 2.00-39.4.1. The
+
As of Jan 2014 and following application of two patches to GRUB in openSUSE 13.1, its GRUB has been brought to ver 2.00-39.4.1. The
 
automated process works well enough for most Linux plus Windows
 
automated process works well enough for most Linux plus Windows
   
 
It failed to find ArchLinux - which uses unusual names for kernels & initrd.
 
It failed to find ArchLinux - which uses unusual names for kernels & initrd.
Simple work-around for that was to add the following in the end of
+
Simple work-around for that is to add a 90_persistent section at the end of
/boot/grub2/grub.cfg
+
/boot/grub2/grub.cfg
   
 
### BEGIN /etc/grub.d/90_persistent ###
 
### BEGIN /etc/grub.d/90_persistent ###
Line 116: Line 121:
   
 
Essentially, the 90_persistent section gets copied verbatim during any
 
Essentially, the 90_persistent section gets copied verbatim during any
subsequent manual or automated run of grub2-mkconfig.
+
subsequent manual or automated run of grub2-mkconfig. Note that this feature might be unique to openSUSE
   
 
The curly braces are essential and enclose GRUB2 commands.
 
The curly braces are essential and enclose GRUB2 commands.
Line 126: Line 131:
 
Linuxes.
 
Linuxes.
   
  +
==== Manual Install ====
Similarly, a static grub.cfg consisting solely of multiple menuentries works
 
well enough. GRUB2 autoloads most of the modules it needs.
 
   
  +
Distro run many scripts to provide GUI interface to bootloader configuration. If these are failing either initially or following kernel updates, then the most reliable process is a manually '''installed''' and '''configured''' GRUB 2. Details will differ between distro.
If you get a manual menuentry wrong then on-the-fly editing is available as
 
  +
  +
For openSUSE:
  +
**<span style="color:#ef2108; background:#black">''' this procedure initially removes all bootloaders, including that for Windows''' Proceed only if means of recovery are to hand</span>
  +
#copy the existing boot menu file /boot/grub2/grub.cfg to a different location eg in /root
  +
#Yast2->System->Bootloader
  +
*set bootloader type to "do not install any bootloader"
  +
**accept all the warnings
  +
**press OK to complete
  +
#from root's command prompt:
  +
<nowiki># grub2-install /dev/sd(x)</nowiki>
  +
  +
Notes
  +
*installation to a second HDD eg /dev/sdb, would avoid overwriting bootloader on /dev/sda
  +
*default location of boot code will become /boot/grub2 on the currently booted system
  +
**generally suitable but see info grub2 to change location.
  +
  +
Write a static /boot/grub2/grub.cfg consisting solely of multiple menuentries. Each menuentry has the syntax between the ### BEGIN /etc/grub.d/90_persistent ### ### END /etc/grub.d/90_persistent ### section markers in http://www.pcug.org.au/info/index.php?title=User:Rpeters&action=submit#Menu_mode above
  +
 
Such basic menu works well enough. GRUB2 autoloads most of the modules it needs.
  +
 
If you get a manual menuentry wrong then on-the-fly editing is available as in http://www.pcug.org.au/info/index.php?title=User:Rpeters&action=submit#.22on-the-fly.22_Mode
  +
*press 'e' to edit an entry.
  +
  +
It's also possible to add an entry by pressing "c". In this mode only the 3
  +
commands are input, followed by a fourth command 'boot'CTL-x at the
  +
Someone asked how to increase the font size in boot menu. The manual
  +
grub.cfg essentially does that by using whatever font will fit on the http://www.pcug.org.au/info/index.php?title=User:Rpeters&action=submit#on
 
in GRUB legacy. press 'e' to edit an entry.
 
in GRUB legacy. press 'e' to edit an entry.
   
Line 136: Line 167:
 
Someone asked how to increase the font size in boot menu. The manual
 
Someone asked how to increase the font size in boot menu. The manual
 
grub.cfg essentially does that by using whatever font will fit on the
 
grub.cfg essentially does that by using whatever font will fit on the
  +
default screen resolution. Alternatively, one could try to make sense of
  +
the "loadfont" parameters in /etc/grub.d/00_header.
  +
  +
Wheras GRUB legacy uses similar syntax in command and menu mode, GRUB 2 uses somewhat different syntax in the two modes.
  +
  +
==== Rescue mode ====
  +
  +
An ISO image can be prepared, that is tailored to the OS on a specific computer. See above documentation for details on preparation of this image. It can be tested by "dd" to a USB memory device.
  +
  +
=== ReFind ===
  +
  +
Only for computers having EFI firmware
  +
*a CD can be downloaded, to test, if uncertain of firmware
  +
  +
 
default screen resolution. Alternatively, one could try to make sense of
 
default screen resolution. Alternatively, one could try to make sense of
 
the "loadfont" parameters in /etc/grub.d/00_header.
 
the "loadfont" parameters in /etc/grub.d/00_header.

Revision as of 08:26, 8 January 2014

For General Users

The idea of having both Windows and Linux installed on a computer and being able to select one at boot time appeals to many who are trying, or migrating to, Linux.

  • Windows own bootloader cannot boot Linux
    • a Linux bootloader must be used with dual-booting

The better known Linux distributions will set this up automatically, during installation to a single hard disk drive in the computer

  • It is likely to cease functioning following the next update of Windows and
    • restoring dual-boot requires Getting Technical

Keep at least one emergency boot medium handy. See Emergency_Boot - Including for Dual-Boot

Getting Technical

The above problem can usually be obviated by having additional hard disk(s) in the computer. This is not an expensive option, given current HDD prices.

USB Drive

Pros

  • easily added
  • no change to internal HDD

Cons

  • Linux relies on the absolute order of storage devices detected by the computer's firmware
    • plugging in (say) a uSB memory drive, may upset the booting
    • many bootloaders will identify partitions via UUID, to overcome this limitation

Internal HDD

  • ensures permanent order of drives

Installation

  • mainstream Linux will allow installation to a second HDD


Selecting Boot Device

The selection of "drive" and hence OS is done at POST stage and depends on type of firmware in the computer

see Booting from Removable Media

Strictly for Geeks

  • the bootloader must also be installed to the second HDD, in this technique
    • can require "drilling down" the installation options


--Rpeters11:28, 24 August 2012 (EST) --

Bootloaders

Elilo

Only for computers having EFI firmware

Fairly simple and reliable

  • but requires a running Linux to generate its config file, in advance

GRUB Legacy (aka 0.97 )

A simple, reliable bootloader, although being phased out and no longer maintained. Use situations:

  • have only Linux on /ext(n) partitions and (maybe) Windows

GRUB (aka GRUB 2 )

GRUB 2 is now the most frequently used bootloader in Linux, but has many remaining issues. Some work-arounds:

"on-the-fly" Mode

GRUB 2 relies on a pre-defined config file /boot/grub(2)/grub.cfg. If this is not located, for any reason, GRUB 2 may boot to a grub> prompt. To boot from here use the following commands:

grub> set root='hd0,gpt10'

grub> linux /boot/vmlinuz root=/dev/sda10

grub> initrd /boot/initrd

grub> boot

notes

  • drive numbers start from 0
  • must specify whether partitioned mbr or gpt
  • partition refers to location of /boot for the operating system to be booted
    • which will often also be the root file system for Linux
    • or merely the system partition for Win
    • partition numbers start from 1 (unlike in GRUB legacy)
  • this procedure is easiest if kernel & initrd have easily remembered names
    • either soft-link generic names or
    • press TAB to see possible names
  • ctrl-x or F10 may be pressed in lieu the "boot" command

The above procedure may be modified to cater for the situation where the menu is presented but the desired OS is not included or fails to boot. either

  • press e to edit a menu item or
  • press Esc to get to command line, then proceed as above.

Menu mode

See GRUB 2 downloadable manual or use "info grub2" to obtain details. Consistent themes amongst various documentation for GRUB 2 are that:

  • it is unreliable beyond the basics
  • OS-probe module is particularly so
  • not putting bootstrap in MBR (protective MBR in case of GPT) will

be problematic

Indeed, "info grub2" recommends avoid all automated installs & configs by distro. Instead, manually grub2-install then write a simple, static /boot/grub2/grub.cfg. See below for outline of this procedure.

As of Jan 2014 and following application of two patches to GRUB in openSUSE 13.1, its GRUB has been brought to ver 2.00-39.4.1. The automated process works well enough for most Linux plus Windows

It failed to find ArchLinux - which uses unusual names for kernels & initrd. Simple work-around for that is to add a 90_persistent section at the end of /boot/grub2/grub.cfg

      1. BEGIN /etc/grub.d/90_persistent ###

menuentry 'ArchLinux (<your descriptor>) { set root='hd<n>,gpt<n>' linux /boot/vmlinux-linux root=/dev/sd<x><n> initrd /boot/initramfs-linux.img }

      1. END /etc/grub.d/90_persistent ###

Essentially, the 90_persistent section gets copied verbatim during any subsequent manual or automated run of grub2-mkconfig. Note that this feature might be unique to openSUSE

The curly braces are essential and enclose GRUB2 commands.

This was for a HDD partitioned GPT. replace partition number with mbr<n> if applicable.

Multiple menuentries could be put in 90_persistent to cope with multiple Linuxes.

Manual Install

Distro run many scripts to provide GUI interface to bootloader configuration. If these are failing either initially or following kernel updates, then the most reliable process is a manually installed and configured GRUB 2. Details will differ between distro.

For openSUSE:

    • this procedure initially removes all bootloaders, including that for Windows Proceed only if means of recovery are to hand
  1. copy the existing boot menu file /boot/grub2/grub.cfg to a different location eg in /root
  2. Yast2->System->Bootloader
  • set bootloader type to "do not install any bootloader"
    • accept all the warnings
    • press OK to complete
  1. from root's command prompt:

# grub2-install /dev/sd(x)

Notes

  • installation to a second HDD eg /dev/sdb, would avoid overwriting bootloader on /dev/sda
  • default location of boot code will become /boot/grub2 on the currently booted system
    • generally suitable but see info grub2 to change location.

Write a static /boot/grub2/grub.cfg consisting solely of multiple menuentries. Each menuentry has the syntax between the ### BEGIN /etc/grub.d/90_persistent ### ### END /etc/grub.d/90_persistent ### section markers in http://www.pcug.org.au/info/index.php?title=User:Rpeters&action=submit#Menu_mode above

Such basic menu works well enough. GRUB2 autoloads most of the modules it needs.

If you get a manual menuentry wrong then on-the-fly editing is available as in http://www.pcug.org.au/info/index.php?title=User:Rpeters&action=submit#.22on-the-fly.22_Mode

  • press 'e' to edit an entry.

It's also possible to add an entry by pressing "c". In this mode only the 3 commands are input, followed by a fourth command 'boot'CTL-x at the Someone asked how to increase the font size in boot menu. The manual grub.cfg essentially does that by using whatever font will fit on the http://www.pcug.org.au/info/index.php?title=User:Rpeters&action=submit#on in GRUB legacy. press 'e' to edit an entry.

It's also possible to add an entry by pressing "c". In this mode only the 3 commands are input, followed by a fourth command 'boot'CTL-x at the Someone asked how to increase the font size in boot menu. The manual grub.cfg essentially does that by using whatever font will fit on the default screen resolution. Alternatively, one could try to make sense of the "loadfont" parameters in /etc/grub.d/00_header.

Wheras GRUB legacy uses similar syntax in command and menu mode, GRUB 2 uses somewhat different syntax in the two modes.

Rescue mode

An ISO image can be prepared, that is tailored to the OS on a specific computer. See above documentation for details on preparation of this image. It can be tested by "dd" to a USB memory device.

ReFind

Only for computers having EFI firmware

  • a CD can be downloaded, to test, if uncertain of firmware


default screen resolution. Alternatively, one could try to make sense of the "loadfont" parameters in /etc/grub.d/00_header.

Wheras GRUB legacy uses similar syntax in command and menu mode, GRUB 2 uses somewhat different syntax in the two modes.

Rescue mode

An ISO image can be prepared, that is tailored to the OS on a specific computer. See above documentation for details on preparation of this image. It can be tested by "dd" to a USB memory device.

ReFind

Only for computers having EFI firmware

  • a CD can be downloaded, to test, if uncertain of firmware


Syslinux

A proven bootloader, that continues being developed and maintained. Main limitations:

  • can't directly boot programs on other than its own partition, resulting in the need for work-arounds:
    • either chain load all but one OS or
    • put the boot code for each OS in a different sub-directory on the syslinux partition

DOS USB

For General Users

Purpose

The main requirement for a USB memory device that boots to DOS operating system arises when a BIOS/Firmware update of a computer is required.

It is advisable to use a new, or little used memory device, because any error in reading the BIOS/Firmware code during the actual update is likely to result in an unusable computer. USB "thumb" drives could be used. SD cards, which can be removed and stored in a secure place, might be more applicable.

Procedure

HP provide two techniques for producing DOS USB sticks. Both place utility software on a Windows computer, in order to generate the bootable stick - see "Getting Technical" below, if Windows is not available.

Instructions are provided on the HP support site for installing these utilities to Windows and creating bootable USB stick(s)

  • HP's generic utility HPUSBFW is not self contained but is more flexible.
    • it produces a mimimal DOS bootable USB stick containing only nnnDOS.SYS & COMMAND.COM
    • the user can then add relevant firmware and flashing utility
    • although it has an option for formatting to FAT 32 only FAT actually works
    • requires one of HP's "Softpacs" (firmware updates) for one of their recent commercial notebooks, from which to obtain the Windows utility program, plus
    • also requires FreeDOS (which can be downloaded at no cost in the form of fd11src.iso from http://www.freedos.org/download/)
  • those wanting to upgrade the firmware in a HP computer might find the second tool more suitable. HP provide some of their firmware updates as Windows dotEXE files, which:
    • install a utility program to Windows and then have facility called ROMPAQ for creating a bootable DOS on a USB device of not greater than 2 GB (FAT 16)
    • automatically adds the firmware and flashing utility to the USB stick
    • the naming convention for these files is SPnnnnn.exe

Note that in order to use the former, generic technique, general users would need to burn the above ISO image to CD. Those not familiar with ISO images should read http://www.pcug.org.au/info/index.php/Using_dotISO_Files

The step of burning the ISO image can be avoided - see "Getting Technical" below

Getting Techhnical

The techniques above contain the Windows version of Syslinux in the Windows software package and install the former as a bootloader on the USB device. The Syslinux bootloader can also be added to a USB memory device via Linux. Generic instructions are at the following site, from which (superceded versions of) the code are also available

http://goebelmeier.de/bootstick/

The following would need to be downloaded to obtain up-to-date software:

http://www.freedos.org/download/fd11src.iso

https://www.kernel.org/pub/linux/utils/boot/syslinux/6.xx/

Syslinux will already be installed on many Linux systems. However, Ubuntu and openSUSE might produce a USB stick that invokes graphics at boot time and it is undesirable to have superfluous code on a device that will be used for firmware upgrades.

FreeDOS supports FAT 32 and consequently the above procedure should also work on FAT 32 formatted sticks of > 2 GB capacity.

--Rpeters 09:05, 7 October 2013 (EST) --