Kickstart option to set GRUB drive location?

General support questions including new installations
andersbiro
Posts: 12
Joined: 2010/02/22 10:07:54

Kickstart option to set GRUB drive location?

Post by andersbiro » 2010/03/04 12:36:32

Hello, I have successfully created a Centos USB stick installation with an automated kickstart configuration according to the instructions at http://wiki.centos.org/HowTos/InstallFromUSBkey .

Everything works flawlessly with the exception that the installation writes the GRUB Boot Loaders on the USB stick instead of the destination hard drive and hence can only be booted from the USB stick.

Afterwards I can solve this manually by editing grub.conf to point to the hard drive and using the grub utility I can nstall the Grub loader on the hard drive MBR instead and then it boots normally.

The aim is however to create a fully automated installation since the end users in question are expected to be technically proficient so my question is if there is a kickstart option to explicitly write GRUB correctly to the hard drive from the very beginning?

There seems to be a kickstart "bootloader" option but I can not really see any flags that would explicitly set the GRUB on a specified hard drive?

User avatar
AlanBartlett
Forum Moderator
Posts: 9345
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk
Contact:

Re: Kickstart option to set GRUB drive location?

Post by AlanBartlett » 2010/03/04 18:52:16

In the [i]CentOS[/i] wiki article that you reference, under the heading [b]Notes[/b], there is a [color=ff1480]cherry-red[/color] block of text. Isn't that appropriate?

If not, do you have any suggestions for improvement to the article?

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Kickstart option to set GRUB drive location?

Post by pschaff » 2010/03/04 21:36:41

[quote]
andersbiro wrote:
...
There seems to be a kickstart "bootloader" option but I can not really see any flags that would explicitly set the GRUB on a specified hard drive?[/quote]

How about [url=https://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Installation_Guide-en-US/s1-kickstart2-options.html]Kickstart Options[/url]:[code]
bootloader (required)
Specifies how the boot loader should be installed. This option is required for both installations and upgrades.

* --append= ? Specifies kernel parameters. To specify multiple parameters, separate them with spaces. For example:

bootloader --location=mbr --append="hdd=ide-scsi ide=nodma"

* --driveorder ? Specify which drive is first in the BIOS boot order. For example:

bootloader --driveorder=sda,hda

* --location= ? Specifies where the boot record is written. Valid values are the following: mbr (the default),
partition (installs the boot loader on the first sector of the partition containing the kernel), or
none (do not install the boot loader).
[/code]

Still can't guarantee that a totally automated approach is possible, unless the hardware is identical, as the devices and ordering will be system-dependent. :-(

andersbiro
Posts: 12
Joined: 2010/02/22 10:07:54

Re: Kickstart option to set GRUB drive location?

Post by andersbiro » 2010/03/08 08:48:17

[quote]
AlanBartlett wrote:
In the [i]CentOS[/i] wiki article that you reference, under the heading [b]Notes[/b], there is a [color=ff1480]cherry-red[/color] block of text. Isn't that appropriate?

If not, do you have any suggestions for improvement to the article?[/quote]

To my understanding this specific part of the text refers to an interactive installation but since I deal with a fully automatic installation I do not think that part is appropriate so that is why I am looking for corresponding kickstart options to achieve the same thing.
To be fair it also mentions the line bootloader --driveorder=cciss/c0d0,sda --location=mbr" that might be appropriate but since I am not very proficient with completely comprehending the parameters.

andersbiro
Posts: 12
Joined: 2010/02/22 10:07:54

Re: Kickstart option to set GRUB drive location?

Post by andersbiro » 2010/03/08 08:58:16

[quote]
pschaff wrote:
[quote]
andersbiro wrote:
...
There seems to be a kickstart "bootloader" option but I can not really see any flags that would explicitly set the GRUB on a specified hard drive?[/quote][/quote]

How about [url=https://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Installation_Guide-en-US/s1-kickstart2-options.html]Kickstart Options[/url]:[code]
bootloader (required)
Specifies how the boot loader should be installed. This option is required for both installations and upgrades.

* --append= ? Specifies kernel parameters. To specify multiple parameters, separate them with spaces. For example:

bootloader --location=mbr --append="hdd=ide-scsi ide=nodma"

* --driveorder ? Specify which drive is first in the BIOS boot order. For example:

bootloader --driveorder=sda,hda

* --location= ? Specifies where the boot record is written. Valid values are the following: mbr (the default),
partition (installs the boot loader on the first sector of the partition containing the kernel), or
none (do not install the boot loader).
[/code]

I was aware of these parameters but I am not fully sure about how to apply them... the "--location" flag seemed easy enough and also driveorder but the "append" kernel parameters eludes me but perhaps this is not required.

I know that the kernel and Grub part should reside on the first partition of disk "sda" and the USB stick on "sdb" so would setting the "--driveorder=sda,sdb" insure that grub.conf points to the sda disk?

Also, would that automatically write the GRUB loader on "sda" as well or do you need to use the "partition flag" for that?

andersbiro
Posts: 12
Joined: 2010/02/22 10:07:54

Re: Kickstart option to set GRUB drive location?

Post by andersbiro » 2010/03/08 12:04:09

As a matter of fact I tried the --driveorder flag and that actually worked as it now can boot directly without USB stick which is a great step forward.
The only remaining obstacle is that somehow the FAT32 partition disappear from the USB stick so it cannot be used for future installations.
This can however be fixed by using FDISK to create a new FAT32 partition in the same space and somehow this also restores the previous file in the partition.

Since the GRUB bootloader seems to be written to the destination disk I must say that I cannot understand at all why the FAT32 partition disappears?
Are additional flags required to prevent this from happening?

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Kickstart option to set GRUB drive location?

Post by pschaff » 2010/03/08 12:51:41

[quote]
andersbiro wrote:
...
Since the GRUB bootloader seems to be written to the destination disk I must say that I cannot understand at all why the FAT32 partition disappears?
Are additional flags required to prevent this from happening?[/quote]

I have not seen that happen. You have both FAT32 and ext3 partitions, and the FAT32 one is gone after the install? I'd check the kickstart file carefully to be sure it is not inadvertently messing with the USB drive.

Thanks for reporting back, and please keep us posted. Any recommendations for the Wiki article appreciated.

andersbiro
Posts: 12
Joined: 2010/02/22 10:07:54

Re: Kickstart option to set GRUB drive location?

Post by andersbiro » 2010/03/08 14:49:12

I managed to solve the issue by adding the "ignoredisk --drives=sdb" parameter for the USB drive and now the installer leaves the USB stick intact and the installation works flawlessly.
I however still do not know why the installer affected the disk in the first place but this flag did at any rate solve the problem for me.

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Kickstart option to set GRUB drive location?

Post by pschaff » 2010/03/08 14:53:40

Thanks for the additional info. Still seems that a general solution is elusive, as there's no guarantee that on a different set of hardware the USB drive will show up as /dev/sdb.

nektoid
Posts: 1
Joined: 2012/04/03 17:00:26

Re: Kickstart option to set GRUB drive location?

Post by nektoid » 2012/04/03 17:06:27

Hi. I ran into this recently kickstarting both 5.5 and 6.2 hosts. Kickstarts worked one day and the next the bootloader wanted to be on the usb key, odd. This is was an example of what worked for me with 5.5 where the usb key was consistently seen as sdb. Both at their respective parts in the preamble section of ks.cfg.

#stop writing bootloader to usb
bootloader --driveorder=sda,sdb --location=mbr

#stop erasing my usb stick
ignoredisk --drives=sdb

Post Reply