Bug 846003

Summary: openSUSE 13.1 fails to add other OSes to the grub menu (GC Frontman)
Product: [openSUSE] openSUSE 13.1 Reporter: Elmar Stellnberger <estellnb>
Component: InstallationAssignee: Michael Chang <mchang>
Status: RESOLVED FEATURE QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P5 - None CC: honyczek, snwint
Version: RC 1   
Target Milestone: ---   
Hardware: i586   
OS: SUSE Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: partition table
/boot/grub2/grub.cfg
yast logs (save_y2logs)
lsblk.log
journalctl.log
os-prober-fix-btrfs-subvol-mounted-tests.patch

Description Elmar Stellnberger 2013-10-15 13:23:38 UTC
User-Agent:       Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.21 (KHTML, like Gecko) konqueror/4.11.2 Safari/537.21

While this has worked well on other machines openSUSE 13.1 RC1 has failed to add other OS installations to the boot menu including another installation of oS 13.1 RC1 with btrfs and an installation of an eComstation (Even the first oS13.1 btrfs installation had failed to make a chainloader entry for the eComstation partition on /dev/sda1). 

Reproducible: Always
Comment 1 Elmar Stellnberger 2013-10-15 13:25:37 UTC
Created attachment 563511 [details]
partition table
Comment 2 Elmar Stellnberger 2013-10-15 13:38:04 UTC
Created attachment 563514 [details]
/boot/grub2/grub.cfg
Comment 3 Elmar Stellnberger 2013-10-15 13:39:03 UTC
Created attachment 563515 [details]
yast logs (save_y2logs)
Comment 4 Jan Papež 2013-10-31 19:04:32 UTC
I had same problem after installing new installation on a PC with Windows XP multiboot. Windows XP wasn't recognized in GRUB2. YaST's Boot loader module didn't recognize it. After unchecking "Probe Foreign OS", saving configuration and checking "Probe Foreign OS" again it was OK. Try the same.
Comment 5 Elmar Stellnberger 2013-11-15 16:31:21 UTC
Unlikewise at me disabling and re-activating "Probe Foreign OS" with re-installing the boot loader each time did not achieve the same results. No other oS13.1 nor my eCs installation were recognized by YaST. I had to add these sections manually.
Comment 6 Michael Chang 2013-11-20 03:46:05 UTC
Hi Elmar,

You need btrfsprogs install to get os-prober be able to probe distributions running btrfs as root file systems. Try this again ?

 $ zypper in btrfsprogs
 $ update-bootloader --refresh
Comment 7 Elmar Stellnberger 2013-11-22 15:26:00 UTC
btrfsprogs was already installed by default so that update-bootloader --refresh has removed the other openSUSE installation again.
Comment 8 Michael Chang 2013-11-28 04:18:35 UTC
Please help to attach the logs (lsblk.log, journalctl.log) here. 

$ lsblk -af > lsblk.log
$ os-prober
$ journalctl > journalctl.log

The lsblk log is more helpful in general. There could already have some useful information in journalctl.log, running os-prober again is just to guarantee that.

Meanwhile I'm testing a setup similar to yours (foreign os's root is btrfs on lvm).
Comment 9 Michael Chang 2013-11-28 04:45:39 UTC
(In reply to comment #8)

> Meanwhile I'm testing a setup similar to yours (foreign os's root is btrfs on
> lvm).

I'm not sure the foreign os are having /boot as a separate partition or not .. Anyway waiting for your new log now.
Comment 10 Elmar Stellnberger 2013-11-28 09:33:27 UTC
Created attachment 569484 [details]
lsblk.log
Comment 11 Elmar Stellnberger 2013-11-28 09:34:48 UTC
Created attachment 569485 [details]
journalctl.log
Comment 12 Michael Chang 2013-11-28 11:26:18 UTC
The os-prober ignores LVM2 partition, see bnc#798604. The question to me is that your foreign oS13.1's /boot is in that LVM VG or on a separate partition (/dev/sdaX) ? If inside the LVM it would not be listed.

About eComstation on /dev/sda1 not listed, it looks to me the problem is on  /usr/lib/os-probes/mounted/90linux-distro. Would you please check your presence ld-linux.so.

Or the question should be eComstation Linux or Not ? If it's not Linux I'm afraid it's not supported by now. See what's supported in /usr/lib/os-probes/mounted/.

# This test is inaccurate, but given separate / and /boot partitions and the
# fact that only some architectures have ld-linux.so, I can't see anything
# better. Make sure this test has a high number so that more accurate tests
# can come first.
# Unless volumes to checked are already mounted, they will be mounted using
# GRUB's own filesystems through FUSE. Since these ATM doesn't support
# symlinks we need to also check in $dir/usr/lib* for distributions that
# moved /lib* to /usr and only left symlinks behind.
# TODO: look for ld-linux.so on arches that have it
if (ls "$dir"/lib*/ld*.so* || ls "$dir"/usr/lib*/ld*.so*) >/dev/null 2>/dev/null; then
Comment 13 Michael Chang 2013-11-28 11:34:03 UTC
(In reply to comment #12)

> Or the question should be eComstation Linux or Not ? If it's not Linux I'm
> afraid it's not supported by now. See what's supported in
> /usr/lib/os-probes/mounted/.

Looks to me it's not Linux and currently os-prober has no idea how to handle it.
Comment 14 Michael Chang 2013-11-28 11:39:43 UTC
By the way, give this a shot in your grub shell by typing 'c' in your grub menu. Assuming that eComstation boots with chainloading boot sectors.

grub> set root=hd0,msdos1
grub> chainloader ($root)+1
grub> boot
Comment 15 Elmar Stellnberger 2013-11-29 15:11:38 UTC
* The btrfs installation of /lvm/os-root has /dev/sda7 as ext2 boot partition
* ? check your pesence ld-linux.so ?: /lib/ld-linux.so.2 -> ld-2.18.so
* chainloading of eComstation / OS/2 works (as in some way indicated by comment #1)
Comment 16 Michael Chang 2013-12-06 11:29:20 UTC
It's os-prober bug, looks to me that btrfsprog has changed to not output toplevel / as one of subvolumes in 13.1 thus never get handled and mostly likely it's your (default) root file system.

If I fiddle the scripts (/usr/lib/os-probes/50mounted-tests) a little bit, the os-prober outputs correctly, but need to figure out a proper fix.
Comment 17 Michael Chang 2013-12-09 10:16:35 UTC
Hi Elmar,

Could you test the package in this URL ?

http://download.opensuse.org/repositories/home:/michael-chang:/12.3:/bnc:/846003/openSUSE_13.1/

fyi, the commands could be (I didn't verify it).

$ zypper ar --repo
http://download.opensuse.org/repositories/home:/michael-chang:/12.3:/bnc:/851722/openSUSE_13.1/home_michael-chang_12.3_bnc_846003
$ zypper ref
$ zypper dup -r home_michael-chang_12.3_bnc_846003

And run

$ grub2-mkconfig -o /boot/grub2/grub.cfg
Comment 18 Michael Chang 2013-12-09 10:19:18 UTC
Created attachment 570823 [details]
os-prober-fix-btrfs-subvol-mounted-tests.patch

* move btrfs subvolume mounted tests after regualr rootfs tree
  tests to make sure that root and subvolume fs tree are tested.
* the test order is just a preference, assuming that distribution
  are installed to root fs tree more likely than to a subvolume
Comment 20 Elmar Stellnberger 2013-12-16 17:05:22 UTC
Yes, it now recognizes the btrfs installation. However it does not support detecting the existing eComstation installation yet. Should I give you the MBR and first sectors of the eCs installation?
Comment 21 Michael Chang 2013-12-17 06:59:53 UTC
Hi Elmar,

Thanks for confirmation.

I checked os-prober upstream (debian) git and no signs of any eComstation/OS2 support yet so We're on our own now.

The MBR doesn't matter here for detecting eComstation, instead we need to know some unique file (for eg, detecting SUSE by existence of /etc/SuSE-release) in root file system and you can refer to file /usr/lib/os-probes/mounted/10freedos and add support for eComstation. (you have to replace vfat/msdos with jfs/hpfs checks and the file existence check) and run os-prober to see if it returns anything.

If you're reluctant to do that, just let me know what's the file test we can do for detecting eComstation and I'd like to do that.

#!/bin/sh

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

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

# Weed out stuff that doesn't apply to us
case "$type" in
    vfat) debug "$1 is a FAT32 partition" ;;
    msdos) debug "$1 is a FAT16 partition" ;;
    fat) debug "$1 is a FAT partition (mounted by GRUB)" ;;
    *) debug "$1 is not a FAT partition: exiting"; exit 1 ;;
esac

if item_in_dir -q kernel.sys "$2" && item_in_dir -q command.com "$2"; then
    label="$(count_next_label FreeDOS)"
    result "$1:FreeDOS:$label:chain"
    exit 0
else
    exit 1
fi
Comment 22 Elmar Stellnberger 2013-12-31 22:29:52 UTC
/OS2KRNL should be such a file; evtl. also /OS2VER, /OS2BOOT, /OS2LDR or /OS2/CMD.EXE. The file system should be FAT, HPFS or JFS. eComstation systems have an additional system directory called  /ecs with some /ecs/bin and /ecs/system subdirectories; if you prefer a file you could perhaps check for the /ecs/bin/version.cmd script though I can not guarantee for that file having existed since eComstation 1.0. Basically you can cover eComstation systems like any other OS/2 installation though a different title would be nice. Do not trust the /etc/os2-release file as it is not here on elder systems and does not contain useful data.
Comment 23 Michael Chang 2015-02-02 08:17:25 UTC
My apologies. I have no time to implement this and probably you have to raise the request to upstream.