Skip to contentSkip to conversation

Switching to another boot device on failure

DISCUSSION Venkata Subbarao 4 participants 6 messages Nov 18, 2014 – Nov 28, 2014 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

Hi All,

I am working on a task on XUbuntu OS in which due to any reason if booting fails I would like to switch to another boot device by zeroing the MBR of current boot disk. Is this possible ?

For example instead of showing following prompt, I would like to zero out the MBR so that the BIOS can select next boot device upon reset.

error: no such partition
grub rescue>

Thanks in advance,
Venkata Subbarao

#1 lore raw

В Tue, 18 Nov 2014 10:51:00 +0000 (UTC) Venkata Subbarao <[email protected]> пишет:

Quoted 6 lines

Hi All,

I am working on a task on XUbuntu OS in which due to any reason if booting fails I would like to switch to another boot device by zeroing the MBR of current boot disk. Is this possible ?

Quoted 6 lines

For example instead of showing following prompt, I would like to zero out the MBR so that the BIOS can select next boot device upon reset.

error: no such partition
grub rescue>

grub supports only very limited and controlled ways to write to device/file. Doing something like this in unattended manner is probably way too dangerous.

What would be possible is to optionally exit grub (after timeout) in this case; then BIOS should proceed to next boot device.

#2 lore raw

Switching to the next boot device should not be done without advertising the user, so that he or she has the opportunity to fix the primary device's booting process.

By the way, how is the "recordfail" environment variable reset ?

And wouldn't it be possible to implement a "next_boot_device" environment variable to answer Venkata's need ?

Arbiel

Quoted 26 lines · Andrei Borzenkov

В Tue, 18 Nov 2014 10:51:00 +0000 (UTC) Venkata Subbarao <[email protected]> пишет:

Quoted 6 lines

Hi All,

I am working on a task on XUbuntu OS in which due to any reason if booting fails I would like to switch to another boot device by zeroing the MBR of current boot disk. Is this possible ?

Quoted 6 lines

For example instead of showing following prompt, I would like to zero out the MBR so that the BIOS can select next boot device upon reset.

error: no such partition
grub rescue>

grub supports only very limited and controlled ways to write to device/file. Doing something like this in unattended manner is probably way too dangerous.

What would be possible is to optionally exit grub (after timeout) in this case; then BIOS should proceed to next boot device.

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

A message that is not in the archive (sent off-list or not yet received): CAFQyPcp7XO+Vs+fO-oYSPjvdHdTiB=oj8GCGbOLxmf6vs7YZGA@mail.gmail.com

#4 lore raw

Once again Thank you Andrei.
Modified the grub source and added grub_exit (). After this BIOS booted from next device.

I am now working on a solution where if the UUID present in the grub.cfg goes bad.
One way I am thinking is to check the CRC of the grub.cfg and other image files required for booting. This may be bit lengthy.
Let me know if you have suggestions.

Thanks,
Subbarao

Quoted 37 lines · Venkata Subbarao

Thank you very much Andrei.
I will try out this and update.

- Subbarao

Quoted 26 lines · Andrei Borzenkov

В Tue, 18 Nov 2014 10:51:00 +0000 (UTC) Venkata Subbarao <[email protected]> пишет:

Quoted 3 lines

Hi All,

I am working on a task on XUbuntu OS in which due to any reason if

booting

Quoted 1 line

fails I would like to switch to another boot device by zeroing the MBR

of

Quoted 3 lines

current boot disk. Is this possible ?

For example instead of showing following prompt, I would like to zero

out

Quoted 5 lines

the MBR so that the BIOS can select next boot device upon reset.

error: no such partition
grub rescue>

grub supports only very limited and controlled ways to write to device/file. Doing something like this in unattended manner is probably way too dangerous.

What would be possible is to optionally exit grub (after timeout) in this case; then BIOS should proceed to next boot device.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

I purposefully modified grub.cfg and changed the UUID in the line starts with "linux /boot/vmlinuz...... root=UUID=XXXX"
Ended up in the (initramfs) prompt because such partition is not present. Hence, I was thinking of checking CRC.

Thanks and Regards,
Subbarao

Quoted 66 lines · Andrei Borzenkov

В Thu, 20 Nov 2014 19:08:10 +0530
Venkata Subbarao <[email protected]> пишет:

Quoted 10 lines

Once again Thank you Andrei.
Modified the grub source and added grub_exit (). After this BIOS booted from next device.

I am now working on a solution where if the UUID present in the grub.cfg goes bad.
One way I am thinking is to check the CRC of the grub.cfg and other image files required for booting. This may be bit lengthy.
Let me know if you have suggestions.

grub supports automatic signature verification for files; in case of mismatch file open fails. Does it help?

Quoted 24 lines

Thanks,
Subbarao

Quoted 18 lines · Venkata Subbarao

Thank you very much Andrei.
I will try out this and update.

- Subbarao

On Wed, Nov 19, 2014 at 8:46 AM, Andrei Borzenkov <[email protected]

Quoted 8 lines · wrote:

В Tue, 18 Nov 2014 10:51:00 +0000 (UTC) Venkata Subbarao <[email protected]> пишет:

Quoted 3 lines

Hi All,

I am working on a task on XUbuntu OS in which due to any reason if

booting

Quoted 1 line

fails I would like to switch to another boot device by zeroing the

MBR

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

of

Quoted 3 lines

current boot disk. Is this possible ?

For example instead of showing following prompt, I would like to

zero

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

out

Quoted 5 lines

the MBR so that the BIOS can select next boot device upon reset.

error: no such partition
grub rescue>

grub supports only very limited and controlled ways to write to device/file. Doing something like this in unattended manner is

probably

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

way too dangerous.

What would be possible is to optionally exit grub (after timeout) in this case; then BIOS should proceed to next boot device.

#7 lore raw
In reply to Venkata Subbarao
Quoted 10 lines · Venkata Subbarao

Once again Thank you Andrei.
Modified the grub source and added grub_exit (). After this BIOS booted from next device.

I am now working on a solution where if the UUID present in the grub.cfg goes bad.
One way I am thinking is to check the CRC of the grub.cfg and other image files required for booting. This may be bit lengthy. Let me know if you have suggestions.

What is the scenario you want to protect against? checksums are mainly useful against hardware failure but if hardware is defective the only way to surely bring it back is to replace failing components. The most common way for UUID to go unsync is because of software or operator error and both are likely to recompute checksum or change actual disk UUID without changing grub.cfg.

Quoted 52 lines

Thanks,
Subbarao

On Wed, Nov 19, 2014 at 8:57 AM, Venkata Subbarao <[email protected] <mailto:[email protected]>> wrote:

Thank you very much Andrei.
I will try out this and update.

- Subbarao

On Wed, Nov 19, 2014 at 8:46 AM, Andrei Borzenkov <[email protected] <mailto:[email protected]>> wrote:

В Tue, 18 Nov 2014 10:51:00 +0000 (UTC) Venkata Subbarao <[email protected] <mailto:[email protected]>> пишет:

> Hi All,
>
> I am working on a task on XUbuntu OS in which due to any reason if booting
> fails I would like to switch to another boot device by zeroing the MBR of
> current boot disk. Is this possible ?
>
> For example instead of showing following prompt, I would like to zero out
> the MBR so that the BIOS can select next boot device upon reset. >
> error: no such partition
> grub rescue>
>

grub supports only very limited and controlled ways to write to device/file. Doing something like this in unattended manner is probably
way too dangerous.

What would be possible is to optionally exit grub (after timeout) in this case; then BIOS should proceed to next boot device.

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel