#732696 os-prober: Fails to detect new package-management Haiku builds

Package:
os-prober
Source:
os-prober
Description:
utility to detect other OSes on a set of drives
Submitter:
David Given
Date:
2021-10-17 18:33:03 UTC
Severity:
important
Tags:
#732696#5
Date:
2013-12-20 12:58:40 UTC
From:
To:
Haiku's new package management builds have changed the way the kernel
and boot
sector is laid out, and os-prober's detection routines no longer detect such
Haiku partitions.

Currently package management builds are only available in nightly
releases but
there should be an official release Real Soon Now, and package management
should become the norm. It'd be nice to get this fixed before this happens.

I enclose a patch which should fix this (to be applied to /usr/lib/os-
probes/mounted/83haiku).

#732696#10
Date:
2014-03-11 01:22:52 UTC
From:
To:
Hi David,

and thanks for your report.

David Given <dg@cowlark.com> (2013-12-20):

I'm not familiar with haiku, is that out yet?

Did that get tested against said release if it's published?

Do we need to hardcode checking both version? Looking at item_in_dir's
implementation, the pattern is passed to grep, so we could use
'kernel_.*' instead?

Ditto.

Mraw,
KiBi.

#732696#15
Date:
2014-03-18 00:01:38 UTC
From:
To:
Sorry for the delay --- very busy with other things.
[...]

Still in alpha, and it looks like there'll be at least one alpha before
the beta comes along. It's actually pretty solid mostly, although with a
few rough edges.

Against a nightly build (currently the only place where you can get the
Package Management kernels).

[...]
[...]
[...]

It's been a while, so I've forgotten the details, but I have a vague
memory of trying that and it not working. It was very likely something
else I was doing wrong, but I'm not terribly keen on using grep on
binaries because I don't know where the edge cases are, and it all felt
sufficiently brittle that once it *did* work I didn't want to play with it.

TBH if this were mine I'd be inclined to remove most of this logic. The
prober doesn't do anything with the files other than to look to see if
they're there. Simply checking the boot loader for 'haiku' would be a
lot simpler and more robust.

Unfortunately, I don't have access to the machine I've got which has
Haiku on it right now, so I'm afraid I won't be able to do any work on
this for a bit. I did post the patch to one of the Haiku mailing lists
and they didn't spot anything wrong with it, and it *did* work when I
sent it...

#732696#20
Date:
2014-07-15 11:09:27 UTC
From:
To:
Hello,

As the writer of the original probe [1], I will try to answer some questions.

David Given wrote:

Current nightly builds have different package names, so the patch
doesn't work anymore.

Cyril Brulebois wrote:
[...]

This code was added by Alex Smith [2] when the 64-bit builds of Haiku
arrived. I agree that 'kernel_.*' could have been used instead.

David Given wrote:
'makebootable'd' a partition, but then removed all the files to use it
for something else. The stage 1 bootloader would then still be
present, but not the stage 2 bootloader and the kernel. The partition
would then still be detected as containing an OS.
That's why the probe checks if the stage 1 bootloader, stage 2
bootloader and kernel are all present.

Because David's patch doesn't work anymore, I have created a new
patch. See attached file.
This patch can also be found at my bazaar branch [3]. The resulting
packages can be found in my PPA [4].

I removed the detection of the non package management builds of Haiku,
because I don't think there will be a lot of non-PM versions installed
when the next Haiku release is out. Haiku releases currently are in
alpha phase, so a lot can still be changed. Though from now on all
releases will be package management based.

Kind regards,

Jeroen Oortwijn

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=590897
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=685228
[3] http://bazaar.launchpad.net/~idefix/ubuntu/trusty/os-prober/HaikuPM/revision/36
[4] https://launchpad.net/~idefix/+archive/ubuntu/befs-support/+packages?field.name_filter=os-prober&field.status_filter=published&field.series_filter=trusty

#732696#25
Date:
2014-07-15 22:26:58 UTC
From:
To:
On 7/15/14, 12:09 PM, Jeroen Oortwijn wrote:
[...]

Oh, well...

[...]

I don't have a Haiku setup any more, so I can't comment on the details,
but after a quick glance the patch looks reasonable, and it's good that
this is getting some love.

#732696#30
Date:
2014-08-06 18:58:47 UTC
From:
To:
Hello,

As the original writer of the original probe (:D), let me comment on
this as well...

+1

Although OTOH in theory GRUB2 is able to load haiku_loader directly so
it might work without makebootable, but nobody knows and uses it, and I
never finished multiboot support so it always asks where its boot
partition is.
probe did this, and I saw no reason not to do it.
First version was quite naive, but it should now be robust enough to
handle future official releases I think, degrading partially with
missing hrev and other parts.

Some tests here:
http://pastebin.com/KsseypUb

Currently my menu ends up like:
Haiku R1 alpha4 (hrev47000)
which is much nicer than just the OS name.

Patch against your branch attached, hopefully with correct format, I'm
not used to bzr.

Well the last official release is still alpha4 though, which is non-PM.

And I still have a pre-PM partition on at least one machine to compare
until I fix several regressions.

But I copied the existing probe as a different name and it just works
for me.


François.

#732696#35
Date:
2015-01-17 11:20:28 UTC
From:
To:
I have tested the patches by Jeroen Oortwijn and Francois Revol against HEAD of git://anonscm.debian.org/d-i/os-prober.git (commit hash 2041d683cb853c26c6a30fd904a4d9385880b85b) in qemu on i386 Debian Jessie with Haiku hrev48683 and can confirm that they work.

 Josef Gajdusek

#732696#40
Date:
2015-01-17 11:53:34 UTC
From:
To:
A link to a Google Code-In task the testing was part of:
https://www.google-melange.com/gci/task/view/google/gci2014/6406125821886464

#732696#45
Date:
2015-08-11 15:32:40 UTC
From:
To:
Hello,

One year later and I have found some time to work on this.

Woops, sorry for not mentioning you. Well at least it was clear from
the page I referred to. :)

I like it!
I merged your patch into my branch [1] in rev. 37. (I'm also not used
to bzr, but it looks like the merge succeeded.)

You're right, the script should detect all Haiku versions. So I added
the detection of the non package management Haiku builds back.

The partition type provided by grub-probe has changed in the meantime
[2] and the partition can be mounted with befs-fuse [3], so I also
modified the supported partition types.
In case of befs-fuse, a virtual folder named 'myfs' gets added in
which the file system contents are placed. Therefore, 'myfs' needs to
be added to the mount point variable. I intend to try to remove this
'myfs' folder from befs-fuse (tried once in the past [4]), but this
could take a while so for now this 'hack' is needed.

I've attached a git patch against the current git tree, containing all
previous changes. I've tested it with several different Haiku versions
(R1a3, R1a4, x86_64 non-PM, nightly, x86_64 nightly) and found no
problems. I would appreciate additional review and testing, though.

Kind regards,

Jeroen Oortwijn

[1] https://code.launchpad.net/~idefix/ubuntu/trusty/os-prober/HaikuPM
[2] http://lists.gnu.org/archive/html/grub-devel/2015-07/msg00128.html
[3] https://launchpad.net/~idefix/+archive/ubuntu/befs-support
[4] https://www.freelists.org/post/haiku-development/BFS-FUSE-removing-the-myfs-folder

#732696#50
Date:
2021-10-17 18:26:11 UTC
From:
To:
There's an updated version of the /usr/lib/os-probes/mounted/83haiku
file now available for the os-prober package.  Hope it can be added to
the latest Debian distribution!

I've gone through the previous work everyone here has done on making an
83haiku script and fixed it up to detect the current versions of Haiku
as well as all the older ones.  Added some internal documentation too. 
It's now got an official home on the Haiku source git repository:

https://git.haiku-os.org/haiku/tree/3rdparty/os_probe/83haiku

There's also a related README.md in the same directory, which I'll
reproduce here:

# os-probe for the Haiku Computer Operating System

This is the Linux "os-probes" file to detect Haiku OS and to
automatically add
it to the GRUB boot menu.  Mostly relevant for x86 BIOS based computers.

Copy the 83haiku file to your Linux system in the os-probes subdirectory,
usually (in Fedora at least) it will be
/usr/libexec/os-probes/mounted/83haiku
You can find older 83haiku versions in the repository history, though the
latest should be able to detect older (pre-package manager) Haiku too.

Then regenerate the GRUB boot configuration file.  This will happen
automatically the next time your kernel is updated.  To do it manually,
for old school MBR BIOS boot computers, the command is
`grub2-mkconfig --output /boot/grub2/grub.cfg`
If it doesn't find the Haiku partitions, try manually mounting them in Linux
and rerun the grub command.

Computers using the newer UEFI boot system have a EFI/HAIKU/BOOTX64.EFI file
that you manually install to your EFI partition, and booting is done
differently, so you don't need this 83Haiku file for them.  See
[UEFI Booting Haiku](https://www.haiku-os.org/guides/uefi_booting/) instead.

The original seems to have come from Debian and was written by François
Revol.
It's in the
[Debian os-prober
package](https://packages.debian.org/search?keywords=os-prober).
There's also a big discussion about updating it in
[Debian Bug Report
#732696](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732696).
Latest version is now at
https://git.haiku-os.org/haiku/tree/3rdparty/os_probe

_AGMS20210927_