Opened 10 years ago

Closed 10 years ago

#3122 closed bug (fixed)

makebootable says invalid partition index

Reported by: plfiorini Owned by: bonefish
Priority: normal Milestone: R1
Component: Build System Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

makebootable says invalid partition index installing into a partition from Ubuntu 8.04.1, this doesn't happen on VMware.

The problem occurs with primary and logical partitions (marked eb - BFS), I tried installing on the first partition which was marked 7 (NTFS) and it worked fine.

I also tried to boot from a USB flash drive, press SPACE, select the volume on the sata hard disk (because I can't boot from USB ehci), and do makebootable from there but it doesn't make the partition bootable so when I select it from the GRUB menu it doesn't boot.

The same problem was reported here: http://www.haiku-os.org/community/forum/problems_with_makebootable

If I boot

Attachments (1)

syslog (43.2 KB) - added by plfiorini 10 years ago.
syslog from a Haiku system booted from /dev/sda3

Download all attachments as: .zip

Change History (21)

comment:1 Changed 10 years ago by plfiorini

I forgot a detail: the NTFS partition was the first one. The problem seems not related to the partition type anyway. When I tried on VMware I installed on the first partition of the second IDE disk and it worked fine. Unfortunately I cannot install Haiku on the first partition because I already installed Vista.

comment:2 Changed 10 years ago by umccullough

Are your partitions in the same physical order as their indexes?

I ask because using parted/gparted to insert a partition between two others will usually give the new partition an index number higher than all of the partitions, leaving the other partition numbers the same (at least, for linux/grub usage IIRC).

I'm wondering if this is the case as it might explain part of the confusion - and I think I and others have experienced issues with this in the past.

comment:3 Changed 10 years ago by umccullough

Component: - GeneralBuild System
Owner: changed from axeld to bonefish

Guessing this is a build system issue - someone in the IRC channel ran into it again yesterday while trying to compile Haiku directly to a partition

comment:4 Changed 10 years ago by plfiorini

Still happens here, eafter 9 months happens again with a different partition map:

Disk /dev/sda: 750.1 GB, 750156374016 bytes 255 heads, 63 sectors/track, 91201 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x72206f74

Device Boot Start End Blocks Id System

/dev/sda1 1 32635 262140606 7 HPFS/NTFS /dev/sda2 32636 52216 157284382+ 7 HPFS/NTFS /dev/sda3 52217 53260 8385930 eb BeOS fs /dev/sda4 * 53261 91201 304761082+ f W95 Ext'd (LBA) /dev/sda5 53261 54304 8385898+ eb BeOS fs /dev/sda6 54305 56914 20964793+ 83 Linux

/dev/sda3 is a primary partition...

comment:5 Changed 10 years ago by plfiorini

Sorry for the noise, I just forgot to put fdisk output into a code block.

Disk /dev/sda: 750.1 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x72206f74

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       32635   262140606    7  HPFS/NTFS
/dev/sda2           32636       52216   157284382+   7  HPFS/NTFS
/dev/sda3           52217       53260     8385930   eb  BeOS fs
/dev/sda4   *       53261       91201   304761082+   f  W95 Ext'd (LBA)
/dev/sda5           53261       54304     8385898+  eb  BeOS fs
/dev/sda6           54305       56914    20964793+  83  Linux

comment:6 Changed 10 years ago by plfiorini

From a usb key, makebootable just work fine. I've got Haiku installed into my hard drive booting from a usb key.

comment:7 in reply to:  6 ; Changed 10 years ago by bonefish

Replying to plfiorini:

From a usb key, makebootable just work fine.

I suppose you mean from within Haiku.

I've got Haiku installed into my hard drive booting from a usb key.

Can you attach Haiku's syslog please.

comment:8 Changed 10 years ago by begasus

I've got the same problem when trying to write the image to disk with "jam -q @disk" This is in a freshly partitioned (partition magic) disk where atm ZETA and Debian are installed. Debian is the system I use to build the image on and try to write it to disk. Output of fdisk /dev/hdb is:

Disk /dev/hdb: 81.9 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x43056cb6

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1               1        2550    20482843+  83  Linux
/dev/hdb2            2551        5100    20482875   eb  BeOS fs
/dev/hdb3            5101        9964    39070080    f  W95 Ext'd (LBA)
/dev/hdb5            5101        6375    10241406   eb  BeOS fs
/dev/hdb6            6376        8288    15366141   eb  BeOS fs
/dev/hdb7            8289        9702    11357923+   b  W95 FAT32
/dev/hdb8            9703        9964     2104483+  82  Linux swap / Solaris

the partition I try to write to is /dev/hdb6 and Debian is giving me:

Creating image ...
Error: Invalid partition index 6.

when I try to write it to disk.

First primary partitions are for Debian and ZETA, the other eb partitions where created as fat32 at first, afterwards I changed those to eb while I installed Debian (opened a seperate console terminal for fdisk to do this and rebooted to actualy install Debian after that). The 2 logical partitions where formatted as bfs with ZETA (don't think this should be an issue as I've never had problems with that before). No changes where made after the initial partitioning with partition magic.

Changed 10 years ago by plfiorini

Attachment: syslog added

syslog from a Haiku system booted from /dev/sda3

comment:9 in reply to:  7 Changed 10 years ago by plfiorini

Replying to bonefish:

Replying to plfiorini:

From a usb key, makebootable just work fine.

I suppose you mean from within Haiku.

Yes: since I couldn't install Haiku from sources from my Linux system, I created an image and dd'ed into a USB key which I used to boot and install Haiku, from within Haiku it seems makebootable works.

I've got Haiku installed into my hard drive booting from a usb key.

Can you attach Haiku's syslog please.

Attached.

The first two partitions were created from an Ubuntu live cd (I don't remember if I used parted or fdisk), then I installed Vista on the first and XP on the second. Some days ago I booted from an openSUSE 11.1 live cd created with susestudio.com and created the other partitions: /dev/sda3 for Haiku, and the logical partitions.

comment:10 Changed 10 years ago by bonefish

The scanning of the extended partition is truncated/dropped in the syslog, but at least for the primary partitions Haiku agrees with fdisk. I've added a bit of error output to makebootable in hrev32662. Please try to run it again under Linux and add the results to the ticket. BTW, you can just run:

jam -q run :'<build>makebootable' /dev/sda3

comment:11 Changed 10 years ago by plfiorini

plfiorini@linux-jbiz:~/develop/haiku/trunk> svnversion .
32662
plfiorini@linux-jbiz:~/develop/haiku/trunk/generated.x86gcc4hybrid> jam -q run :'<build>makebootable' /dev/sda3
...patience...
...found 1212 target(s)...
...updating 3 target(s)...
C++ /home/plfiorini/develop/haiku/trunk/generated.x86gcc4hybrid/objects/linux/x86/release/tools/makebootable/platform/bios_ia32/makebootable.o
Link /home/plfiorini/develop/haiku/trunk/generated.x86gcc4hybrid/objects/linux/x86/release/tools/makebootable/platform/bios_ia32/makebootable
XRes1 /home/plfiorini/develop/haiku/trunk/generated.x86gcc4hybrid/objects/linux/x86/release/tools/makebootable/platform/bios_ia32/makebootable
Chmod1 /home/plfiorini/develop/haiku/trunk/generated.x86gcc4hybrid/objects/linux/x86/release/tools/makebootable/platform/bios_ia32/makebootable
RunCommandLine1 <unique!target>run_0
Error: Invalid partition index 3.
partitions:
 0: <empty>
 1: <empty>
 2: <empty>
 3: <empty>

target=target;
for t in /home/plfiorini/develop/haiku/trunk/generated.x86gcc4hybrid/objects/linux/x86/release/tools/makebootable/platform/bios_ia32/makebootable ; do
target=${target}X
eval "${target}=${t}"
done
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/plfiorini/develop/haiku/trunk/generated.x86gcc4hybrid/objects/linux/lib
"$targetX" "/dev/sda3"

...failed RunCommandLine1 <unique!target>run_0 ...
...failed updating 1 target(s)...
...updated 2 target(s)...

comment:12 Changed 10 years ago by bonefish

The partition map looks empty. The partition map parser has probably encountered errors that made it ignore the defined partitions. Please enabled debugging in src/add-ons/kernel/partitioning_systems/intel/PartitionMapParser.cpp by uncommenting line 25. It should then read:

#define TRACE_ENABLED

Then run the jam line again and post the output here.

comment:13 Changed 10 years ago by begasus

Enabling the debug doesn't seem to work, build fails on PartitionMapParser, output:

InitScript1 /home/begasus/develop/trunk/generated-gcc4/haiku.image-init-vars 
C++ /home/begasus/develop/trunk/generated-gcc4/objects/linux/x86/release/tools/makebootable/platform/bios_ia32/PartitionMapParser.o 
/home/begasus/develop/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMapParser.cpp:6: error: stray ‘@’ in program
/home/begasus/develop/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMapParser.cpp:2: error: expected constructor, destructor, or type conversion before numeric constant
In file included from /usr/include/c++/4.3/new:45,
                 from /home/begasus/develop/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMapParser.cpp:19:
/usr/include/c++/4.3/exception:40: error: expected declaration before end of line

cc -c "/home/begasus/develop/trunk/src/add-ons/kernel/partitioning_systems/intel/PartitionMapParser.cpp" -O -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare -Wno-multichar -D_ZETA_USING_DEPRECATED_API_=1 -D_ZETA_TS_FIND_DIR_=1 -include BeOSBuildCompatibility.h -D_USER_MODE -DARCH_x86 -D_NO_INLINE_ASM -D__INTEL__ -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DHAIKU_HOST_PLATFORM_LINUX -iquote /home/begasus/develop/trunk/build/user_config_headers -iquote /home/begasus/develop/trunk/build/config_headers -iquote /home/begasus/develop/trunk/src/tools/makebootable/platform/bios_ia32 -iquote /home/begasus/develop/trunk/generated-gcc4/objects/common/tools/makebootable/platform/bios_ia32 -iquote /home/begasus/develop/trunk/generated-gcc4/objects/linux/x86/common/tools/makebootable/platform/bios_ia32 -iquote /home/begasus/develop/trunk/generated-gcc4/objects/haiku/x86/common/tools/makebootable/platform/bios_ia32 -iquote /home/begasus/develop/trunk/src/bin/makebootable/platform/bios_ia32 -iquote /home/begasus/develop/trunk/src/add-ons/kernel/partitioning_systems/intel -iquote /home/begasus/develop/trunk/src/add-ons/kernel/file_systems/bfs -I /home/begasus/develop/trunk/headers/private/storage -I /home/begasus/develop/trunk/headers/private/shared -I /home/begasus/develop/trunk/headers/build/host/linux -I /home/begasus/develop/trunk/headers/build -I /home/begasus/develop/trunk/headers/build/os -I /home/begasus/develop/trunk/headers/build/os/app -I /home/begasus/develop/trunk/headers/build/os/drivers -I /home/begasus/develop/trunk/headers/build/os/kernel -I /home/begasus/develop/trunk/headers/build/os/interface -I /home/begasus/develop/trunk/headers/build/os/opengl -I /home/begasus/develop/trunk/headers/build/os/storage -I /home/begasus/develop/trunk/headers/build/os/support -o "/home/begasus/develop/trunk/generated-gcc4/objects/linux/x86/release/tools/makebootable/platform/bios_ia32/PartitionMapParser.o" ;

...failed C++ /home/begasus/develop/trunk/generated-gcc4/objects/linux/x86/release/tools/makebootable/platform/bios_ia32/PartitionMapParser.o ...
...skipped <build>makebootable for lack of <src!tools!makebootable!platform!bios_ia32>PartitionMapParser.o...
...skipped <HaikuImage>haiku.image-init-vars for lack of <build>makebootable...
...skipped hdb6 for lack of <HaikuImage>haiku.image-init-vars...
...failed updating 1 target(s)...
...skipped 3 target(s)...
...updated 1 target(s)...

comment:14 in reply to:  13 Changed 10 years ago by bonefish

Replying to begasus:

Enabling the debug doesn't seem to work, build fails on PartitionMapParser, output:

You must have messed something up. Lines 2 and 6 are in the copyright header. Please revert and only uncomment the single line mentioned above.

comment:15 Changed 10 years ago by begasus

My bad ... seems something got screwed up. I deleted the file and the object folder and did a svn up to restore the file, uncommented the line and did a fresh build. Here's the output from the terminal where it fails:

BuildHaikuImage1 /dev/hdb6 

Creating image ...
intel: _ParsePrimary(): partition 1: bad location, ignoring
intel: _ParsePrimary(): partition 2: bad location, ignoring
Error: Invalid partition index 6.
partitions:
 0: offset:            32256, size:      20974431744, type: 83
 1: <empty>
 2: <empty>
 3: <empty>

comment:16 Changed 10 years ago by mmlr

Just a note: I've seen the same error message on OS X the other day. There a GPT is used and the MBR is not able to fully represent the partitioning. After syncing the GPT map with the MBR (using rEFIt) it worked though. The real fix would of course be to support GPT from our build system (or use native methods to get the offsets for that matter). I just wanted to mention it here, in case one of the problematic cases is actually using GPT. A fully protective MBR in GPT will for example always only contain a single partition spanning the whole disk, so this would never work.

comment:17 Changed 10 years ago by begasus

Just checked out with debugging enable to build gcc2 and gcc4 images, when writing to disk the error is the same. I did a CD build on both compiler versions and was able to use the LiveCD Installer to install both systems to partition, no problem with makebootable there. No changes where made by the Installer as I checked into booting both Debian and ZETA afterwards. Finaly got both systems up and running now.

comment:18 Changed 10 years ago by bonefish

@begasus & plfiorini: Please try hrev32674. I hope that fixes the problem.

@mmlr: Yep GPT support in makebootable would certainly be nice. I don't know whether the partition table parsing is well-separated in the GPT kernel module. If so, it should be easy add it to makebootable. At any rate feel free to do so! :-)

comment:19 Changed 10 years ago by begasus

With the latest fix to makebootable it's working again. Just did a fresh compile @disk and no errors anymore, can't test the boot from partition but I doubt it would be a problem anymore (got some uploads running there atm). Thanks for the fix bonefish!!!

comment:20 Changed 10 years ago by bonefish

Resolution: fixed
Status: newclosed

Assuming it's also fixed for plfiorini (please reopen, if not), I'm closing the ticket.

Note: See TracTickets for help on using tickets.