Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 897700 - sys-boot/os-prober-1.81-r1 fails to detect Windows
Summary: sys-boot/os-prober-1.81-r1 fails to detect Windows
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Peter Levine
URL:
Whiteboard:
Keywords:
Depends on: 830655
Blocks:
  Show dependency tree
 
Reported: 2023-02-25 15:44 UTC by Victor Mataré
Modified: 2024-05-09 14:21 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Mataré 2023-02-25 15:44:12 UTC
os-prober-1.81 works normally, but -r1 just outputs nothing on my system. Don't know if it's able to detect other Linux installs because I don't have any. But the UEFI Windows setup is definitely missing.

Seems to be caused by the os-prober-1.81-boot-detected-twice.patch, which appears to be the only change between 1.81 and 1.81-r1.

Reproducible: Always
Comment 1 Peter Levine 2023-02-26 01:11:44 UTC
If you run `os-prober` on the command-line as root, nothing gets emitted?
Comment 2 Victor Mataré 2023-02-26 15:14:45 UTC
(In reply to Peter Levine from comment #1)
> If you run `os-prober` on the command-line as root, nothing gets emitted?

Precisely, with 1.81-r1 that is. With 1.81 everything works.
Comment 3 Gabriel Marcano 2023-03-04 08:31:35 UTC
I think I found the problem. I'm also seeing the same issue on my laptop. It seems to be a problem while parsing mountinfo. Specifically:

    while read -r x x dev x mount x x fs x; do

When compared to a line from my mountinfo:

    62 1 0:31 / / rw,noatime shared:1 - btrfs /dev/nvme0n1p2 rw,ssd,discard,space_cache,subvolid=5,subvol=/


There's one too few "x" between mount and fs. Specifically, I don't know what that dash after the "shared:1" means or what it's for, but currently that's what's being picked up on my computer. If I source /usr/share/os-prober/common.sh from a shell and call list_mounts, I get the following:

    /dev/nvme0n1p5 /mnt/Gaia -
    /dev/nvme0n1p8 /mnt/Luna -
    /dev/nvme0n1p1 /boot/efi -

If I add an extra x between mount and fs:

    /dev/nvme0n1p5 /mnt/Gaia fuseblk
    /dev/nvme0n1p8 /mnt/Luna fuseblk
    /dev/nvme0n1p1 /boot/efi vfat

With the extra x, os-prober also successfully shows something, and finds my Windows partition. Without it, I also get no output whatsoever.
Comment 4 Ben Kohler gentoo-dev 2023-04-05 12:38:39 UTC
I'm seeing this breakage as well.  Seems our attempted fix in bug 830655 has caused this regression.
Comment 5 Peter Levine 2023-04-05 22:03:56 UTC
(In reply to Gabriel Marcano from comment #3)
> I think I found the problem. I'm also seeing the same issue on my laptop. It
> seems to be a problem while parsing mountinfo. Specifically:
> 
>     while read -r x x dev x mount x x fs x; do
> 
> When compared to a line from my mountinfo:
> 
>     62 1 0:31 / / rw,noatime shared:1 - btrfs /dev/nvme0n1p2
> rw,ssd,discard,space_cache,subvolid=5,subvol=/
> 
> 
> There's one too few "x" between mount and fs. Specifically, I don't know
> what that dash after the "shared:1" means or what it's for, but currently
> that's what's being picked up on my computer. If I source
> /usr/share/os-prober/common.sh from a shell and call list_mounts, I get the
> following:
> 
>     /dev/nvme0n1p5 /mnt/Gaia -
>     /dev/nvme0n1p8 /mnt/Luna -
>     /dev/nvme0n1p1 /boot/efi -
> 
> If I add an extra x between mount and fs:
> 
>     /dev/nvme0n1p5 /mnt/Gaia fuseblk
>     /dev/nvme0n1p8 /mnt/Luna fuseblk
>     /dev/nvme0n1p1 /boot/efi vfat
> 
> With the extra x, os-prober also successfully shows something, and finds my
> Windows partition. Without it, I also get no output whatsoever.

'x' is being used as a placeholder variable while parsing, to hold the unused fields of lines in /proc/self/mountinfo.  The dash is a delimiter representing the end of optional  mount_namespaces fields (see the "/proc/pid/mountinfo" section of `man proc`).

It does appear that there should be an extra `x`.  $fs should contain the filesystem type (field 9) but instead contains the delimiter symbol (field 8).
Comment 6 Ben Kohler gentoo-dev 2024-05-08 15:55:30 UTC
If field 7 is optional, how can our current parsing deal with that? Count the total fields first and have a different "while read" case for each count?
Comment 7 Larry the Git Cow gentoo-dev 2024-05-08 16:43:45 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd2aa3aeb97da6052c2645e12313cd7eec389715

commit dd2aa3aeb97da6052c2645e12313cd7eec389715
Author:     Ben Kohler <bkohler@gentoo.org>
AuthorDate: 2024-05-08 16:40:29 +0000
Commit:     Ben Kohler <bkohler@gentoo.org>
CommitDate: 2024-05-08 16:43:39 +0000

    sys-boot/os-prober: new boot-detected-twice patch
    
    This version adds a slightly adjusted patch which accounts for the fact
    that mountinfo may have an extra optional field.  This does not account
    for *more than one* optional field, but we can revisit this if such a
    setup is found in the wild.
    
    Bug: https://bugs.gentoo.org/897700
    Signed-off-by: Ben Kohler <bkohler@gentoo.org>

 .../os-prober-1.81-boot-detected-twice-v2.patch    |  57 ++++++++++++
 sys-boot/os-prober/os-prober-1.81-r2.ebuild        | 103 +++++++++++++++++++++
 2 files changed, 160 insertions(+)
Comment 8 Ben Kohler gentoo-dev 2024-05-08 16:44:48 UTC
Please test with this new patch in 1.81-r2-- it should work for 10-field cases and 11-field cases, hopefully we don't run into any 12+ field cases.

If this works for everyone, I'd like to stabilize -r2 soon.
Comment 9 Larry the Git Cow gentoo-dev 2024-05-09 14:21:47 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=18bcae8fc56848056979dbbe0af85af7d27b3928

commit 18bcae8fc56848056979dbbe0af85af7d27b3928
Author:     Ben Kohler <bkohler@gentoo.org>
AuthorDate: 2024-05-09 14:19:48 +0000
Commit:     Ben Kohler <bkohler@gentoo.org>
CommitDate: 2024-05-09 14:21:42 +0000

    sys-boot/os-prober: stabilize 1.81-r2 for amd64, x86
    
    Closes: https://bugs.gentoo.org/830655
    Closes: https://bugs.gentoo.org/897700
    Signed-off-by: Ben Kohler <bkohler@gentoo.org>

 sys-boot/os-prober/os-prober-1.81-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)