Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 830655 - sys-boot/os-prober-1.79-r2 detects boot partition twice
Summary: sys-boot/os-prober-1.79-r2 detects boot partition twice
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Peter Levine
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: 897700
  Show dependency tree
 
Reported: 2022-01-05 18:57 UTC by André Terpstra
Modified: 2023-08-15 10:32 UTC (History)
7 users (show)

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


Attachments
os-prober output from system log (os-prober_output.txt,94.09 KB, text/plain)
2022-01-05 20:05 UTC, André Terpstra
Details
Grub config (grub.cfg,24.22 KB, text/plain)
2022-01-18 19:37 UTC, André Terpstra
Details
more os-prober output (os-prober output.txt,11.25 KB, text/plain)
2022-01-21 18:59 UTC, André Terpstra
Details
Last grub config (grub.cfg,27.65 KB, text/plain)
2022-03-15 02:53 UTC, André Terpstra
Details
os-prober log and disk/mount info (os-prober-debug.txt,4.99 KB, text/plain)
2022-09-23 13:07 UTC, Ben Kohler
Details
os-prober patch to handle non-initrd systems (0001-Read-mounted-partitions-from-proc-self-mountinfo.patch,2.32 KB, patch)
2023-01-20 02:04 UTC, Petr Vandrovec
Details | Diff
os-prober patch to handle non-initrd systems (0001-Read-mounted-partitions-from-proc-self-mountinfo.patch,2.34 KB, patch)
2023-01-20 02:30 UTC, Petr Vandrovec
Details | Diff
os-prober patch for gentoo 1.81 with gentoo patches (XXXX-Read-mounted-partitions-from-proc-self-mountinfo.patch,1.58 KB, patch)
2023-01-22 21:58 UTC, Petr Vandrovec
Details | Diff
os-prober-1.81-boot-detected-twice.patch (os-prober-1.81-boot-detected-twice.patch,1.67 KB, patch)
2023-04-05 22:46 UTC, Peter Levine
Details | Diff
os-prober-1.81-boot-detected-twice.patch (os-prober-1.81-boot-detected-twice.patch,783 bytes, patch)
2023-04-21 06:52 UTC, Peter Levine
Details | Diff
grub-mkconfig output (output,25.69 KB, text/plain)
2023-08-08 09:10 UTC, Pacho Ramos
Details
debug.txt (debug.txt,5.76 KB, text/plain)
2023-08-10 08:15 UTC, Pacho Ramos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description André Terpstra 2022-01-05 18:57:35 UTC
It appears I have a found an issue in sys-boot/os-prober-1.79-r1. This detects my Gentoo root partition twice and therefore creates an unnecessary second boot option. Downgrading to sys-boot/os-prober-1.78-r1 (by masking) solves the issue.

Unfortunately I have not saved a backup copy of grub.cfg. If absolutely necessary I can recreate it of course.

It will probably not be a Gentoo-specific bug but I think I should start here.

Some extra information: my system is UEFI (no secure boot), multi-boot (Windows 11, ArchLinux, Fedora) and has 3 SSD's.
Comment 1 Ben Kohler gentoo-dev 2022-01-05 19:02:40 UTC
Can you share the os-prober console output and also what it writes to syslog?
Comment 2 André Terpstra 2022-01-05 20:05:30 UTC
Created attachment 761381 [details]
os-prober output from system log
Comment 3 André Terpstra 2022-01-05 20:06:21 UTC
Console output:

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.15.13-gentoo-APT-2021
Found linux image: /boot/vmlinuz-5.15.12-gentoo-APT-2021
Found initrd image: /boot/initramfs-5.15.12-gentoo-APT-2021.img
Found linux image: /boot/vmlinuz-5.15.11-gentoo-APT-2021
Found linux image: /boot/vmlinuz-5.15.11-gentoo-APT-2021.old
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/efi/Microsoft/Boot/bootmgfw.efi
Found Gentoo Linux on /dev/sdb2
Found Arch Linux on /dev/sdb4
Found Fedora Linux 35 (Workstation Edition) on /dev/sdb5
Adding boot menu entry for UEFI Firmware Settings ...
done
Comment 4 André Terpstra 2022-01-05 20:07:06 UTC
And of course /dev/sdb2 is my root partition
Comment 5 Ben Kohler gentoo-dev 2022-01-05 22:14:57 UTC
So the problem is that it detects all of your gentoo kernels as normal via 10_linux, but then 30_os-prober also detects a gentoo linux.  Right?

I can reproduce that locally, until I had assumed that it was just a local config quirk on my end, and not looked into it too deeply.
Comment 6 André Terpstra 2022-01-06 05:29:29 UTC
I'm not sure about the exact wording but I suppose you're right. Though to be complete you may add that I've only installed Gentoo once (in the past I experimented with 2 installations on the same machine).
Comment 7 André Terpstra 2022-01-09 13:17:52 UTC
Unfortunately I just found out that downgrading didn't help anymore. With sys-boot/os-prober-1.78-r1 the issue remains.
Comment 8 Ben Kohler gentoo-dev 2022-01-11 14:55:26 UTC
Are you mounting your EFI System Partition (vfat ESP) at /boot or /boot/efi or other?  I'm no longer able to reproduce this after moving my ESP to /boot/efi on a recent drive migration.
Comment 9 André Terpstra 2022-01-11 20:02:27 UTC
First, I've just upgraded to sys-boot/os-prober-1.79-r2. Don't know the differences, but the issue remains.

Second, I use /boot/efi.

I may add that I use a two-step process in booting grub, although that may be irrelevant.

Finally, I am also having trouble detecting another linux on my machine (LFS), but that is surely beside the point...
Comment 10 André Terpstra 2022-01-14 04:17:34 UTC
I am sorry for the confusion but it seems the issue is resolved now. For a number of days I had messed up my os-prober configuration and the LFS-partition still doesn't get recognized well, but at least my gentoo partition is now found only once.

As far as I am concerned this bug can be closed.
Comment 11 André Terpstra 2022-01-17 06:01:27 UTC
Mysteriously the issue has returned, so reopening
Comment 12 Ben Kohler gentoo-dev 2022-01-18 19:07:31 UTC
Can you attach the resulting grub.cfg from grub-mkconfig, but also the console output from a manual "os-prober" run?
Comment 13 André Terpstra 2022-01-18 19:36:25 UTC
(In reply to Ben Kohler from comment #12)
> Can you attach the resulting grub.cfg from grub-mkconfig, but also the
> console output from a manual "os-prober" run?

Of course. First I have reset my environment by re-merging grub and os-prober. Just to make sure there are no modifications that tamper with the outcome. In particular, /etc/grub.d.40_custom -which I had edited- was replaced by the default.

The resulting grub.cfg will be attached next and the console output was:

ZeusGentoo ~ # cat grubconfig.sh 
#! /bin/bash

mount /boot
grub-mkconfig --output=/boot/grub/grub.cfg
umount /boot
ZeusGentoo ~ # sh grubconfig.sh 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.16.1-gentoo-APT-2021
Found initrd image: /boot/amd-uc.img
Found linux image: /boot/vmlinuz-5.16.1-gentoo-APT-2021.old
Found initrd image: /boot/amd-uc.img
Found linux image: /boot/vmlinuz-5.16.0-gentoo-APT-2021
Found initrd image: /boot/amd-uc.img /boot/initramfs-5.16.0-gentoo-APT-2021.img
Found linux image: /boot/vmlinuz-5.16.0-gentoo-APT-2021.old
Found initrd image: /boot/amd-uc.img /boot/initramfs-5.16.0-gentoo-APT-2021.img
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/efi/Microsoft/Boot/bootmgfw.efi
Found Gentoo Linux on /dev/sdb2
Found Arch Linux on /dev/sdb4
Found Fedora Linux 35 (Workstation Edition) on /dev/sdb5
Found Linux From Scratch (11.0-systemd) on /dev/sdb8
No path or device is specified.
Usage: grub-probe [OPTION...] [OPTION]... [PATH|DEVICE]
Try 'grub-probe --help' or 'grub-probe --usage' for more information.
No path or device is specified.
Usage: grub-probe [OPTION...] [OPTION]... [PATH|DEVICE]
Try 'grub-probe --help' or 'grub-probe --usage' for more information.
Adding boot menu entry for UEFI Firmware Settings ...
done
ZeusGentoo ~ #
Comment 14 André Terpstra 2022-01-18 19:37:21 UTC
Created attachment 762515 [details]
Grub config
Comment 15 Ben Kohler gentoo-dev 2022-01-18 19:37:56 UTC
Just "os-prober", not grub-probe
Comment 16 André Terpstra 2022-01-18 20:29:25 UTC
I"m sorry I did not read your post well enough.

ZeusGentoo ~ # os-prober
/dev/nvme0n1p1@/efi/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi
/dev/sdb2:Gentoo Linux:Gentoo:linux
/dev/sdb4:Arch Linux:Arch:linux
/dev/sdb5:Fedora Linux 35 (Workstation Edition):Fedora:linux
/dev/sdb8:Linux From Scratch (11.0-systemd):LinuxFromScratch:linux
ZeusGentoo ~ #
Comment 17 Ben Kohler gentoo-dev 2022-01-19 19:46:54 UTC
Can you also show your "mount" output and "blkid" output? I believe os-prober is supposed to detect that sdb2 is the booted linux and thus not have any output for sdb2, but something is going wrong.
Comment 18 André Terpstra 2022-01-19 19:52:31 UTC
ZeusGentoo ~ # mount
/dev/sdb2 on / type ext4 (rw,noatime)
devtmpfs on /dev type devtmpfs (rw,relatime,size=8159180k,nr_inodes=2039795,mode=755)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,size=3278004k,nr_inodes=819200,mode=755)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
/dev/sdb8 on /mnt/lfs type ext4 (rw,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,size=8195012k,nr_inodes=1048576)
/dev/sdb7 on /mnt/lfs/boot type ext2 (rw,relatime)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=1639000k,nr_inodes=409750,mode=700)
ZeusGentoo ~ # blkid
/dev/sdb4: LABEL="Arch" UUID="da7048c8-f51c-4094-b486-bc7c6338cd62" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Arch" PARTUUID="0bb8c39b-218f-1f45-bc49-47ba04252d38"
/dev/sdb2: LABEL="G" UUID="36eb0081-1a62-4dcc-aaf2-088d6df11041" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Gentoo" PARTUUID="0c76591f-c725-4714-adc0-30c072fa1bcb"
/dev/sdb7: UUID="fc9fb648-e34b-45ff-a4bd-d317203d93a8" BLOCK_SIZE="4096" TYPE="ext2" PARTLABEL="LFS Boot" PARTUUID="813853d5-bc48-4768-970c-888bbb687e17"
/dev/sdb5: UUID="9e0218c3-d161-4c3f-b123-52cce0da8c3d" UUID_SUB="07cb2824-c58a-4362-a199-1a4737fadc2e" BLOCK_SIZE="4096" TYPE="btrfs" PARTLABEL="Fedora" PARTUUID="628c3438-5281-492a-aaf2-8f1406daf8f8"
/dev/sdb3: UUID="486815db-8818-44e4-8e77-e8175fc52a52" TYPE="swap" PARTLABEL="Swap" PARTUUID="ef71e1d3-2d4d-49a7-a8e6-634f8091d7d5"
/dev/sdb1: LABEL="GBoot" UUID="a683e60b-3c74-4877-bb91-6d2e7a844df9" BLOCK_SIZE="4096" TYPE="ext2" PARTLABEL="GentooBoot" PARTUUID="3ca1b95f-ef77-45bb-bf4b-2e04d6463c52"
/dev/sdb8: UUID="747ef2e9-9f00-479e-bce6-f91be5c4443b" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="LFS System" PARTUUID="5a5e722f-d15e-4bf6-ad7b-cdb85def22f6"
/dev/sda4: LABEL="OLDWindows11" BLOCK_SIZE="512" UUID="CA4ED9DD4ED9C1FD" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="e9a103c3-0115-4b33-a11c-58ae559efdb2"
/dev/sda2: UUID="EE62-EFFD" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="2cf789bc-7c54-468f-8481-2947eec7e1c7"
/dev/sda5: BLOCK_SIZE="512" UUID="C41E6AC11E6AAC5C" TYPE="ntfs" PARTUUID="accf87ca-465e-4b49-9478-22f9e9b9773a"
/dev/sda1: LABEL="OLDRecovery" BLOCK_SIZE="512" UUID="38D462E3D462A33C" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="d228fbd6-940c-40d8-a4fd-3ddf380d4f34"
/dev/sda6: LABEL="OLDData" BLOCK_SIZE="512" UUID="F24201E74201B181" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="9cca9e4c-4cf2-4443-85f2-d315bb03820e"
/dev/nvme0n1p5: LABEL="Data" BLOCK_SIZE="512" UUID="29D2604523F6E333" TYPE="ntfs" PARTLABEL="Data" PARTUUID="5ec2d39e-b8c8-4455-90dd-7b670812bd88"
/dev/nvme0n1p3: LABEL="Windows" BLOCK_SIZE="512" UUID="0DF66F657A269C15" TYPE="ntfs" PARTLABEL="Windows" PARTUUID="462f855d-1e7d-43f5-ab01-de6cf9cf75c4"
/dev/nvme0n1p1: UUID="0A18-CC95" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="ac2e2a46-4d70-47ac-b8ce-6a4bf8651d65"
/dev/nvme0n1p4: LABEL="Recovery" BLOCK_SIZE="512" UUID="3BBE83666EF5E4D5" TYPE="ntfs" PARTLABEL="Recovery" PARTUUID="d54f6586-af01-4a0e-beee-e188d2280d3e"
/dev/nvme0n1p2: PARTUUID="e7e464e7-ed34-4ad5-ad2c-1de988d54411"
/dev/sdb6: PARTLABEL="BIOS Boot" PARTUUID="976f6aab-594b-470a-aaf6-56b54dd3e07b"
/dev/sda3: PARTLABEL="Microsoft reserved partition" PARTUUID="d0adbaa5-4915-460b-8f46-3072c4db0e2f"
ZeusGentoo ~ #
Comment 19 André Terpstra 2022-01-21 18:59:52 UTC
Created attachment 763081 [details]
more os-prober output
Comment 20 Ben Kohler gentoo-dev 2022-03-14 13:51:32 UTC
Odd, now I'm not able to reproduce this on either of my machines.  Are you still able?
Comment 21 André Terpstra 2022-03-15 02:51:20 UTC
Yes. Since last time I added another distro, but otherwise the results are the same:


ZeusGentoo ~ # mount
/dev/sdb2 on / type ext4 (rw,noatime)
devtmpfs on /dev type devtmpfs (rw,relatime,size=8158132k,nr_inodes=2039533,mode=755)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,size=3277572k,nr_inodes=819200,mode=755)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,nr_inodes=1048576)
/dev/sdb1 on /boot type ext2 (rw,noatime)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=1638784k,nr_inodes=409696,mode=700)
portal on /run/user/0/doc type fuse.portal (rw,nosuid,nodev,relatime,user_id=0,group_id=0)
ZeusGentoo ~ # blkid
/dev/sdb4: LABEL="Arch" UUID="da7048c8-f51c-4094-b486-bc7c6338cd62" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Arch" PARTUUID="0bb8c39b-218f-1f45-bc49-47ba04252d38"
/dev/sdb2: LABEL="G" UUID="36eb0081-1a62-4dcc-aaf2-088d6df11041" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Gentoo" PARTUUID="0c76591f-c725-4714-adc0-30c072fa1bcb"
/dev/sdb9: LABEL="Drauger" UUID="e74e4980-81bf-4e96-89d4-c4aa9794430c" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Drauger" PARTUUID="21c110bd-a7d2-4064-af36-be5625d64b8a"
/dev/sdb7: UUID="fc9fb648-e34b-45ff-a4bd-d317203d93a8" BLOCK_SIZE="4096" TYPE="ext2" PARTLABEL="LFS Boot" PARTUUID="813853d5-bc48-4768-970c-888bbb687e17"
/dev/sdb5: UUID="9e0218c3-d161-4c3f-b123-52cce0da8c3d" UUID_SUB="07cb2824-c58a-4362-a199-1a4737fadc2e" BLOCK_SIZE="4096" TYPE="btrfs" PARTLABEL="Fedora" PARTUUID="628c3438-5281-492a-aaf2-8f1406daf8f8"
/dev/sdb3: UUID="486815db-8818-44e4-8e77-e8175fc52a52" TYPE="swap" PARTLABEL="Swap" PARTUUID="ef71e1d3-2d4d-49a7-a8e6-634f8091d7d5"
/dev/sdb1: LABEL="GBoot" UUID="a683e60b-3c74-4877-bb91-6d2e7a844df9" BLOCK_SIZE="4096" TYPE="ext2" PARTLABEL="GentooBoot" PARTUUID="3ca1b95f-ef77-45bb-bf4b-2e04d6463c52"
/dev/sdb8: UUID="747ef2e9-9f00-479e-bce6-f91be5c4443b" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="LFS System" PARTUUID="5a5e722f-d15e-4bf6-ad7b-cdb85def22f6"
/dev/sda4: LABEL="OLDWindows11" BLOCK_SIZE="512" UUID="CA4ED9DD4ED9C1FD" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="e9a103c3-0115-4b33-a11c-58ae559efdb2"
/dev/sda2: UUID="EE62-EFFD" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="2cf789bc-7c54-468f-8481-2947eec7e1c7"
/dev/sda5: BLOCK_SIZE="512" UUID="C41E6AC11E6AAC5C" TYPE="ntfs" PARTUUID="accf87ca-465e-4b49-9478-22f9e9b9773a"
/dev/sda1: LABEL="OLDRecovery" BLOCK_SIZE="512" UUID="38D462E3D462A33C" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="d228fbd6-940c-40d8-a4fd-3ddf380d4f34"
/dev/sda6: LABEL="OLDData" BLOCK_SIZE="512" UUID="F24201E74201B181" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="9cca9e4c-4cf2-4443-85f2-d315bb03820e"
/dev/nvme0n1p5: LABEL="Data" BLOCK_SIZE="512" UUID="29D2604523F6E333" TYPE="ntfs" PARTLABEL="Data" PARTUUID="5ec2d39e-b8c8-4455-90dd-7b670812bd88"
/dev/nvme0n1p3: LABEL="Windows" BLOCK_SIZE="512" UUID="0DF66F657A269C15" TYPE="ntfs" PARTLABEL="Windows" PARTUUID="462f855d-1e7d-43f5-ab01-de6cf9cf75c4"
/dev/nvme0n1p1: UUID="0A18-CC95" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="ac2e2a46-4d70-47ac-b8ce-6a4bf8651d65"
/dev/nvme0n1p4: LABEL="Recovery" BLOCK_SIZE="512" UUID="3BBE83666EF5E4D5" TYPE="ntfs" PARTLABEL="Recovery" PARTUUID="d54f6586-af01-4a0e-beee-e188d2280d3e"
/dev/nvme0n1p2: PARTUUID="e7e464e7-ed34-4ad5-ad2c-1de988d54411"
/dev/sdb6: PARTLABEL="BIOS Boot" PARTUUID="976f6aab-594b-470a-aaf6-56b54dd3e07b"
/dev/sda3: PARTLABEL="Microsoft reserved partition" PARTUUID="d0adbaa5-4915-460b-8f46-3072c4db0e2f"
ZeusGentoo ~ # sh grubconfig.sh 
mount: /boot: /dev/sdb1 already mounted on /boot.
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.16.14-gentoo-APT-2022
Found initrd image: /boot/amd-uc.img
Found linux image: /boot/vmlinuz-5.16.12-gentoo-APT-2022
Found initrd image: /boot/amd-uc.img
Found linux image: /boot/vmlinuz-5.16.11-gentoo-APT-2022
Found initrd image: /boot/amd-uc.img
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/efi/Microsoft/Boot/bootmgfw.efi
Found Gentoo Linux on /dev/sdb2
Found Arch Linux on /dev/sdb4
Found Fedora Linux 35 (Workstation Edition) on /dev/sdb5
Found Linux From Scratch (11.0-systemd) on /dev/sdb8
Found Drauger OS 7.5.1 Zombi (7.5.1) on /dev/sdb9
Adding boot menu entry for UEFI Firmware Settings ...
done
umount: /boot: target is busy.
ZeusGentoo ~ # 


I'll attach the generated grub.cfg.
Comment 22 André Terpstra 2022-03-15 02:53:09 UTC
Created attachment 767077 [details]
Last grub config
Comment 23 Pacho Ramos gentoo-dev 2022-08-14 13:16:05 UTC
I am also hitting this bug, also with os-prober-1.81

It detects the same booted partition and adds the duplicated entries:
# os-prober 
/dev/sda1:Gentoo Linux:Gentoo:linux
Comment 24 Pacho Ramos gentoo-dev 2022-09-21 16:20:16 UTC
Is there anything we can do to try to solve this? I am unsure if maybe it's an upstream issue :/
Comment 25 Ben Kohler gentoo-dev 2022-09-21 16:25:58 UTC
I'm not able to reproduce this here so I don't really know what is going wrong.  Surely there is some logic to prevent the currently booted OS from being tagged by os-prober, it must not be properly triggering.
Comment 26 Pacho Ramos gentoo-dev 2022-09-23 12:26:56 UTC
And, in your case, "os-prober" command is giving any output?
Comment 27 Ben Kohler gentoo-dev 2022-09-23 13:07:20 UTC
Created attachment 813811 [details]
os-prober log and disk/mount info

Yes it is:

# os-prober
/dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi
#

Admittedly my setup is very simple, a single NVMe drive with Win10 and Gentoo, no other linux distros.  But I'm attaching my os-prober syslog output, along with my disk layout and mounts.  Maybe you can make sense of why your os-prober finds the booted gentoo and mine doesn't.
Comment 28 Pacho Ramos gentoo-dev 2022-10-02 08:49:18 UTC
I still couldn't find the reason /usr/lib/os-probes/mounted/90linux-distro keeps detecting the boot partition :( Neither I could find how to contact upstream, as they seem to have the "Issues" reporting disabled in their gitlab instance. Do you know a way to contact them? :/
Comment 29 Petr Vandrovec 2023-01-20 02:04:15 UTC
Created attachment 848851 [details, diff]
os-prober patch to handle non-initrd systems

<aol>Me too!</aol>

Hi from Debian, I think I see the problem... and why it is reproducible only for some users:

Problem is that when I boot my system from Debian kernel, first line in /proc/mounts will be /dev/nvme0s1p5 / ext4 ... as initrd is the one who mounts the root filesystem.

But when I boot my own kernel, which does not use initrd, first line in /proc/mounts is /dev/root / ext4 ... as kernel does not bother with device names when searching for the root filesystem, and uses /dev/root placeholder - which persists forever.

This causes os-prober to not notice that /dev/root and /dev/nvme0s1p5 are same filesystem, and all kernels get listed twice: once when Linux probe finds them, and once when os-prober finds "other" Linux installed on the system.

Let me know if this matches your observation - as far as I can tell, you should not have a problem when you use initrd, and you should have problem in 100% cases if you are using initrd.

I've attached patch that fixes problem for me, by reading /proc/self/mountinfo, and mapping block device IDs to device nodes in /dev.  I don't have any LVM setup, so I'm not sure if this breaks device naming for LVM or other non-trivial setups :-(

Diff is against current Debian's os-prober, https://salsa.debian.org/installer-team/os-prober.git
Comment 30 Petr Vandrovec 2023-01-20 02:30:47 UTC
Created attachment 848853 [details, diff]
os-prober patch to handle non-initrd systems

First version broke detection of mounted filesystem as filesystem type was not extracted from /proc/self/mountinfo.
Comment 31 André Terpstra 2023-01-20 09:55:05 UTC
(In reply to Petr Vandrovec from comment #30)
> Created attachment 848853 [details, diff] [details, diff]
> os-prober patch to handle non-initrd systems
> 
> First version broke detection of mounted filesystem as filesystem type was
> not extracted from /proc/self/mountinfo.

Good idea! However I get a compile error:

ZeusGentoo /var/db/repos/gentoo/sys-boot/os-prober # ebuild os-prober-1.81.ebuild clean prepare
>>> Downloading 'http://mirror.leaseweb.com/gentoo/distfiles/32/os-prober_1.81.tar.xz'
--2023-01-20 10:53:12--  http://mirror.leaseweb.com/gentoo/distfiles/32/os-prober_1.81.tar.xz
Resolving mirror.leaseweb.com... 5.79.108.33
Connecting to mirror.leaseweb.com|5.79.108.33|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 27448 (27K) [application/octet-stream]
Saving to: '/var/cache/distfiles/os-prober_1.81.tar.xz.__download__'

/var/cache/distfiles/os-probe 100%[================================================>]  26.80K  --.-KB/s    in 0.008s  

2023-01-20 10:53:12 (3.18 MB/s) - '/var/cache/distfiles/os-prober_1.81.tar.xz.__download__' saved [27448/27448]

 * os-prober_1.81.tar.xz BLAKE2B SHA512 size ;-) ...                                                            [ ok ]
 * checking ebuild checksums ;-) ...                                                                            [ ok ]
 * checking auxfile checksums ;-) ...                                                                           [ ok ]
 * checking miscfile checksums ;-) ...                                                                          [ ok ]
>>> Unpacking source...
>>> Unpacking os-prober_1.81.tar.xz to /var/tmp/portage/sys-boot/os-prober-1.81/work
>>> Source unpacked in /var/tmp/portage/sys-boot/os-prober-1.81/work
>>> Preparing source in /var/tmp/portage/sys-boot/os-prober-1.81/work/os-prober-1.81 ...
 * Applying os-prober-1.79-mdraid-detection.patch ...                                                           [ ok ]
 * Applying os-prober-1.79-btrfs-subvolume-detection.patch ...                                                  [ ok ]
 * Applying os-prober-1.79-use-fstab-name.patch ...                                                             [ ok ]
 * Applying os-prober-1.79-mounted-boot-partition-fix.patch ...                                                 [ ok ]
 * Applying os-prober-1.79-fix-busy-umount-message.patch ...                                                    [ ok ]
 * Applying os-prober-1.79-efi-chroot-blkid-fallback.patch ...                                                  [ ok ]
 * ====================================================================================================================
 * Applying user patches from /etc/portage/patches ...
 * Applying 0001-Read-mounted-partitions-from-proc-self-mountinfo.patch ...
patching file common.sh
Hunk #1 FAILED at 296.
1 out of 1 hunk FAILED -- saving rejects to file common.sh.rej
patching file linux-boot-prober
Hunk #1 succeeded at 17 with fuzz 2 (offset 11 lines).
patching file os-prober
Hunk #1 succeeded at 128 (offset 8 lines).                                                                      [ !! ]
 * ERROR: sys-boot/os-prober-1.81::gentoo failed (prepare phase):
 *   patch -p1  failed with /etc/portage/patches/sys-boot/os-prober-1.81/0001-Read-mounted-partitions-from-proc-self-mountinfo.patch
 * 
 * Call stack:
 *               ebuild.sh, line  136:  Called src_prepare
 *             environment, line 1289:  Called default
 *      phase-functions.sh, line  872:  Called default_src_prepare
 *      phase-functions.sh, line  948:  Called __eapi8_src_prepare
 *             environment, line  334:  Called eapply_user
 *             environment, line  551:  Called eapply '/etc/portage/patches/sys-boot/os-prober-1.81/0001-Read-mounted-partitions-from-proc-self-mountinfo.patch'
 *             environment, line  511:  Called _eapply_patch '/etc/portage/patches/sys-boot/os-prober-1.81/0001-Read-mounted-partitions-from-proc-self-mountinfo.patch'
 *             environment, line  449:  Called __helpers_die 'patch -p1  failed with /etc/portage/patches/sys-boot/os-prober-1.81/0001-Read-mounted-partitions-from-proc-self-mountinfo.patch'
 *   isolated-functions.sh, line  112:  Called die
 * The specific snippet of code:
 *              die "$@"
 * 
 * If you need support, post the output of `emerge --info '=sys-boot/os-prober-1.81::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-boot/os-prober-1.81::gentoo'`.
 * The complete build log is located at '/var/log/portage/sys-boot:os-prober-1.81:20230120-095312.log'.
 * For convenience, a symlink to the build log is located at '/var/tmp/portage/sys-boot/os-prober-1.81/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-boot/os-prober-1.81/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-boot/os-prober-1.81/work/os-prober-1.81'
 * S: '/var/tmp/portage/sys-boot/os-prober-1.81/work/os-prober-1.81'
ZeusGentoo /var/db/repos/gentoo/sys-boot/os-prober #
Comment 32 Pacho Ramos gentoo-dev 2023-01-22 12:38:11 UTC
Yeah, I don't use initrd and I hit the duplicated entries issue
Comment 33 Petr Vandrovec 2023-01-22 21:58:55 UTC
Created attachment 849063 [details, diff]
os-prober patch for gentoo 1.81 with gentoo patches

This is the version of the patch that applies cleanly to os-prober-1.81 on gentoo.

During porting fix to gentoo I've noticed that Gentoo should not suffer from the bug Debian does, due to Gentoo having fix for bug 438380 - unlike on Debian, Gentoo with udev has /dev/root as symlink to the target device, and in my Gentoo VM link was correctly set up after boot...

So if patch does not work for you, can you please
* provide content of /proc/mounts (just first line is probably sufficient),
* whether there is /dev/root or no, and where it points,
* what is your root filesystem mount reports (output of "mount | grep ' / '"), and
* is it really your root filesystem device?  Does it match?

Also, are you using systemd or no?  I see /dev/root created on config without systemd.
Comment 34 André Terpstra 2023-01-24 09:40:57 UTC
(In reply to Petr Vandrovec from comment #33)
> Created attachment 849063 [details, diff] [details, diff]
> os-prober patch for gentoo 1.81 with gentoo patches
> 
> This is the version of the patch that applies cleanly to os-prober-1.81 on
> gentoo.
> 
> During porting fix to gentoo I've noticed that Gentoo should not suffer from
> the bug Debian does, due to Gentoo having fix for bug 438380 - unlike on
> Debian, Gentoo with udev has /dev/root as symlink to the target device, and
> in my Gentoo VM link was correctly set up after boot...
> 
> So if patch does not work for you, can you please
> * provide content of /proc/mounts (just first line is probably sufficient),
> * whether there is /dev/root or no, and where it points,
> * what is your root filesystem mount reports (output of "mount | grep ' /
> '"), and
> * is it really your root filesystem device?  Does it match?
> 
> Also, are you using systemd or no?  I see /dev/root created on config
> without systemd.

Thank you, you have solved it for me!
Comment 35 ZetaCorvi 2023-02-16 10:19:31 UTC
Will this patch be added to os-prober ebuild any time soon?
Comment 36 Ben Kohler gentoo-dev 2023-02-16 13:53:36 UTC
Sure, let's give it a try
Comment 37 Larry the Git Cow gentoo-dev 2023-02-16 13:55:25 UTC
The bug has been referenced in the following commit(s):

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

commit e0b708394fc3447613233aaa15e79a35f6b36144
Author:     Ben Kohler <bkohler@gentoo.org>
AuthorDate: 2023-02-16 13:54:23 +0000
Commit:     Ben Kohler <bkohler@gentoo.org>
CommitDate: 2023-02-16 13:55:18 +0000

    sys-boot/os-prober: add patch for duplicate current-OS detection
    
    Bug: https://bugs.gentoo.org/830655
    
    Signed-off-by: Ben Kohler <bkohler@gentoo.org>

 .../files/os-prober-1.81-boot-detected-twice.patch |  46 +++++++++
 sys-boot/os-prober/os-prober-1.81-r1.ebuild        | 103 +++++++++++++++++++++
 2 files changed, 149 insertions(+)
Comment 38 Daniel Salas 2023-02-18 03:38:02 UTC
The latest version broke the detection on my system. No output is given when I run os-prober on it's own. My setup is also very simple, 2 physical drives, 1 gentoo, 1 Windows. 

The sys-boot/os-prober-1.81 one does detect it correctly:


❯ sudo os-prober
Password:
/dev/nvme1n1p2@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi
/dev/nvme1n1p4:Gentoo Linux:Gentoo:linux
Comment 39 Petr Vandrovec 2023-02-18 04:21:46 UTC
Can you please share content of /proc/self/mountinfo ?
Comment 40 Petr Vandrovec 2023-02-18 04:24:17 UTC
And output of 'ls -l /sys/dev/block' ?
Comment 41 Daniel Salas 2023-02-18 19:13:58 UTC
$ cat  /proc/self/mountinfo 

18 1 259:8 / / rw,relatime shared:1 - ext4 /dev/root rw
19 18 0:5 / /dev rw,relatime shared:2 - devtmpfs devtmpfs rw,size=65908208k,nr_inodes=16477052,mode=755
20 18 0:17 / /proc rw,nosuid,nodev,noexec,relatime shared:5 - proc proc rw
21 18 0:18 / /sys rw,nosuid,nodev,noexec,relatime shared:6 - sysfs sysfs rw
22 19 0:19 / /dev/shm rw,nosuid,nodev shared:3 - tmpfs tmpfs rw
23 19 0:20 / /dev/pts rw,nosuid,noexec,relatime shared:4 - devpts devpts rw,gid=5,mode=620,ptmxmode=000
24 18 0:21 / /run rw,nosuid,nodev shared:12 - tmpfs tmpfs rw,size=26364836k,nr_inodes=819200,mode=755
25 21 0:22 / /sys/fs/cgroup ro,nosuid,nodev,noexec shared:7 - tmpfs tmpfs ro,size=4096k,nr_inodes=1024,mode=755
26 25 0:23 / /sys/fs/cgroup/unified rw,nosuid,nodev,noexec,relatime shared:8 - cgroup2 cgroup2 rw,nsdelegate
27 25 0:24 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime shared:9 - cgroup cgroup rw,xattr,name=systemd
28 21 0:25 / /sys/firmware/efi/efivars rw,nosuid,nodev,noexec,relatime shared:10 - efivarfs efivarfs rw
29 21 0:26 / /sys/fs/bpf rw,nosuid,nodev,noexec,relatime shared:11 - bpf bpf rw,mode=700
30 25 0:27 / /sys/fs/cgroup/hugetlb rw,nosuid,nodev,noexec,relatime shared:13 - cgroup cgroup rw,hugetlb
31 25 0:28 / /sys/fs/cgroup/net_cls,net_prio rw,nosuid,nodev,noexec,relatime shared:14 - cgroup cgroup rw,net_cls,net_prio
32 25 0:29 / /sys/fs/cgroup/perf_event rw,nosuid,nodev,noexec,relatime shared:15 - cgroup cgroup rw,perf_event
33 25 0:30 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime shared:16 - cgroup cgroup rw,freezer
34 25 0:31 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime shared:17 - cgroup cgroup rw,cpuset
35 25 0:32 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime shared:18 - cgroup cgroup rw,devices
36 25 0:33 / /sys/fs/cgroup/debug rw,nosuid,nodev,noexec,relatime shared:19 - cgroup cgroup rw,debug
37 25 0:34 / /sys/fs/cgroup/misc rw,nosuid,nodev,noexec,relatime shared:20 - cgroup cgroup rw,misc
38 25 0:35 / /sys/fs/cgroup/cpu,cpuacct rw,nosuid,nodev,noexec,relatime shared:21 - cgroup cgroup rw,cpu,cpuacct
39 25 0:36 / /sys/fs/cgroup/pids rw,nosuid,nodev,noexec,relatime shared:22 - cgroup cgroup rw,pids
40 25 0:37 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime shared:23 - cgroup cgroup rw,memory
41 25 0:38 / /sys/fs/cgroup/rdma rw,nosuid,nodev,noexec,relatime shared:24 - cgroup cgroup rw,rdma
42 25 0:39 / /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime shared:25 - cgroup cgroup rw,blkio
43 20 0:40 / /proc/sys/fs/binfmt_misc rw,relatime shared:26 - autofs systemd-1 rw,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=14442
44 19 0:41 / /dev/hugepages rw,relatime shared:27 - hugetlbfs hugetlbfs rw,pagesize=2M
45 19 0:14 / /dev/mqueue rw,nosuid,nodev,noexec,relatime shared:28 - mqueue mqueue rw
46 21 0:9 / /sys/kernel/tracing rw,nosuid,nodev,noexec,relatime shared:29 - tracefs tracefs rw
47 21 0:42 / /sys/fs/fuse/connections rw,nosuid,nodev,noexec,relatime shared:30 - fusectl fusectl rw
48 21 0:16 / /sys/kernel/config rw,nosuid,nodev,noexec,relatime shared:31 - configfs configfs rw
82 24 0:43 / /run/credentials/systemd-sysctl.service ro,nosuid,nodev,noexec,relatime shared:32 - ramfs ramfs rw,mode=700
84 24 0:44 / /run/credentials/systemd-tmpfiles-setup-dev.service ro,nosuid,nodev,noexec,relatime shared:33 - ramfs ramfs rw,mode=700
50 18 0:45 / /tmp rw,nosuid,nodev shared:68 - tmpfs tmpfs rw,size=65912088k,nr_inodes=1048576
52 18 0:46 / /var/tmp/portage rw,noatime shared:70 - tmpfs tmpfs rw,size=67108864k,mode=775,uid=250,gid=250
55 18 259:6 / /boot rw,noatime shared:72 - vfat /dev/nvme1n1p2 rw,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro
57 18 8:49 / /mnt/windows rw,relatime shared:74 - fuseblk /dev/sdd1 rw,user_id=0,group_id=0,allow_other,blksize=4096
135 24 0:48 / /run/credentials/systemd-tmpfiles-setup.service ro,nosuid,nodev,noexec,relatime shared:76 - ramfs ramfs rw,mode=700
138 24 0:49 / /run/credentials/systemd-resolved.service ro,nosuid,nodev,noexec,relatime shared:78 - ramfs ramfs rw,mode=700
75 24 0:60 / /run/user/1000 rw,nosuid,nodev,relatime shared:462 - tmpfs tmpfs rw,size=13182416k,nr_inodes=3295604,mode=700,uid=1000,gid=1000
123 75 0:61 / /run/user/1000/doc rw,nosuid,nodev,relatime shared:485 - fuse.portal portal rw,user_id=1000,group_id=1000
Comment 42 Daniel Salas 2023-02-18 19:15:06 UTC
ls -l /sys/dev/block | xclip -sel clipboard

lrwxrwxrwx 0 root 18 Feb 11:10 7:0 -> ../../devices/virtual/block/loop0
lrwxrwxrwx 0 root 18 Feb 11:10 7:1 -> ../../devices/virtual/block/loop1
lrwxrwxrwx 0 root 18 Feb 11:10 7:2 -> ../../devices/virtual/block/loop2
lrwxrwxrwx 0 root 18 Feb 11:10 7:3 -> ../../devices/virtual/block/loop3
lrwxrwxrwx 0 root 18 Feb 11:10 7:4 -> ../../devices/virtual/block/loop4
lrwxrwxrwx 0 root 18 Feb 11:10 7:5 -> ../../devices/virtual/block/loop5
lrwxrwxrwx 0 root 18 Feb 11:10 7:6 -> ../../devices/virtual/block/loop6
lrwxrwxrwx 0 root 18 Feb 11:10 7:7 -> ../../devices/virtual/block/loop7
lrwxrwxrwx 0 root 18 Feb 11:10 8:0 -> ../../devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:09.0/0000:09:00.0/ata2/host1/target1:0:0/1:0:0:0/block/sda
lrwxrwxrwx 0 root 18 Feb 11:10 8:1 -> ../../devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:09.0/0000:09:00.0/ata2/host1/target1:0:0/1:0:0:0/block/sda/sda1
lrwxrwxrwx 0 root 18 Feb 11:10 8:16 -> ../../devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:09.0/0000:09:00.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb
lrwxrwxrwx 0 root 18 Feb 11:10 8:17 -> ../../devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:09.0/0000:09:00.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/sdb1
lrwxrwxrwx 0 root 18 Feb 11:10 8:32 -> ../../devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:0a.0/0000:0a:00.0/ata6/host5/target5:0:0/5:0:0:0/block/sdc
lrwxrwxrwx 0 root 18 Feb 11:10 8:33 -> ../../devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:0a.0/0000:0a:00.0/ata6/host5/target5:0:0/5:0:0:0/block/sdc/sdc1
lrwxrwxrwx 0 root 18 Feb 11:10 8:48 -> ../../devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:0a.0/0000:0a:00.0/ata10/host9/target9:0:0/9:0:0:0/block/sdd
lrwxrwxrwx 0 root 18 Feb 11:10 8:49 -> ../../devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:0a.0/0000:0a:00.0/ata10/host9/target9:0:0/9:0:0:0/block/sdd/sdd1
lrwxrwxrwx 0 root 18 Feb 11:10 259:0 -> ../../devices/pci0000:00/0000:00:01.1/0000:01:00.0/nvme/nvme0/nvme0n1
lrwxrwxrwx 0 root 18 Feb 11:10 259:1 -> ../../devices/pci0000:00/0000:00:01.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1
lrwxrwxrwx 0 root 18 Feb 11:10 259:2 -> ../../devices/pci0000:00/0000:00:01.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2
lrwxrwxrwx 0 root 18 Feb 11:10 259:3 -> ../../devices/pci0000:00/0000:00:01.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3
lrwxrwxrwx 0 root 18 Feb 11:10 259:4 -> ../../devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:01.0/0000:04:00.0/nvme/nvme1/nvme1n1
lrwxrwxrwx 0 root 18 Feb 11:10 259:5 -> ../../devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:01.0/0000:04:00.0/nvme/nvme1/nvme1n1/nvme1n1p1
lrwxrwxrwx 0 root 18 Feb 11:10 259:6 -> ../../devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:01.0/0000:04:00.0/nvme/nvme1/nvme1n1/nvme1n1p2
lrwxrwxrwx 0 root 18 Feb 11:10 259:7 -> ../../devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:01.0/0000:04:00.0/nvme/nvme1/nvme1n1/nvme1n1p3
lrwxrwxrwx 0 root 18 Feb 11:10 259:8 -> ../../devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:01.0/0000:04:00.0/nvme/nvme1/nvme1n1/nvme1n1p4
Comment 43 Petr Vandrovec 2023-02-18 19:59:55 UTC
Interesting. Can you find installed common.sh from os-prober (I believe it is in /usr/share/os-prober/common.sh; I'm on cellphone now) and add one more 'x' before fs:

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

For some reason it seems like that your mountinfo has one more column. Will have to check kernel sources and find out what all formats are possible.
Comment 44 Jae Hak Kim 2023-02-25 02:40:39 UTC
(In reply to Petr Vandrovec from comment #43)
> Interesting. Can you find installed common.sh from os-prober (I believe it
> is in /usr/share/os-prober/common.sh; I'm on cellphone now) and add one more
> 'x' before fs:
> 
> - while read -r x x dev x mount x x fs x; do
> + while read -r x x dev x mount x x x fs x; do
> 
> For some reason it seems like that your mountinfo has one more column. Will
> have to check kernel sources and find out what all formats are possible.

I have exact same issue as Daniel.

theoffice ~ # ls -l /sys/dev/block
total 0
lrwxrwxrwx 1 root root 0 Feb 25 12:02 252:0 -> ../../devices/virtual/block/zram0
lrwxrwxrwx 1 root root 0 Feb 25 12:02 252:1 -> ../../devices/virtual/block/zram1
lrwxrwxrwx 1 root root 0 Feb 25 13:20 252:2 -> ../../devices/virtual/block/zram2
lrwxrwxrwx 1 root root 0 Feb 25 13:20 259:0 -> ../../devices/pci0000:00/0000:00:0e.0/pci10000:e0/10000:e0:06.0/10000:e1:00.0/nvme/nvme0/nvme0n1
lrwxrwxrwx 1 root root 0 Feb 25 13:20 259:1 -> ../../devices/pci0000:00/0000:00:0e.0/pci10000:e0/10000:e0:06.0/10000:e1:00.0/nvme/nvme0/nvme0n1/nvme0n1p1
lrwxrwxrwx 1 root root 0 Feb 25 13:20 259:2 -> ../../devices/pci0000:00/0000:00:0e.0/pci10000:e0/10000:e0:06.0/10000:e1:00.0/nvme/nvme0/nvme0n1/nvme0n1p2
lrwxrwxrwx 1 root root 0 Feb 25 13:20 259:3 -> ../../devices/pci0000:00/0000:00:0e.0/pci10000:e0/10000:e0:06.0/10000:e1:00.0/nvme/nvme0/nvme0n1/nvme0n1p3
lrwxrwxrwx 1 root root 0 Feb 25 13:20 259:4 -> ../../devices/pci0000:00/0000:00:0e.0/pci10000:e0/10000:e0:06.0/10000:e1:00.0/nvme/nvme0/nvme0n1/nvme0n1p4
lrwxrwxrwx 1 root root 0 Feb 25 13:20 259:5 -> ../../devices/pci0000:00/0000:00:0e.0/pci10000:e0/10000:e0:06.0/10000:e1:00.0/nvme/nvme0/nvme0n1/nvme0n1p5
lrwxrwxrwx 1 root root 0 Feb 25 13:20 259:6 -> ../../devices/pci0000:00/0000:00:0e.0/pci10000:e0/10000:e0:06.0/10000:e1:00.0/nvme/nvme0/nvme0n1/nvme0n1p6
lrwxrwxrwx 1 root root 0 Feb 25 13:20 259:7 -> ../../devices/pci0000:00/0000:00:0e.0/pci10000:e0/10000:e0:06.0/10000:e1:00.0/nvme/nvme0/nvme0n1/nvme0n1p7
theoffice ~ # 

theoffice ~ # cat /proc/self/mountinfo 
20 70 0:19 / /proc rw,nosuid,nodev,noexec,relatime shared:13 - proc proc rw
21 70 0:20 / /sys rw,nosuid,nodev,noexec,relatime shared:2 - sysfs sysfs rw
22 70 0:5 / /dev rw,nosuid shared:9 - devtmpfs devtmpfs rw,size=4096k,nr_inodes=2002736,mode=755,inode64
23 21 0:6 / /sys/kernel/security rw,nosuid,nodev,noexec,relatime shared:3 - securityfs securityfs rw
24 22 0:21 / /dev/shm rw,nosuid,nodev shared:10 - tmpfs tmpfs rw,inode64
25 22 0:22 / /dev/pts rw,nosuid,noexec,relatime shared:11 - devpts devpts rw,gid=5,mode=620,ptmxmode=000
26 70 0:23 / /run rw,nosuid,nodev shared:12 - tmpfs tmpfs rw,size=3218312k,nr_inodes=819200,mode=755,inode64
27 21 0:24 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime shared:4 - cgroup2 cgroup2 rw,nsdelegate,memory_recursiveprot
28 21 0:25 / /sys/fs/pstore rw,nosuid,nodev,noexec,relatime shared:5 - pstore pstore rw
29 21 0:26 / /sys/firmware/efi/efivars rw,nosuid,nodev,noexec,relatime shared:6 - efivarfs efivarfs rw
30 21 0:27 / /sys/fs/bpf rw,nosuid,nodev,noexec,relatime shared:7 - bpf bpf rw,mode=700
65 21 0:32 / /sys/kernel/config rw,nosuid,nodev,noexec,relatime shared:8 - configfs configfs rw
70 1 259:7 / / rw,noatime shared:1 - ext4 /dev/nvme0n1p7 rw
31 20 0:28 / /proc/sys/fs/binfmt_misc rw,relatime shared:14 - autofs systemd-1 rw,fd=28,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=17237
32 22 0:29 / /dev/hugepages rw,relatime shared:15 - hugetlbfs hugetlbfs rw,pagesize=2M
33 22 0:18 / /dev/mqueue rw,nosuid,nodev,noexec,relatime shared:16 - mqueue mqueue rw
34 21 0:12 / /sys/kernel/tracing rw,nosuid,nodev,noexec,relatime shared:17 - tracefs tracefs rw
35 21 0:7 / /sys/kernel/debug rw,nosuid,nodev,noexec,relatime shared:18 - debugfs debugfs rw
36 21 0:30 / /sys/fs/fuse/connections rw,nosuid,nodev,noexec,relatime shared:19 - fusectl fusectl rw
58 26 0:31 / /run/credentials/systemd-tmpfiles-setup-dev.service ro,nosuid,nodev,noexec,relatime shared:20 - ramfs ramfs rw,mode=700
90 26 0:35 / /run/credentials/systemd-sysctl.service ro,nosuid,nodev,noexec,relatime shared:34 - ramfs ramfs rw,mode=700
40 70 252:2 / /var/tmp rw,relatime shared:90 - ext4 /dev/zram2 rw,discard
44 70 0:37 / /tmp rw,nosuid,nodev shared:101 - tmpfs tmpfs rw,size=8045776k,nr_inodes=1048576,inode64
50 70 259:5 / /boot rw,noatime shared:105 - ext4 /dev/nvme0n1p5 rw
54 50 259:1 / /boot/efi rw,noatime shared:109 - vfat /dev/nvme0n1p1 rw,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro
167 26 0:40 / /run/credentials/systemd-tmpfiles-setup.service ro,nosuid,nodev,noexec,relatime shared:113 - ramfs ramfs rw,mode=700
230 26 0:42 / /run/credentials/systemd-resolved.service ro,nosuid,nodev,noexec,relatime shared:117 - ramfs ramfs rw,mode=700
425 26 0:57 / /run/user/1000 rw,nosuid,nodev,relatime shared:504 - tmpfs tmpfs rw,size=1609152k,nr_inodes=402288,mode=700,uid=1000,gid=1000,inode64
172 425 0:52 / /run/user/1000/doc rw,nosuid,nodev,relatime shared:331 - fuse.portal portal rw,user_id=1000,group_id=1000
theoffice ~ # 

Changing /usr/share/os-prober/common.sh as per your suggestion fixes the issue for me.
- while read -r x x dev x mount x x fs x; do
+ while read -r x x dev x mount x x x fs x; do
Comment 45 Petr Vandrovec 2023-02-25 03:27:13 UTC
Thanks. I read description of mountinfo and there can be any amount of entries in front of 'fs', with last being '-' alone. So simple parsing on spaces doesn't work.

It will have to parse tail of line column by column, looking for entry with '-' value - after that it is 'fs' entry.

Unfortunately I won't be able to create fix at least until next Wednesday :-( So maybe change should be reverted for now.
Comment 46 Daniel Salas 2023-02-25 03:30:25 UTC
I apologize, I absolutely missed coming back to this. If it is still worth anything, the suggested change works.
Comment 47 Ben Kohler gentoo-dev 2023-04-05 12:37:32 UTC
(In reply to Petr Vandrovec from comment #45)
> Thanks. I read description of mountinfo and there can be any amount of
> entries in front of 'fs', with last being '-' alone. So simple parsing on
> spaces doesn't work.
> 
> It will have to parse tail of line column by column, looking for entry with
> '-' value - after that it is 'fs' entry.
> 
> Unfortunately I won't be able to create fix at least until next Wednesday
> :-( So maybe change should be reverted for now.

Can you take another look at this? Latest patch in os-prober-1.81-r1 is breaking Windows detection
Comment 48 Peter Levine 2023-04-05 22:46:30 UTC
Created attachment 859591 [details, diff]
os-prober-1.81-boot-detected-twice.patch

Try replacing os-prober-1.81-boot-detected-twice.patch with this revised version and see if you can reproduce the issue.
Comment 49 Pacho Ramos gentoo-dev 2023-04-20 13:19:06 UTC
(In reply to Peter Levine from comment #48)
> Created attachment 859591 [details, diff] [details, diff]
> os-prober-1.81-boot-detected-twice.patch
> 
> Try replacing os-prober-1.81-boot-detected-twice.patch with this revised
> version and see if you can reproduce the issue.

At least in my case it keeps detecting the booted partition :(
# os-prober
/dev/nvme0n1p2:Gentoo Linux:Gentoo:linux

# cat /proc/self/mountinfo 
20 1 259:2 / / rw,noatime shared:1 - ext4 /dev/root rw
21 20 0:5 / /dev rw,relatime shared:2 - devtmpfs devtmpfs rw,size=16280024k,nr_inodes=4070006,mode=755
22 20 0:19 / /proc rw,nosuid,nodev,noexec,relatime shared:5 - proc proc rw
23 20 0:20 / /sys rw,nosuid,nodev,noexec,relatime shared:6 - sysfs sysfs rw
24 21 0:21 / /dev/shm rw,nosuid,nodev shared:3 - tmpfs tmpfs rw
25 21 0:22 / /dev/pts rw,nosuid,noexec,relatime shared:4 - devpts devpts rw,gid=5,mode=620,ptmxmode=000
26 20 0:23 / /run rw,nosuid,nodev shared:11 - tmpfs tmpfs rw,size=6512716k,nr_inodes=819200,mode=755
27 23 0:24 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime shared:7 - cgroup2 cgroup2 rw,nsdelegate,memory_recursiveprot
28 23 0:25 / /sys/fs/pstore rw,nosuid,nodev,noexec,relatime shared:8 - pstore pstore rw
29 23 0:26 / /sys/firmware/efi/efivars rw,nosuid,nodev,noexec,relatime shared:9 - efivarfs efivarfs rw
30 23 0:27 / /sys/fs/bpf rw,nosuid,nodev,noexec,relatime shared:10 - bpf bpf rw,mode=700
31 22 0:28 / /proc/sys/fs/binfmt_misc rw,relatime shared:12 - autofs systemd-1 rw,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=4268
32 21 0:29 / /dev/hugepages rw,relatime shared:13 - hugetlbfs hugetlbfs rw,pagesize=2M
33 21 0:15 / /dev/mqueue rw,nosuid,nodev,noexec,relatime shared:14 - mqueue mqueue rw
34 23 0:6 / /sys/kernel/debug rw,nosuid,nodev,noexec,relatime shared:15 - debugfs debugfs rw
35 23 0:30 / /sys/fs/fuse/connections rw,nosuid,nodev,noexec,relatime shared:16 - fusectl fusectl rw
36 23 0:16 / /sys/kernel/config rw,nosuid,nodev,noexec,relatime shared:17 - configfs configfs rw
56 26 0:31 / /run/credentials/systemd-tmpfiles-setup-dev.service ro,nosuid,nodev,noexec,relatime shared:18 - ramfs ramfs rw,mode=700
95 26 0:33 / /run/credentials/systemd-sysctl.service ro,nosuid,nodev,noexec,relatime shared:19 - ramfs ramfs rw,mode=700
168 20 0:36 / /tmp rw,nosuid,nodev shared:80 - tmpfs tmpfs rw,size=16281788k,nr_inodes=1048576
175 20 0:37 / /var/tmp/portage rw,relatime shared:90 - tmpfs tmpfs rw
182 20 259:1 / /boot rw,noatime shared:94 - vfat /dev/nvme0n1p1 rw,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
213 26 0:38 / /run/credentials/systemd-tmpfiles-setup.service ro,nosuid,nodev,noexec,relatime shared:98 - ramfs ramfs rw,mode=700
627 26 0:46 / /run/user/1000 rw,nosuid,nodev,relatime shared:333 - tmpfs tmpfs rw,size=3256356k,nr_inodes=814089,mode=700,uid=1000,gid=1000
679 627 0:47 / /run/user/1000/gvfs rw,nosuid,nodev,relatime shared:372 - fuse.gvfsd-fuse gvfsd-fuse rw,user_id=1000,group_id=1000
1034 26 8:1 / /run/media/pacho/0988cd61-229a-451a-937f-37eee98bc989 rw,nosuid,nodev,relatime shared:508 - ext4 /dev/sda1 rw,errors=remount-ro
823 627 0:50 / /run/user/1000/doc rw,nosuid,nodev,relatime shared:427 - fuse.portal portal rw,user_id=1000,group_id=1000

# cat /proc/mounts
/dev/root / ext4 rw,noatime 0 0
devtmpfs /dev devtmpfs rw,relatime,size=16280024k,nr_inodes=4070006,mode=755 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,nodev,size=6512716k,nr_inodes=819200,mode=755 0 0
cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot 0 0
pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0
efivarfs /sys/firmware/efi/efivars efivarfs rw,nosuid,nodev,noexec,relatime 0 0
bpf /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=4268 0 0
hugetlbfs /dev/hugepages hugetlbfs rw,relatime,pagesize=2M 0 0
mqueue /dev/mqueue mqueue rw,nosuid,nodev,noexec,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,nosuid,nodev,noexec,relatime 0 0
fusectl /sys/fs/fuse/connections fusectl rw,nosuid,nodev,noexec,relatime 0 0
configfs /sys/kernel/config configfs rw,nosuid,nodev,noexec,relatime 0 0
ramfs /run/credentials/systemd-tmpfiles-setup-dev.service ramfs ro,nosuid,nodev,noexec,relatime,mode=700 0 0
ramfs /run/credentials/systemd-sysctl.service ramfs ro,nosuid,nodev,noexec,relatime,mode=700 0 0
tmpfs /tmp tmpfs rw,nosuid,nodev,size=16281788k,nr_inodes=1048576 0 0
tmpfs /var/tmp/portage tmpfs rw,relatime 0 0
/dev/nvme0n1p1 /boot vfat rw,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
ramfs /run/credentials/systemd-tmpfiles-setup.service ramfs ro,nosuid,nodev,noexec,relatime,mode=700 0 0
tmpfs /run/user/1000 tmpfs rw,nosuid,nodev,relatime,size=3256356k,nr_inodes=814089,mode=700,uid=1000,gid=1000 0 0
gvfsd-fuse /run/user/1000/gvfs fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0
/dev/sda1 /run/media/pacho/0988cd61-229a-451a-937f-37eee98bc989 ext4 rw,nosuid,nodev,relatime,errors=remount-ro 0 0
portal /run/user/1000/doc fuse.portal rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0

Thanks a lot for your help on this
Comment 50 Michael Cook 2023-04-20 18:06:47 UTC
I'm also having Windows detection issues with 1.81-r1, downgrading to 1.81 detects it again.
Comment 51 Peter Levine 2023-04-21 06:52:06 UTC
Created attachment 860462 [details, diff]
os-prober-1.81-boot-detected-twice.patch

OK. Lets try under-engineering it.  Please test by replacing the original os-prober-1.81-boot-detected-twice.patch with this one, re-emerge, and confirm whether or not the issue persists.
Comment 52 Michael Cook 2023-04-21 14:49:31 UTC
(In reply to Peter Levine from comment #51)
> Created attachment 860462 [details, diff] [details, diff]
> os-prober-1.81-boot-detected-twice.patch
> 
> OK. Lets try under-engineering it.  Please test by replacing the original
> os-prober-1.81-boot-detected-twice.patch with this one, re-emerge, and
> confirm whether or not the issue persists.

That seems to be working for me, unsure if it also fixes whatever issue this bug report was originally trying to fix.
Comment 53 Pacho Ramos gentoo-dev 2023-04-25 13:19:40 UTC
(In reply to Peter Levine from comment #51)
> Created attachment 860462 [details, diff] [details, diff]
> os-prober-1.81-boot-detected-twice.patch
> 
> OK. Lets try under-engineering it.  Please test by replacing the original
> os-prober-1.81-boot-detected-twice.patch with this one, re-emerge, and
> confirm whether or not the issue persists.

It keeps failing and detecting the booted system. I think it is because it still catches the /boot partition (used in most UEFI setups):
# grep -P '^/dev/(?!root\s)' /proc/mounts
/dev/nvme0n1p1 /boot vfat rw,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
Comment 54 Peter Levine 2023-08-07 03:13:18 UTC
(In reply to Pacho Ramos from comment #53)
> It keeps failing and detecting the booted system. I think it is because it
> still catches the /boot partition (used in most UEFI setups):
> # grep -P '^/dev/(?!root\s)' /proc/mounts
> /dev/nvme0n1p1 /boot vfat
> rw,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,
> shortname=mixed,errors=remount-ro 0 0

Please post the output of `grub-mkconfig`.
Comment 55 Pacho Ramos gentoo-dev 2023-08-08 09:10:17 UTC
Created attachment 867387 [details]
grub-mkconfig output
Comment 56 Peter Levine 2023-08-09 03:16:45 UTC
(In reply to Pacho Ramos from comment #55)
> Created attachment 867387 [details]
> grub-mkconfig output

Do you have multipath enabled?

Also, if using systemd, run:

> export START=$(date +%s); os-prober; journalctl --no-pager --since @$START > /tmp/debug.txt

and attach debug.txt
Comment 57 Pacho Ramos gentoo-dev 2023-08-10 08:13:09 UTC
(In reply to Peter Levine from comment #56)
> (In reply to Pacho Ramos from comment #55)
> > Created attachment 867387 [details]
> > grub-mkconfig output
> 
> Do you have multipath enabled?
> 

No, I even didn't know what were multipath partitions until now :)
Comment 58 Pacho Ramos gentoo-dev 2023-08-10 08:15:13 UTC
Created attachment 867537 [details]
debug.txt

File attached, Thanks!
Comment 59 Peter Levine 2023-08-13 04:39:58 UTC
(In reply to Pacho Ramos from comment #58)
> Created attachment 867537 [details]
> debug.txt
> 
> File attached, Thanks!

I'm having trouble reproducing the issue.
It looks like your ESP partition is also your boot partition. 
What's the output of `find /boot -maxdepth 2`?

Also, assuming the UUID is correct, you should be able to add GRUB_OS_PROBER_SKIP_LIST="cd5903a3-774c-4305-9d16-9bfdffc2b043@/dev/nvme0n1p2" to /etc/default/grub as a workaround.
Comment 60 Pacho Ramos gentoo-dev 2023-08-15 10:32:41 UTC
(In reply to Peter Levine from comment #59)
> (In reply to Pacho Ramos from comment #58)
> > Created attachment 867537 [details]
> > debug.txt
> > 
> > File attached, Thanks!
> 
> I'm having trouble reproducing the issue.
> It looks like your ESP partition is also your boot partition. 
> What's the output of `find /boot -maxdepth 2`

Yes, it is the same partition for everything under /boot
find /boot -maxdepth 2
/boot
/boot/vmlinuz-6.1.32-gentoo
/boot/System.map-6.1.32-gentoo
/boot/config-6.1.32-gentoo
/boot/vmlinuz-6.1.32-gentoo.old
/boot/System.map-6.1.32-gentoo.old
/boot/config-6.1.32-gentoo.old
/boot/grub
/boot/grub/x86_64-efi
/boot/grub/locale
/boot/grub/themes
/boot/grub/fonts
/boot/grub/grubenv
/boot/grub/grub.cfg
/boot/EFI
/boot/EFI/gentoo
/boot/EFI/HP
/boot/vmlinuz-6.1.38-gentoo
/boot/System.map-6.1.38-gentoo
/boot/config-6.1.38-gentoo
/boot/vmlinuz-6.1.24-gentoo
/boot/System.map-6.1.24-gentoo
/boot/config-6.1.24-gentoo
/boot/vmlinuz-6.1.26-gentoo
/boot/System.map-6.1.26-gentoo
/boot/config-6.1.26-gentoo
/boot/vmlinuz-6.1.27-gentoo
/boot/System.map-6.1.27-gentoo
/boot/config-6.1.27-gentoo