Invalid partition table linux

Grub & Неверная или отсутствующая таблица разделов

Приветствую уважаемое комюнити!

Прошу совета как пофиксить собсно сабж.

После переноса системы с диска на диск по вот этой доке(http://habrahabr.ru/post/102849/), ранее делал на другом компе и все было гуд, но сейчас возникла проблема.
Если нажимаешь enter на экране с ошибкой, то загрузка продолжается без проблем.
Можно жить и так, но напрягает каждый раз тыцать ентер при загрузке.

Диск /dev/sda: 500.1 Гб, 500107862016 байт
255 головок, 63 секторов/треков, 60801 цилиндров, всего 976773168 секторов
Units = секторы of 1 * 512 = 512 bytes
Размер сектора (логического/физического): 512 байт / 4096 байт
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Идентификатор диска: 0x8a8e69de

Устр-во Загр Начало Конец Блоки Id Система
/dev/sda1 2048 1026047 512000 83 Linux
/dev/sda2 1026048 5220351 2097152 83 Linux
/dev/sda3 5220352 976773167 485776408 5 Расширенный
/dev/sda5 5222400 57651199 26214400 83 Linux
/dev/sda6 57653248 976773167 459559960 83 Linux

Читал, что вроде должен помочь testdisk, так ли это?
Повторюсь, система у меня полностью рабочая, с нее сейчас и пишу.

Ошибка то какая?!

invalid partition table

Для начала попробуй переустановить grub.

1) Диск был по-новой переразбит
2) были скопированы файлы по инструкции http://habrahabr.ru/post/102849/)
3) поправлен fstab под новые UUID
4) проинстален груб
5) сделан update-grub

PS как я сказал в предыдущий раз эти действия были схаваны без малейшего затыка, а сейчас грит — таблица разделов плохая, но при этом грузится.

А вообще, покажи

fdisk -l /dev/sdX
parted /dev/sdX print

fdisk -l /dev/sdX — Представлен выше

sudo parted /dev/sda print
Модель: ATA ST9500423AS (scsi)
Диск /dev/sda: 500GB
Размер сектора (логич./физич.): 512B/4096B
Таблица разделов: msdos

Номер Начало Конец Размер Тип Файловая система Флаги
1 1049kB 525MB 524MB primary ext2
2 525MB 2673MB 2147MB primary linux-swap(v1)
3 2673MB 500GB 497GB extended
5 2674MB 29,5GB 26,8GB logical ext4
6 29,5GB 500GB 471GB logical ext4

тут человеку помогла переустановка груба в нужное место.
но у меня до всех махинаций он был на в загр.секторе диска и сейчас я его туда же ставил:

Гм, вроде всё хорошо. Попробуй grub-install уже из работающей системы, елси не поможет — напиши в багтрекер или список рассылки grub, что-то странное.

Завтра на работе буду пробовать. Спасибо.

Покажите конфигурационный файл загрузчика.

Вы похоже не умеете читать. У человека был неправильно указан корневой раздел загрузчика, т.е. раздел, откуда он считывает файлы для загрузки.

Как я уже спросил выше, покажите ваш конфигурационный файл.

Завтра утром сразу кину листинг файлика.

Ответ на сообщение kbu *30.01.2014 16:49:56

Источник

Arch Linux

You are not logged in.

#1 2015-12-30 07:40:39

[Solved] Grub2 and «Invalid partition table!»

Solution

It seems my problem was that my BIOS didn’t like having a boot-flag on a logical partition.
Changing the boot-flag from sda5 (where my Linux resides) to sda1 (first partition, and is a Windows-recovery partition) made my BIOS happy and stopped giving the error.
GRUB loads just fine and has no trouble booting either Linux or Windows.

Yesterday I decided to dual boot one of my machines.
It is a Dell Latitude E6430 and came pre-installed with Windows 7 Pro (it’s a work laptop and we are required to have a bare-metal install of Windows, so no VMs).
As me and Windows tend to disagree about how an OS should be I could no longer stand it and decided to install Arch on it and dual boot.
After some trial and error I got the partitioning to work. Note that the computer came pre-loaded with windows with an MBR partitioning table. I don’t have access to a full Windows DVD-installI disc and I have work-related things already on it. So doing a complete reinstall and using GPT is not an option for me atm.

Partitioning process, can be skipped over

I started out with three partitions:

Читайте также:  Как убрать файл гибернации windows 10

OEM partition (primary)

Windows recovery (primary)

Windows OS (primary, boot)

Great, I thought. Now lets create two more partitions, one for Linux and one partition that’s NTFS so I can share files between my OSs.
Being stupid and not paying attention, I created another primary partition marked ext4. All good so far. I tried to create another partition. «Cannot create more partitions.» I read. Silly as I was, I thought «Well a reboot should fix that, must be something borked somewhere.» Nope. Still the issue. «But hey! Windows can partition drives, lets do that» (DONT’T DO THAT). I did. Windows created the partitions I wanted. «Hmm, parted must be broken». I once again booted the install media. parted /dev/sda print now printed like the following:

OEM partition (primary)

(primary, no info, and about as big as the OEM partition)

Windows recovery (primary)

Windows OS (primary, boot)

Oookay. I went to ##windows on freenode and was told «Just fire up a windows recovery disc and use the ‘repair-startup’ util». Sure. Did that. Parted now tells me I have something like the following:

Windows recovery (primary)

Windows OS (primary, boot)

I lost my OEM-partition. huh.
Boot up windows just to see what it can see. The partition seems to be just unallocated space. Good.

Boot arch-install again. Partition my drive so it now looks like this:

Great! I didn’t do the same stupid mistake and try and create 5 primary partitions.
1 is windows Recovery, 2 is Windows OS, 5 is linux OS, and 6 is my ‘share-data-between-OSs-partition’.
And that’s the end of the partitioning.

Post-partitioning, actual install

After my clumsy partitioning adventures, I proceed to actually install Arch. The install proceeds as any arch-install does with forgotting things you do and what nots but I finally get everything I wanted installed.
I use Grub2, because I’ve always used GRUB for non-EFI systems. Install it like the wiki says Beginners guide, Install bootloader BIOS/MBR
Time to reboot.

«Invalid partition table!»

Eh? ctrl+alt+delete (because reboots solve everything).
Still the error. Accidently presses some random key.

«Welcome to GRUB!» and grub loads just fine. I can see three boot-options, Arch, Arch fall back, and Windows.
So, GRUB obviously works. But when I boot I get the «Invalid partition table!» error (white text on black background).

I found this thread: https://bbs.archlinux.org/viewtopic.php?id=148467 and tried it’s suggestions. Didn’t work. And as that thread is from 2012, I didn’t post in it because I don’t like grave-digging.

I’m at a loss as to what to do to get rid of the «Invalid partition table!» error. The error itself isn’t that bad, but it forces me to be active during the boot-process instead of just hitting the power button, go grab a cup of , and come back to a booted system.

I’ve done some research of my own (ofcourse!) and I think I actually do have a messed up MBR, based on this:

Now, if the MBR had been proper, file mbr.bin should also have printed the partitions.

An example would be like this:

It seems to me like Grub didn’t write a correct MBR, and I have no idea how to fix that. So I’m looking for help on how to proceed.

I bet someone will ask for a fdisk output, so here it is:

Last edited by chewtoy (2016-01-04 07:42:22)

#2 2015-12-30 13:35:42

Re: [Solved] Grub2 and «Invalid partition table!»

It seems to me like Grub didn’t write a correct MBR, and I have no idea how to fix that. So I’m looking for help on how to proceed.

What was the *exact* command that you used to install the GRUB loader to the MBR?

The simple answer here would seem to be to load up the Arch live ISO and re-install & re-configure GRUB but perhaps I’m missing something.

#3 2015-12-30 13:54:25

Re: [Solved] Grub2 and «Invalid partition table!»

What was the *exact* command that you used to install the GRUB loader to the MBR?

I followed the wiki, so, first I installed grub and os-prober:

Then, as the wiki says, I installed grub to /dev/sda (the drive, not a partition, and it’s the only drive in my computer) with

And then, finally, I generated the grub.cfg with

When I first got the issue, I though the same that I did something wrong.
After three tries I’m willing to rule out that I’m not following the instructions to the letter.

Читайте также:  Хороший антивирус для windows 10 рейтинг

#4 2015-12-30 13:58:06

Re: [Solved] Grub2 and «Invalid partition table!»

OK, try again but use this variant:

This command explicitly specifies that the loader should be placed on the MBR and is suitable for use in 64-bit systems in spite of the confusing nomenclature

Note that you will have to be (arch-)chroot’d into the system with /boot mounted when running that command (it can be done without chroot’ing with extra flag options).

EDIT: I’ve just noticed that the bootable flag is set on your Arch partition — try un-setting it.

I must admit that it’s been so long since I’ve booted GNU/Linux in a non-UEFI system that I can’t remember where the boot flag is supposed to be placed (if at all)

I think it should be fine to leave it unset but perhaps you should await the advice of those who know better than me.

Last edited by Head_on_a_Stick (2015-12-30 14:03:04)

#5 2015-12-30 15:56:18

Re: [Solved] Grub2 and «Invalid partition table!»

As your Arch install is in sda5, the boot flag is in the right place. Just reformat the sda6 partition to ext3, ext4 or ext2. As grub is already there, both Arch and Windows would boot up.

#6 2015-12-30 20:20:57

Re: [Solved] Grub2 and «Invalid partition table!»

OK, try again but use this variant:

This command explicitly specifies that the loader should be placed on the MBR and is suitable for use in 64-bit systems in spite of the confusing nomenclature

Note that you will have to be (arch-)chroot’d into the system with /boot mounted when running that command (it can be done without chroot’ing with extra flag options).

EDIT: I’ve just noticed that the bootable flag is set on your Arch partition — try un-setting it.

I must admit that it’s been so long since I’ve booted GNU/Linux in a non-UEFI system that I can’t remember where the boot flag is supposed to be placed (if at all)

I think it should be fine to leave it unset but perhaps you should await the advice of those who know better than me.

I tried that. No dice. Still invalid MBR.

Also, the boot-flag should be set on the partition that hold the second stage boot loader, which is in /boot, that I have one sda5. For the MBR, the boot-flag isn’t really of importance. The boot-flag is for GRUB, and GRUB works, it’s just that I seem to have a errornus MBR. Meaning, I get a «Invalid partition error!» on boot, but I then push (the) any button and GRUB starts to load, and I can boot both Linux and Windows.

As your Arch install is in sda5, the boot flag is in the right place. Just reformat the sda6 partition to ext3, ext4 or ext2. As grub is already there, both Arch and Windows would boot up.

What? How would that help fix my MBR?
I want sda6 to be NTFS, otherwise Windows can’t read it. And both Arch and Windows already boots just fine.

My problem is that I get a warning before GRUB even starts. During POST I get «Invalid partition table!», I can then press any button on my keyboard and GRUB starts to load and I can boot Arch and Windows.

#7 2015-12-31 03:10:00

Re: [Solved] Grub2 and «Invalid partition table!»

Can you paste a copy of your mbr? https://ptpb.pw/f

I’ve done some research of my own (ofcourse!) and I think I actually do have a messed up MBR, based on this:

Now, if the MBR had been proper, file mbr.bin should also have printed the partitions.

An example would be like this:

It seems to me like Grub didn’t write a correct MBR, and I have no idea how to fix that. So I’m looking for help on how to proceed.

FWIW this is probably normal. The reason `file` shows only «DOS/MBR boot sector» is because grub writes a «jump instruction» («eb 63 90») at the very beginning to indicate where does the boot code start. If you zero-out the three bytes (or even just the first) of the dump then `file` will show you the partition info again: https://gist.github.com/tomty89/6630204c6be34f5e9206

If you can afford to re-install grub, you can also try to zero-out the 440 bytes of the MBR and see if you still get the warning. If so, then it does not have anything to do with grub. If not, then try to re-install grub and see if the warning comes back right away.

Читайте также:  Как сбросить пароль root kali linux

What I concern more are the partition type of the extended partition and the CHS addresses (which should normally be ignored anyway though). For example, this is what fdisk in linux creates:

and this is what parted creates:

Or maybe some problem in the extended boot record (EBR) or some leftover bytes on the fourth partition entry region.

Last edited by tom.ty89 (2015-12-31 07:45:36)

#8 2016-01-04 06:27:14

Re: [Solved] Grub2 and «Invalid partition table!»

Can you paste a copy of your mbr? https://ptpb.pw/f
FWIW this is probably normal. The reason `file` shows only «DOS/MBR boot sector» is because grub writes a «jump instruction» («eb 63 90») at the very beginning to indicate where does the boot code start. If you zero-out the three bytes (or even just the first) of the dump then `file` will show you the partition info again: https://gist.github.com/tomty89/6630204c6be34f5e9206

From the edited I now get this:

If you can afford to re-install grub, you can also try to zero-out the 440 bytes of the MBR and see if you still get the warning. If so, then it does not have anything to do with grub. If not, then try to re-install grub and see if the warning comes back right away.

I’m unsure how to safely zero out the first parts though. dd’ing to sda seems. dangerous.
Do you have any suggestions on to how to do this safely?

What I concern more are the partition type of the extended partition and the CHS addresses (which should normally be ignored anyway though). For example, this is what fdisk in linux creates:

and this is what parted creates:

Or maybe some problem in the extended boot record (EBR) or some leftover bytes on the fourth partition entry region.

Hmm. Yes. It seems parted leaves more room between the partitions. Might it have to do with that parted reads 1kB as 1000B wheras fdisk reads 1kB as 1024B ? And their calculated sizes says that the partition should start at different sectors. Not sure how this should affect the MBR though.
Surely, you can create a disk with partitions that have a hugh gap in them and the MBR is still valid?

This must surely be valid, no?

#9 2016-01-04 07:17:42

Re: [Solved] Grub2 and «Invalid partition table!»

Well dd can always be dangerous, yes. The only way I can think of that is safer is, dd a mbr with grub code removed, instead of /dev/zero with bs=440 and count=1, so that dd won’t keep on erasing your drive if you forgot the two options: https://ptpb.pw/gvco.bin
In any case, make sure you have an installation medium that allows you to install grub back.

Leaves more room? What are you talking about? The difference I pointed out is on how they write the CHS address differently when it can no longer represent the corresonding LBA because of the exceeded limit. fdisk write «truncated» CHS addresses (e.g. 940851200 -> 0xe4c5, 71, 3 -> 0xc5, 71, 3), while parted just write the maximum valid CHS for all of them (0x3ff,254,63).

But as I’ve said, it shouldn’t matter anyway, the CHS addresses should simply be ignored unless your BIOS is really silly (or ancient?). So it’s probably more about the partition type code of partition 3 (0x5 vs 0xf), or something in the EBR, which resides in the the gap between start of sda3 (940851200) and sda5 (940853248), and describes the logical partitions (sda5 and sda6). Maybe you can dump that out and attach it here too:

Shouldn’t need a count= option. Apparently dd would just dump 2 sectors (1KiB) for you this way.

It’s true that parted use si unit to show partition information by default, but it doesn’t really do alignment in a very different way from fdisk. You can check that by switching unit to binary ones or sector in parted to see that.

Источник

Оцените статью