Discussion:
teach os-prober to recognize OpenBSD
(too old to reply)
Martin Pelikan
2014-06-30 20:40:03 UTC
Permalink
Hi!

My multiboot laptop runs Gentoo and the sys-boot/os-prober package is a
recommended way to make Grub behave with other operating systems installed.
The page https://joeyh.name/code/os-prober/ suggests patches should go
to the Debian installer team, whose web page suggests this is the right
mailing list (http://www.debian.org/devel/debian-installer/).

To access BSD ufs, you need to mount it with -o ufstype=44bsd. This
script should therefore have the highest number (mounted/91openbsd, for
example), so that the re-mount doesn't break any other scripts.

Can something along those lines be included in os-prober? Thanks.
--
Martin Pelikan


#!/bin/sh
# Attempt to check if OpenBSD is installed in this system by
# looking for the copyright string in the kernel image, /bsd.

set -e

. /usr/share/os-prober/common.sh

partition="$1"
dir="$2"
type="$3"

[ "$type" == "ufs" ] || exit 1;

# We need to re-mount the FS with ufstype=44bsd.
where=`mount | awk '($1 == "'$partition'") { print $3; }'`
umount $where
mount -t ufs -o ro,ufstype=44bsd $partition $where

OPENBSD_COPYRIGHT='^Copyright (c) 1995-[12][0-9][0-9][0-9] OpenBSD. All rights reserved. http://www.OpenBSD.org$'
if [ -f "$dir/bsd" ] && grep "${OPENBSD_COPYRIGHT}" $dir/bsd > /dev/null; then
label="$(count_next_label OpenBSD)"
result "$partition:OpenBSD:$label:chain"
exit 0
else
exit 1
fi
--
To UNSUBSCRIBE, email to debian-boot-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: https://lists.debian.org/***@methuselah
Martin Pelikan
2014-06-30 22:20:01 UTC
Permalink
Unfortunately this might not work from within the installer because
Linux no longer builds a ufs kernel module for d-i. (Support for ufs
was being dropped). It may only pick up OpenBSD on the next run of
update-grub2 after booting the installed system (where ufs.ko seems to
be still available).
If the module isn't there, it shouldn't do any harm because of the line
'[ "$type" == "ufs" ] || exit 1;'. So the question is, since you've made
a package used by other distributions, do you care about people running
it on them? I admit I'm not a Debian person, but since os-prober does
its job very well, keeping probes for other distributions in the tree
doesn't seem like a big burden.
I think this could also be an inconvenience for systems where GNU/Linux
is installed alongside GNU/kFreeBSD. Maybe there is some argument to
keep providing a ufs udeb, even if partman doesn't allow to create new
ufs partitions or install to existing ones.
UFS write support in Linux is currently marked as experimental, so I
don't know who would create their UFS partitions using any Linux tool.

I've never run GNU/kFreeBSD, but I'd say it's very unlikely that it
would contain this particular OpenBSD copyright. If people are willing
to extend the script to deal with other BSDs (with whatever userspace
they like), they can just add more if-else cases. Whether they grep the
binary for a newline-delimited string or do other magic.

Maybe it shouldn't be called "91openbsd" but just "91bsd" if others will
want to play.
--
Martin Pelikan
--
To UNSUBSCRIBE, email to debian-boot-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: https://lists.debian.org/***@methuselah
Steven Chamberlain
2014-06-30 22:20:02 UTC
Permalink
Unfortunately this might not work from within the installer because
Linux no longer builds a ufs kernel module for d-i.
[...] So the question is, since you've made
a package used by other distributions, do you care about people running
it on them?
I imagine Debian does care and might add this if it works. I wasn't
disputing that; only whether this feature would work within the Debian
GNU/Linux installer.
I think this could also be an inconvenience for systems where GNU/Linux
is installed alongside GNU/kFreeBSD.
Just to clarify, I meant that Linux dropping read-only ufs support in
the installer might be an inconvenience.
I've never run GNU/kFreeBSD, but I'd say it's very unlikely that it
would contain this particular OpenBSD copyright. [...]
Certainly not in a kernel image file called /bsd. I think GNU/kFreeBSD
would be ufstype=ufs2 rather than 44bsd anyway, so I wonder if mount(8)
would fail gracefully in this case.

I suspect this os-prober script also wouldn't work on GNU/kFreeBSD for
this reason. (There's no ufstype option, so I suspect no way to mount
an OpenBSD UFS partition, but I may look into it if I have time).

Regards,
--
Steven Chamberlain
***@pyro.eu.org
--
To UNSUBSCRIBE, email to debian-boot-***@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact ***@lists.debian.org
Archive: https://lists.debian.org/***@pyro.eu.org
Loading...