Bug 18271 - Grub2 Installer does not recognize my OpenBSD installation
Summary: Grub2 Installer does not recognize my OpenBSD installation
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 5
Hardware: i586 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: QA Team
QA Contact:
URL:
Whiteboard: advisory MGA5-32-OK mga5-64-ok
Keywords: validated_update
Depends on:
Blocks:
 
Reported: 2016-04-26 14:25 CEST by Elmar Stellnberger
Modified: 2016-05-07 11:20 CEST (History)
5 users (show)

See Also:
Source RPM: os-prober
CVE:
Status comment:


Attachments
corrected 91bsd script (728 bytes, text/plain)
2016-04-28 13:56 CEST, Elmar Stellnberger
Details
screen output of os-prober before installing 91bsd (32 bytes, text/plain)
2016-04-28 13:57 CEST, Elmar Stellnberger
Details
screen output of os-prober after installing 91bsd (64 bytes, text/plain)
2016-04-28 13:57 CEST, Elmar Stellnberger
Details
/lib/os-probes/60ufs-test (945 bytes, text/plain)
2016-05-01 13:41 CEST, Elmar Stellnberger
Details
/lib/os-probes/mounted/91bsd (848 bytes, text/plain)
2016-05-01 13:43 CEST, Elmar Stellnberger
Details
New dir layout (63.58 KB, image/png)
2016-05-01 16:06 CEST, Barry Jackson
Details

Description Elmar Stellnberger 2016-04-26 14:25:50 CEST
The Grub auto-installer as invokable via the Mageia-DVD does not recognize my OpenBSD installation. Instead I have to add a boot entry manually to /boot/grub2/grub.conf which will however get overwritten upon the next automatic installation. The only thing the Grub-installer would need to do is check for a partition with signature-id a6 (as listable via fdisk -l) and then offer to chainload it.
Marja Van Waes 2016-04-26 15:05:18 CEST

CC: (none) => marja11
Assignee: bugsquad => zen25000
Summary: Grub Installer does not recognize my OpenBSD installation => Grub2 Installer does not recognize my OpenBSD installation

Comment 1 Barry Jackson 2016-04-27 13:49:26 CEST
Add your custom menu entry to /boot/grub2/custom.cfg

This will be offered on the next boot and will never be overwritten.

You can then run uppdate-grub2 to remove the entry that you manually added to /boot/grub2/grub.cfg (NOTE that this is not required to make the new custom entry work.)
Comment 2 Thierry Vignaud 2016-04-28 10:44:34 CEST
Do you have os-prober installed?

Source RPM: (none) => grub2, os-prober
Keywords: (none) => NEEDINFO
CC: (none) => thierry.vignaud

Comment 3 Elmar Stellnberger 2016-04-28 11:02:34 CEST
Yes, os-prober is installed, but update-grub2 does not recognize my OpenBSD partition. It has to be configured manually in /boot/grub2/custom.cfg.
Comment 4 Barry Jackson 2016-04-28 13:04:18 CEST
Please give the output of 
su
os-prober

then could you try the script here:

http://linux.debian.maint.boot.narkive.com/b4BD5uie/teach-os-prober-to-recognize-openbsd

Save it as /lib/os-probes/mounted/91bsd and make it executable.

Then run os-prober as root and again put the output here.

You can then test using update-grub2 and see if it actually works.
Comment 5 Elmar Stellnberger 2016-04-28 13:56:13 CEST
Created attachment 7701 [details]
corrected 91bsd script

There were a few errors in this script; now they should be corrected.
Comment 6 Elmar Stellnberger 2016-04-28 13:57:11 CEST
Created attachment 7702 [details]
screen output of os-prober before installing 91bsd
Comment 7 Elmar Stellnberger 2016-04-28 13:57:37 CEST
Created attachment 7703 [details]
screen output of os-prober after installing 91bsd
Comment 8 Elmar Stellnberger 2016-04-28 14:06:08 CEST
... and the boot loder entry added by update-grub2 through this works well; i.e. it really boots into OpenBSD.
Comment 9 Barry Jackson 2016-04-28 16:23:00 CEST
Nice!

Thanks for your work testing and correcting the script.

I will add this to the os-prober package for cauldron and generate an update for Mga5.

Will you be available to test the updated package for qa when the time comes?

Otherwise I don't think there will be anyone with a FreeBSD system available for testing.
Comment 10 Elmar Stellnberger 2016-04-28 16:26:15 CEST
Yes; I can promise to do so. I will keep updating my system until os-prober gets updated and then see if it was packaged all right ...
Comment 11 Barry Jackson 2016-04-28 16:31:51 CEST
It won't go to Mga5 updates until after it has been tested by qa (probably you in this case). You will see how the process works by following this bug and you will be able to test the new package when it goes into 5/core/updates_testing.

Thanks.
Comment 12 Barry Jackson 2016-04-28 18:10:25 CEST
#########################################
Update Advisory

 os-prober-1.65-9.3.mga5 has been submitted to 5/core/updates_testing

#########################################
Description

This update fixes an issue where OpenBSD installations were not present in the Mageia grub2 boot menu.

The cause was that os-prober did not have the capability to detect BSD installations.

#########################################
References
https://bugs.mageia.org/show_bug.cgi?id=18271
http://linux.debian.maint.boot.narkive.com/b4BD5uie/teach-os-prober-to-recognize-openbsd
The above script with corrections by the reporter here seems to fix the problem.

#########################################
Affected files

os-prober-1.65-9.3.mga5.src.rpm
os-prober-1.65-9.3.mga5.i586.rpm
os-prober-debuginfo-1.65-9.3.mga5.i586.rpm
os-prober-1.65-9.3.mga5.x86_64.rpm
os-prober-debuginfo-1.65-9.3.mga5.x86_64.rpm

#########################################
Testing

Install Mageia alongside an installation of OpenBSD.
Allow Mageia to install grub2 and check whether OpenBSD is bootable from the Mageia Grub2 boot menu.

NOTE: The bug reporter has offered to do some testing.

#########################################

Re-assigning to QA

Assignee: zen25000 => qa-bugs
Keywords: NEEDINFO => (none)

Comment 13 claire robinson 2016-04-28 18:38:46 CEST
Elmar, see https://wiki.mageia.org/en/Enabling_the_Testing_media

Please don't install everything from the testing media, only the packages listed above.
claire robinson 2016-04-28 18:40:06 CEST

Severity: enhancement => normal

claire robinson 2016-04-28 18:40:15 CEST

Component: Release (media or process) => RPM Packages

claire robinson 2016-04-28 18:41:11 CEST

Source RPM: grub2, os-prober => os-prober

Comment 14 Lewis Smith 2016-04-29 22:32:34 CEST
Testing M5 x64 real EFI hardware, but not xBSD

Updated to os-prober-1.65-9.3
Ran os-prober directly. After my usual 10m wait, it popped out all the correct installed OSs - several Mageias & other Linux's + Win8.
Ran update-grub [2], which also takes 10m on my system.
Re-booted, and the Grub2 menu included all installed OSs. (This is the first time that I have noticed that the menu scrolls without this being apparent: later entries are initially hidden).

For me OK on the basis of no ill effects. If Elmar can update *just* os-prober from 'core updates testing' and confirm for OpenBSD (32-bit?), so much the better.

Whiteboard: (none) => MGA5-64-OK
CC: (none) => lewyssmith

Comment 15 Elmar Stellnberger 2016-04-30 10:53:17 CEST
  No, that did not work yet. No OpenBSD menu entry was generated by os-prober-1.65-9.3.mga5.i586.rpm. I would believe that you will have to mark /usr/lib/os-probes/mounted/91bsd as executable.

# ls -l /usr/lib/os-probes/mounted/91bsd
-rw-r--r-- 1 root root 726 Apr 28 17:50 /usr/lib/os-probes/mounted/91bsd

After changing this it appeared to work correctly.
Comment 16 Barry Jackson 2016-05-01 01:26:16 CEST
Indeed, thanks Elmar - my mistake - sorry.

Fixed in os-prober-1.65-9.4.mga5 - also in Cauldron.

New advisory:

#########################################
Update Advisory

 os-prober-1.65-9.4.mga5 has been submitted to 5/core/updates_testing

#########################################
Description

This update fixes an issue where OpenBSD installations were not present in the Mageia grub2 boot menu.

The cause was that os-prober did not have the capability to detect BSD installations.

#########################################
References
https://bugs.mageia.org/show_bug.cgi?id=18271
http://linux.debian.maint.boot.narkive.com/b4BD5uie/teach-os-prober-to-recognize-openbsd
The above script with corrections by the reporter here seems to fix the problem.

#########################################
Affected files

os-prober-1.65-9.4.mga5.src.rpm
os-prober-1.65-9.4.mga5.i586.rpm
os-prober-debuginfo-1.65-9.4.mga5.i586.rpm
os-prober-1.65-9.4.mga5.x86_64.rpm
os-prober-debuginfo-1.65-9.4.mga5.x86_64.rpm

#########################################
Testing

Install Mageia alongside an installation of OpenBSD.
Allow Mageia to install grub2 and check whether OpenBSD is bootable from the Mageia Grub2 boot menu.

#########################################

CC: (none) => zen25000

Comment 17 Lewis Smith 2016-05-01 09:21:38 CEST
(In reply to Elmar Stellnberger from comment #15)
>   No, that did not work yet. No OpenBSD menu entry was generated by
> os-prober-1.65-9.3.mga5.i586.rpm. I would believe that you will have to mark
> /usr/lib/os-probes/mounted/91bsd as executable.
> # ls -l /usr/lib/os-probes/mounted/91bsd
> -rw-r--r-- 1 root root 726 Apr 28 17:50 /usr/lib/os-probes/mounted/91bsd
> After changing this it appeared to work correctly.
Thaks for that useful test. Please can you confirm that Barry's latest version (Comment 16)  os-prober-1.65-9.4  from Core Updates Testing does work for you?
TIA

I will re-try x64 on a 'no regression' basis.

Whiteboard: MGA5-64-OK => (none)

Comment 18 Lewis Smith 2016-05-01 10:12:03 CEST
Re-testing x64 real EFI hardware
 os-prober-1.65-9.4.mga5
Did update-grub, re-booted, all installed OSs correctly shown in the grub2 menu. On a 'no-reversion' basis, again this is OK for me; but I refrain this time from putting a 64 OK until Elmar has confirmed this latest update for real.
Comment 19 Elmar Stellnberger 2016-05-01 13:33:52 CEST
  Humm; that of course only works if the OpenBSD partition has already been mounted manually by the user which would rarely be the case in practice. In order to overcome this issue I have worked upon a solution that would recognize OpenBSD merely by looking at all UFS-partitions. Just have a look at the solution I wanna propse ...
Comment 20 Elmar Stellnberger 2016-05-01 13:41:01 CEST
Created attachment 7728 [details]
/lib/os-probes/60ufs-test

This script picks out all ufs partitions whether mounted or not and then processes all mounted/*bsd scripts on them. Basically keeping the 91bsd script in the mounted folder without creating an own folder for it is a bit misleading though you are free to change this. You could call such a folder f.i. 'ufs' in addition to the 'mounted' folder.
Comment 21 Elmar Stellnberger 2016-05-01 13:43:44 CEST
Created attachment 7729 [details]
/lib/os-probes/mounted/91bsd

  Basically the most clean solution would be to put the 91bsd script in its own folder called 'ufs' and then link it to the 'mounted' folder as it can and needs to handle both cases: the mounted and the unmounted case.
Comment 22 Barry Jackson 2016-05-01 16:06:47 CEST
Created attachment 7730 [details]
New dir layout

I have not had time to check in detail how all this will works, but if I understand correctly the required file layout would be as the attached image, where /mounted/91bsd is a symlink to /ufs/91bsd.
Does this look OK?
Comment 23 Elmar Stellnberger 2016-05-01 16:44:41 CEST
Yes, that would certainly work. For reasons of consistency you should then update /lib/os-probes/60ufs-test to point to ufs/* instead of mounted/*bsd (simply search for that string and replace it). Accessing the mounted/*bsd directory instead of ufs/* was just a 'dirty hack' in order to make things work even without any update to the file layout.
Comment 24 Barry Jackson 2016-05-01 17:15:48 CEST
Thanks Elmar,
os-prober-1.65-9.5.mga5 has been submitted to 5/core/updates_testing.
See how this goes ;)
Comment 25 Barry Jackson 2016-05-01 19:19:02 CEST
In Cauldron I did a test with the same changes and it looks OK as far as I can tell.
Fiddling the debug logger to output to screen I see:

[baz@jackodesktop ~]$ sudo os-prober|egrep "bsd|ufs"
50mounted-tests: debug: running subtest /usr/lib/os-probes/mounted/91bsd
os-prober: debug: running /usr/lib/os-probes/60ufs-test on /dev/sda1
50mounted-tests: debug: running subtest /usr/lib/os-probes/mounted/91bsd
os-prober: debug: running /usr/lib/os-probes/60ufs-test on /dev/sdc1
Comment 26 Barry Jackson 2016-05-01 20:06:56 CEST
Elmar - please test os-prober-1.65-9.6.mga5 - somehow the exec bit got lost on 91bsd in the previous build - I'm not having much luck with that :\
Comment 27 Elmar Stellnberger 2016-05-01 21:03:55 CEST
  Barry, I just noticed that you have once more forgotten the x-permission for ufs/91bsd. The link from mounted/91bsd works though it would be more elegant to ln -s ../ufs/91bsd /usr/lib/os-probes/mounted/91bsd.

# ls -l mounted/91bsd 
lrwxrwxrwx 1 root root 39 Mai  1 17:13 mounted/91bsd -> ../../../../usr/lib/os-probes/ufs/91bsd*
Comment 28 Barry Jackson 2016-05-02 00:57:17 CEST
(In reply to Elmar Stellnberger from comment #27)
>   Barry, I just noticed that you have once more forgotten the x-permission
> for ufs/91bsd.

Yes, see https://bugs.mageia.org/show_bug.cgi?id=18271#c26 :\

> The link from mounted/91bsd works though it would be more
> elegant to ln -s ../ufs/91bsd /usr/lib/os-probes/mounted/91bsd.
> 
> # ls -l mounted/91bsd 
> lrwxrwxrwx 1 root root 39 Mai  1 17:13 mounted/91bsd ->
> ../../../../usr/lib/os-probes/ufs/91bsd*

That relative link is created by rpm, bear in mind that it is created during package build when nothing is actually where it will finally end up.
In the spec it is:
ln -sf %{_libexecdir}/os-probes/ufs/91bsd %{buildroot}%{_libexecdir}/os-probes/mounted/91bsd

...but more importantly does that now work?
Comment 29 Elmar Stellnberger 2016-05-02 16:42:19 CEST
  Now with os-prober-1.65-9.6.mga5.i586.rpm everything seems to work correctly. I have tested it in three different configurations, two different mount states, one unmounted and the mount state stayed the same while all partitions were recognized correctly. At least as far as I can test that on my side everything works well now.

Resolution: (none) => FIXED
Status: NEW => RESOLVED

Comment 30 claire robinson 2016-05-02 18:25:14 CEST
Let's push it to updates then so everybody can have it.

Thanks Elmar & Barry.

Resolution: FIXED => (none)
Status: RESOLVED => REOPENED

Comment 31 Barry Jackson 2016-05-02 18:38:57 CEST
I think Elmar can only test this on 32 bit.
So, it has not been tested in a live situation with an OpenBSD system alongside Mageia 64bit.

@Elmar
Can you envisage any problems with this on 64 bit?


Here is an updated advisory with the correct subrel:

#########################################
Update Advisory

 os-prober-1.65-9.6.mga5 has been submitted to 5/core/updates_testing

#########################################
Description

This update fixes an issue where OpenBSD installations were not present in the Mageia grub2 boot menu.

The cause was that os-prober did not have the capability to detect BSD installations.

#########################################
References
https://bugs.mageia.org/show_bug.cgi?id=18271
http://linux.debian.maint.boot.narkive.com/b4BD5uie/teach-os-prober-to-recognize-openbsd
The above script with corrections by the reporter here seems to fix the problem.

#########################################
Affected files

os-prober-1.65-9.6.mga5.src.rpm
os-prober-1.65-9.6.mga5.i586.rpm
os-prober-debuginfo-1.65-9.6.mga5.i586.rpm
os-prober-1.65-9.6.mga5.x86_64.rpm
os-prober-debuginfo-1.65-9.6.mga5.x86_64.rpm

#########################################
Testing

Install Mageia alongside an installation of OpenBSD.
Allow Mageia to install grub2 and check whether OpenBSD is bootable from the Mageia Grub2 boot menu.

#########################################
Comment 32 Barry Jackson 2016-05-02 18:59:50 CEST
I have now applied these changes to os-prober in Cauldron.

Many thanks to you Elmar for your great help with this :)
Comment 33 Lewis Smith 2016-05-02 21:10:27 CEST
(In reply to Elmar Stellnberger from comment #29)
>   Now with os-prober-1.65-9.6.mga5.i586.rpm everything seems to work
> correctly. I have tested it in three different configurations, two different
> mount states, one unmounted and the mount state stayed the same while all
> partitions were recognized correctly. At least as far as I can test that on
> my side everything works well now.
Many thanks for your heroic work, Elmar.
On the basis of your thorough testing of oss-prober-1.65-9.6.mga5.i586.rpm on x32, I am OKing that architecture. I shall re-run the update on x64 (yet again) just to make sure there are no nasties, but doubt whether we shall be able to properly confirm the update on that architecturedue due to no suitable platform.

Whiteboard: (none) => MGA5-32-OK

Comment 34 Elmar Stellnberger 2016-05-02 21:56:46 CEST
  There is no difference of x86_64/amd64 I can currently think of and that should matter in this regard. Nonetheless we can not be 100.0% sure unless we have tested it. As things are now I would like to propose unleashing the update for x64 as well as long as you can not find any 'nasties'. It could likely take considerable time until I would catch time to install OpenBSD on x64 together with Mageia. If so I will test it and report it here.
Comment 35 Lewis Smith 2016-05-02 21:59:38 CEST
Tested M5 x64 real EFI hardware os-prober-1.65-9.6

Repeat of OK (no reversion) results from Comments 14 & 18. Update OK, update-grub, re-boot, all available OSs are in the Grub2 menu.
Either this can be x64 OK'd (which I have not done), or we validate it with just x32. (We do this sort of thing in times of stress anyway).
Comment 36 claire robinson 2016-05-05 17:34:28 CEST
Validating.

Keywords: (none) => validated_update
Whiteboard: MGA5-32-OK => MGA5-32-OK mga5-64-ok

Comment 37 claire robinson 2016-05-05 18:19:02 CEST
Advisory uploaded.

Whiteboard: MGA5-32-OK mga5-64-ok => advisory MGA5-32-OK mga5-64-ok

Comment 38 Mageia Robot 2016-05-07 11:20:04 CEST
An update for this issue has been pushed to the Mageia Updates repository.

http://advisories.mageia.org/MGAA-2016-0071.html

Resolution: (none) => FIXED
Status: REOPENED => RESOLVED


Note You need to log in before you can comment on or make changes to this bug.