OK. Became a bit long for comment. This is not directly related, but only to explain the aa55
comment.
When the Basic Input/Output System (BIOS) starts it does a Power-On Self
Test (POST), check hardware etc. Then it looks for devices that are both
bootable and active by order given by CMOS (Your configuration in BIOS – which in turn is given by a Complementary Metal Oxide Semiconductor). When it finds a disk that has 0xaa55
at offset 510 it loads that section of the disk,
(sector 1), into memory and leave control to it on address 0x00000 of that
code. Those 512 bytes are the Master Boot Record (MBR).
That code, in this case "GRUB - boot", check various bytes of these 512 in
addition to ask BIOS for various information. In this process it locates
which disk has rest of GRUB and load that section of the disk into memory –
then that part of code gets control. That one mounts kernel etc. and
leaves control to that.
Using GPT the image GRUB loads from within MBR is located in the bios_grub
partition, - which you have, and is big enough, etc., so can't see how that
could be wrong.
On "No bootable device found." message from BIOS – one can have the case
that MBR of boot disk is corrupted, if MBR ends in 0xaa55
and the MBR is
corrupt one usually get an other error - or the system simply hangs.
Anyhow. This is weird. I notice you have no partition marked as "boot".
Using GPT that is correct, - but, though it is forbidden, you could try to
flag one e.g. sda5
as boot. In gparted: (learned that
(g)parted also alter GPT which whan do not want)fdisk :
# Toggle bootable:
a [DISK NUMBER]
# Check (could be an asterisk marking boot partition):
p
# Save changes:
w
It could be that your BIOS is doing more then it should and checking the
partition table in MBR.
EDIT – Update to comment:
AFAIK it doesn't matter which one you set as it is not actually used.
Point being, for whom ever say no "bootable device found", they shall
be satisfied. The sda1
is not a boot partition in the traditional sense,
but space for GRUB boot files.
In a traditional partition layout (not GPT) you have typically something
like:
0x000 [Master Boot Record] <- Partition table say Partition 2 is active
|
0x200 [ GRUB module 1 ] <- core.img from GRUB |
|
0x400 [ Partition 1 Swap ] |
| | |
| | |
|__________________| |
|
0x... [ Partition 2 ext4 ] |
| * Active | <- AKA boot ----------------+
| |
|__________________|
0x... [ Partition 3 ext4 ]
| |
| |
|__________________|
That would mean 3 partitions. Everything before offset 0x400 on the HDD
i raw bytes – as in not part of any partition etc.
Here boot partition is Partition 2 which is system partition with
linux.
The GRUB module 1 files reside just after MBR and before first partition.
It can reside anywhere, but usually on same disk and at offset 512 of MBR
disk.
Also on a GPT system – GPT uses that section of the disk for itself, thus
one have to move those GRUB files to another location. That is what the
bios_grub
is for - to store core.img
for GRUB 2.
The "set boot flag" is merely a shot in the dark, - and would be surprised
if it works. But one has start somewhere.
EDIT2:
What if you do this:
Backup current MBR:
dd if=/dev/sda of=/path/mbr-backup bs=512 count=1
Create image from Code TEST
below, saved to file test.s
by:
as -o test.o test.s
objcopy -O binary test.o test.img
Copy the test.img
file to MBR:
dd if=test.img of=/dev/sda bs=512 count=1
Boot
Code TEST:
.file "test.s"
.text
.code16
.globl start, _start
start:
_start:
jmp go
nop
go:
movb $0x48, %al
call prnt_chr
movb $0x65, %al
call prnt_chr
movb $0x6c, %al
call prnt_chr
movb $0x6c, %al
call prnt_chr
movb $0x6f, %al
call prnt_chr
movb $0x21, %al
call prnt_chr
ret
prnt_chr:
movb $0x0e, %ah
int $0x10
ret
. = _start + 0x1fe
.word 0xaa55
To restore MBR do:
dd if=/path/mbr-backup of=/dev/sda bs=512 count=1
This should simply print "Hello!" to the screen if the MBR was loaded, then
stop. Tested it by running under qemu-system-x86_64, qemu-system-i386,
VirtualBox, stationary Intel PC 32 and 64 bit.
dd if=/dev/sda bs=1 skip=510 count=2 2>&- | hexdump
(or xxd instead of hexdump) equal to 55aa? If not the MBR is bad.0000000 aa55 0000002
If the MBR is bad, how you say, is there something I can do to make it good again?aa55
is correct MBR signature (55aa
on little endian system).