[Bug 750897] New: grub2-install failed to install to extended partition
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c0 Summary: grub2-install failed to install to extended partition Classification: openSUSE Product: openSUSE 12.2 Version: Milestone 1 Platform: x86 OS/Version: openSUSE 12.2 Status: NEW Severity: Major Priority: P5 - None Component: Bootloader AssignedTo: mchang@suse.com ReportedBy: mchang@suse.com QAContact: jsrain@suse.com Found By: Development Blocker: --- My partition setup: $ fdisk -l Device Boot Start End Blocks Id System /dev/sda1 2048 4208639 2103296 82 Linux swap / Solaris /dev/sda2 * 4208640 213921791 104856576 f W95 Ext'd (LBA) /dev/sda5 4210688 46153727 20971520 83 Linux Try to install grub2 (embedding boot.img) in extended partition as secondary bootstrap .. $ grub2-install --force /dev/sda2 /usr/sbin/grub2-probe: error: cannot find a GRUB drive for /dev/sda2. Check your device.map. However the device.map looks fine .. it did contains grub/os drive mapping correctly $ cat /boot/grub2/device.map (hd0) /dev/disk/by-id/ata-SAMSUNG_HM250HJ_S2ATJ1KZB00186 Inside grub2-install script, the command line invocation below has trouble: $ /usr/sbin/grub2-probe --device-map=/boot/grub2/device.map --target=drive --device /dev/sda2 expected result: return (hd0,msdos2) actual result: return /usr/sbin/grub2-probe: error: cannot find a GRUB drive for /dev/sda2. Check your device.map. Need to check why the failure occur and could the installation be successful after it get fixed? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c1 --- Comment #1 from Michael Chang <mchang@suse.com> 2012-03-07 07:55:35 UTC --- Created an attachment (id=479955) --> (http://bugzilla.novell.com/attachment.cgi?id=479955) output of "/usr/sbin/grub2-probe -vvv --device-map=/boot/grub2/device.map --target=drive --device /dev/sda2" -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c2 --- Comment #2 from Michael Chang <mchang@suse.com> 2012-03-07 10:55:30 UTC --- Try to use grub2-setup directly .. $ grub2-setup -f /dev/sda2 grub2-setup: error: unable to identify a filesystem in hd0; safety check can't be performed. Yes. Extended partition definitely had no file system (this the safety check becomes superfluous?). -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c3 --- Comment #3 from Michael Chang <mchang@suse.com> 2012-03-07 11:23:00 UTC --- Use --skip-fs-probe, I can embed core,img into extended partition and test result is positive. $ grub-setup --skip-fs-probe -f /dev/sda2 Need to figure our how to fix in grub2-install. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c4 --- Comment #4 from Michael Chang <mchang@suse.com> 2012-03-08 16:29:36 UTC --- (In reply to comment #3)
Use --skip-fs-probe, I can embed core,img into extended partition
s/core/boot/ -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c5 --- Comment #5 from Michael Chang <mchang@suse.com> 2012-03-09 04:09:45 UTC --- Created an attachment (id=480565) --> (http://bugzilla.novell.com/attachment.cgi?id=480565) Proposed patch to fix grub2-probe returning error for extended partition -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c6 --- Comment #6 from Michael Chang <mchang@suse.com> 2012-03-09 04:32:42 UTC --- The error returning : /usr/sbin/grub2-probe: error: cannot find a GRUB drive for /dev/sda2. Check your device.map. was due to extended partition is neglected in msdos partition iteration intentionally (not treated as normal partition), hooks would not trigger for it thus it wouldn't get any chance be added to internal structure, which leads to above error due to it's absent in it(and unfortunately the message is a bit misleading). Simply get rid of the extended partition check would make it be iterated, but got a lot of seek error. After checking the size of extended partition block device I realized why : $ dd if=/dev/sda2 of=/dev/null 2+0 records in 2+0 records out 1024 bytes (1.0kB) copied, 0.0107428 s, 95.3 kB/s We have to trim it's partition size to 2 (the size in partition table covers all logical partition).. it's not a disk block device like /dev/sda but a partition device which should not overlap others .. otherwise some tools may accidentally overwrites it. The test now works for me .. $ /usr/sbin/grub2-probe --device-map=/boot/grub2/device.map --target=drive --device /dev/sda2 (hd0,msdos2) -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c7 --- Comment #7 from Michael Chang <mchang@suse.com> 2012-03-09 07:23:28 UTC --- Created an attachment (id=480615) --> (http://bugzilla.novell.com/attachment.cgi?id=480615) add --skip-fs-probe option to grub2-install -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c8 --- Comment #8 from Michael Chang <mchang@suse.com> 2012-03-09 07:26:40 UTC --- With above two patches, grub2 installation works on extended partition. $ grub2-install --skip-fs-probe --force /dev/sda2 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c9 --- Comment #9 from Michael Chang <mchang@suse.com> 2012-03-09 08:46:18 UTC --- Created an attachment (id=480635) --> (http://bugzilla.novell.com/attachment.cgi?id=480635) patch for perl bootloader's grub2 module -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c10 Michael Chang <mchang@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED --- Comment #10 from Michael Chang <mchang@suse.com> 2012-03-09 09:00:30 UTC --- According to http://en.opensuse.org/openSUSE:How_to_contribute_to_Factory SR to factory for review .. cool. :) -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c11 --- Comment #11 from Michael Chang <mchang@suse.com> 2012-03-09 09:30:57 UTC --- created SRID 108601 for grub2 and SRID 108604 for perl bootloader. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c12 --- Comment #12 from Michael Chang <mchang@suse.com> 2012-03-12 02:48:31 UTC --- citing the kernel source for about the size of extended partition .. fs/partitions/msdos.c int msdos_partition(struct parsed_partitions *state) sector_t sector_size = bdev_logical_block_size(state->bdev) / 512; ... if (is_extended_partition(p)) { /* * prevent someone doing mkfs or mkswap on an * extended partition, but leave room for LILO * FIXME: this uses one logical sector for > 512b * sector, although it may not be enough/proper. */ sector_t n = 2; n = min(size, max(sector_size, n)); put_partition(state, slot, start, n); strlcat(state->pp_buf, " <", PAGE_SIZE); parse_extended(state, start, size); strlcat(state->pp_buf, " >", PAGE_SIZE); continue; } The "sector_size" is logical block size in unit or sector, which defaults to 1 (512 byte) on most hardware (See below). The "size" is extended partition size on msdos table which is unlikely be less than 2 (just one sector .. can't wonder any setup would it be created this way). /** * blk_queue_logical_block_size - set logical block size for the queue * @q: the request queue for the device * @size: the logical block size, in bytes * * Description: * This should be set to the lowest possible block size that the * storage device can address. The default of 512 covers most * hardware. **/ void blk_queue_logical_block_size(struct request_queue *q, unsigned short size) { q->limits.logical_block_size = size; if (q->limits.physical_block_size < size) q->limits.physical_block_size = size; if (q->limits.io_min < q->limits.physical_block_size) q->limits.io_min = q->limits.physical_block_size; } EXPORT_SYMBOL(blk_queue_logical_block_size); -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c13 --- Comment #13 from Bernhard Wiedemann <bwiedemann@suse.com> 2012-03-19 14:00:14 CET --- This is an autogenerated message for OBS integration: This bug (750897) was mentioned in https://build.opensuse.org/request/show/109935 Factory / perl-Bootloader -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c14 Neil Rickert <nrickert@ameritech.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nrickert@ameritech.net --- Comment #14 from Neil Rickert <nrickert@ameritech.net> 2012-03-19 23:04:58 UTC --- I have experienced this, and a related problem. This was with M2 installs. First system, a laptop. I installed 32 bit from the DVD image. The installer defaulted to putting grub2 on the extended partition (sda4). That failed, similar to what Chang is reporting, with an error message about a failure to map sda4. The failover to grub1 went smoothly enough. Second system, a desktop. I installed 64 bit from the DVD image. The installer defaulted to putting grub2 on the extended partition (sda4). Based on my experience with the laptop, I changed that to install on "/boot" (sda6). The grub install went fine, but the reboot to complete the install failed. Booting to rescue mode, I noticed that the extended partition had been marked active even though grub2 was not installed there. That is surely a bug. I switched the active partition back to where it should have been, and rebooted. That got me to my grub boot menu for 12.1, and there I selected the entry I already had to boot the 12.2 M2 system. Things went fine. If the installer had done something like: dd if=/dev/sda6 of=/dev/sda4 bs=440 count=1 after the grub2 install, that would probably also have worked. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c15 --- Comment #15 from Michael Chang <mchang@suse.com> 2012-03-20 02:22:06 UTC --- (In reply to comment #14) Thanks for testing and feedback.
on my experience with the laptop, I changed that to install on "/boot" (sda6). The grub install went fine, but the reboot to complete the install failed. Booting to rescue mode, I noticed that the extended partition had been marked active even though grub2 was not installed there. That is surely a bug. I
To be honest I'm not sure whether this is bug or not. I suppose it isn't. The /boot is logical partition and not able to be directly chainloaded via master boot code(only primary and extended partitions are possible via toggling the active flag), so the best effort we can do is marking extended partition to active, jumping to it and anticipating that there's boot code there that is in charge of chainloading to the other logical partitions .. Above is just my two cents, I'm not sure grub could work on such setup or not in the past, if yes this is definitely a regression bug. But if not that wouldn't surprise me because that's also expected. :)
switched the active partition back to where it should have been, and rebooted. That got me to my grub boot menu for 12.1, and there I selected the entry I already had to boot the 12.2 M2 system. Things went fine.
Just out of my curios, did you flag /dev/sda5 to active to rescue this? Could you give more description on how you did to rescue the system? I want to know because I'm afraid there's something I didn't understand ..
If the installer had done something like: dd if=/dev/sda6 of=/dev/sda4 bs=440 count=1 after the grub2 install, that would probably also have worked.
Yes. it would work. Btw .. next milestone should fix installing to extended partition .. things should get work out or box (hopefully). -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c16 --- Comment #16 from Neil Rickert <nrickert@ameritech.net> 2012-03-20 02:55:07 UTC --- If it didn't work, there is something buggy about that. As I recall, the grub1 install might do something similar (switch the active flag). However, there's an option to have it not do that. And I always select that option when installing on a logical drive. That option was not available on the grub2 configuration screen. I'm hoping it will get there by the time of the final 12.2 release. Flagging "/dev/sda5" active would not help. I flagged "/dev/sda3" active, since that's what I normally use. That gets me to the grub menu for my 12.1 install. I have an entry in the 12.1 menu to boot "/dev/sda6" (chainloader), and using that got me to the grub2 menu. My personal opinion: If grub is not installed on one of the primary partition sectors, then the installer should leave the active flag the way it is, and perhaps display a notice that the user will need to find a way to boot from the logical partition where it was installed. In any case, if installing to the extended partition will work for future versions, that should solve the problem. I added my comments above just to provide feedback on where there might be problems with M2. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c17 --- Comment #17 from Michael Chang <mchang@suse.com> 2012-03-20 04:26:14 UTC --- (In reply to comment #16)
If it didn't work, there is something buggy about that.
As I recall, the grub1 install might do something similar (switch the active flag). However, there's an option to have it not do that. And I always select that option when installing on a logical drive. That option was not available on the grub2 configuration screen. I'm hoping it will get there by the time of the final 12.2 release.
Yes I am aware of such option in grub. It should be added in final 12.2 release .
Flagging "/dev/sda5" active would not help. I flagged "/dev/sda3" active, since that's what I normally use. That gets me to the grub menu for my 12.1 install. I have an entry in the 12.1 menu to boot "/dev/sda6" (chainloader), and using that got me to the grub2 menu.
Now I got it. Thanks for your explanations.
My personal opinion: If grub is not installed on one of the primary partition sectors, then the installer should leave the active flag the way it is, and perhaps display a notice that the user will need to find a way to boot from the logical partition where it was installed.
Sounds good to me. We might have to consider this in the future (recently the focus is on completing grub2 function, compared grub2, still lots of work to do..).
In any case, if installing to the extended partition will work for future versions, that should solve the problem.
I added my comments above just to provide feedback on where there might be problems with M2.
Thanks. That's very much appreciated. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c18 --- Comment #18 from Bernhard Wiedemann <bwiedemann@suse.com> 2012-03-20 16:00:32 CET --- This is an autogenerated message for OBS integration: This bug (750897) was mentioned in https://build.opensuse.org/request/show/110168 Factory / grub2 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=750897 https://bugzilla.novell.com/show_bug.cgi?id=750897#c19 Michael Chang <mchang@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #19 from Michael Chang <mchang@suse.com> 2012-07-05 07:04:47 UTC --- Close as the fix is in factory. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com