#1142788 os-prober fails to detect Windows Boot Manager under tr_TR.UTF-8 locale

Package:
os-prober
Source:
os-prober
Description:
utility to detect other OSes on a set of drives
Submitter:
Date:
2026-07-30 12:51:01 UTC
Severity:
normal
Tags:
#1142788#5
Date:
2026-07-26 00:23:34 UTC
From:
To:
Dear Debian os-prober maintainers,

I would like to report what appears to be a locale-dependent bug in
os-prober affecting Windows Boot Manager detection.

System
------

Distribution: Debian 13 (Trixie)
Package: os-prober 1.83
Locale: tr_TR.UTF-8
Boot mode: UEFI
Disk layout:
   - EFI System Partition (FAT32)
   - Windows Boot Manager
   - Debian GNU/Linux

Problem
-------

Running:

     sudo update-grub

does not detect the existing Windows Boot Manager.

The generated GRUB configuration only contains Linux entries.

However, running:

     sudo LC_ALL=C update-grub

correctly reports:

     Found Windows Boot Manager on
     /dev/nvme0n1p2@/EFI/Microsoft/Boot/bootmgfw.efi

and Windows is added to the GRUB menu.

Investigation
-------------

The EFI System Partition was verified to be correct.

The following all succeed:

- EFI partition mounts correctly.
- /boot/efi/EFI exists.
- /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi exists.
- efibootmgr shows Windows Boot Manager.
- The Microsoft probe:

       /usr/lib/os-probes/mounted/efi/20microsoft /boot/efi/EFI

   correctly detects Windows.

Tracing os-prober using:

     sh -x /usr/bin/os-prober

showed that it executes:

     /usr/lib/os-probes/mounted/05efi

Tracing that script further shows that it exits with:

     /boot/efi does not have /EFI directory

even though the directory exists.

The relevant helper function is:

     item_in_dir()

defined in:

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

which performs:

     ls -1 "$2" | grep -i "^$1$"

Additional testing showed:

Under tr_TR.UTF-8:

     ls -1 /boot/efi | grep -i '^efi$'

returns no output.

Under the C locale:

     LC_ALL=C sh -c 'ls -1 /boot/efi | grep -i "^efi$"'

correctly returns:

     EFI

This strongly suggests that the failure is locale-dependent.

Expected behaviour
------------------

Windows Boot Manager should be detected regardless of the user's locale.

Workaround
----------

Running:

     sudo LC_ALL=C update-grub

correctly detects Windows and generates the expected GRUB entry.

Possible cause
--------------

The failure appears to be related to locale-sensitive case-insensitive
matching inside item_in_dir(). The helper should ideally perform the
comparison in a locale-independent manner.

Investigation performed by:

     Erol Saner
     ChatGPT (OpenAI)

Thank you for maintaining Debian and for your time reviewing this report.

#1142788#10
Date:
2026-07-30 10:29:43 UTC
From:
To:
Hi Erol,

Am 26. Juli 2026 02:23:34 MESZ schrieb Erol SANER <erolsaner@gmail.com>:

Thanks for your exact analysis.

Subject to another/better ideas, and until a final fix arrives, my proposal would be, to add "LC_ALL=C" to the command for now.

Thoughts/objections anyone?


Holger

#1142788#15
Date:
2026-07-30 10:35:04 UTC
From:
To:
That's exactly the right thing, yeah.
#1142788#20
Date:
2026-07-30 11:02:46 UTC
From:
To:
Hi,

Erol SANER <erolsaner@gmail.com> (2026-07-26):

This would:

    echo EFI | grep -i '^efı$'

with the final character before the anchor on the right being:

    U+0131 LATIN SMALL LETTER DOTLESS I

And this would:

    echo EFİ | grep -i '^efi$'

with the final character in the echo being:

    U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE

The presence/absence of the dot being significant in Turkish:
https://en.wikipedia.org/wiki/Turkish_alphabet

And yes, as Steve hinted, setting LC_ALL=C is the way to go: we don't
want to have to know about (or be exposed to) locale-dependent fun here.


Cheers,

#1142788#25
Date:
2026-07-30 11:08:50 UTC
From:
To:
Hi,

Steve McIntyre <steve@einval.com> wrote (Thu, 30 Jul 2026 11:35:04 +0100):

Pushed to git.


Holger

#1142788#32
Date:
2026-07-30 12:48:48 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
os-prober, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1142788@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Holger Wansing <hwansing@mailbox.org> (supplier of updated os-prober package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Thu, 30 Jul 2026 14:26:34 +0200
Source: os-prober
Architecture: source
Version: 1.85
Distribution: unstable
Urgency: medium
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Changed-By: Holger Wansing <hwansing@mailbox.org>
Closes: 1142788
Changes:
 os-prober (1.85) unstable; urgency=medium
 .
   * Team upload
 .
   * Make sure, that the grep call for finding /boot/efi/EFI is locale-
     independent (add "LC_ALL=C"). Closes: #1142788.
Checksums-Sha1:
 71ac95fb386414c251571fd501d86f0ea15a3750 1769 os-prober_1.85.dsc
 4e36901b4d367cac54a40d24abcf9ed4f5a5b7b2 27712 os-prober_1.85.tar.xz
 ae04f987042c0f161968c9faf35ff0692ada06ae 6083 os-prober_1.85_amd64.buildinfo
Checksums-Sha256:
 6f3ac82a681929bbded0c42bda4dcaf9e96c031f671773dfa568e94393c7a335 1769 os-prober_1.85.dsc
 f06094db841a214f975e79d66e2a79ea8c2b39b0f762e9d384b2feffd4ae7447 27712 os-prober_1.85.tar.xz
 bf3e81a28841eee76b22b3510ac6508ab793108466a55ec1512b31031696fef9 6083 os-prober_1.85_amd64.buildinfo
Files:
 63e4ec488788f836752a8579cf61fe75 1769 debian-installer optional os-prober_1.85.dsc
 1567ac12b2443e612e99f54db3690bf4 27712 debian-installer optional os-prober_1.85.tar.xz
 d478ecd0205ce3882e63b60fe4fc5810 6083 debian-installer optional os-prober_1.85_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----

iQJJBAEBCgAzFiEESWrG6BRCSzSFCDUpWfGHyhVusHYFAmprRBEVHGh3YW5zaW5n
QG1haWxib3gub3JnAAoJEFnxh8oVbrB2lHkQALJtd/HWNC593r6DzF4H/mUO9yIK
cn5mzyJ+W3cVcEyvbLTHtdiDQTlnMgkZlQ0jrwENHYJ1clyh3CHv7wRc3qHsgR7o
HDg/IejcJ5ChGvsPWX3LvZaoonOH52lNwgRsocxabLi5BY8Ec8tHAWjY4KLJp3XG
tjMDv/n9I/x5MXI8AQ1ZaKjIGhy9NOZHA86461WLjoNHTqFIyG0frF3gthWJ4ixS
xYToeHLkhU+GfpUmfLFcyIfu2RI6gOJcsLncNQuz0CPm+tFhoCbs9hDF5ukqK6a4
8OSHahwEknGVWKfESW4bPMttMHU8xRjenDLq2WI9QECxBqyU3aCG5mmQ8y3mpa6r
i6lZYRfKWVhGpQ31V7AYl7zik28XZCV15Wmz8IEAjkelxqYx5CjZNwSX6SVQZcs/
ztf/G6mdmxqukghLppv/+2fYWfELn2mqG0vcyUzmdPbT9q9469zBri0XNjVyT0g4
hjp3jayzxmlkFyJdJwCrgNtwUggJFtSOsmrw3o/iSVzPsIJWo4f2IFV7VP36VSlX
GKyFizzbSYeb/W4li2M+bbqFZ6Tx48WIy7T87Gzw26wJwg4o2i7jBg97g0rE1Nvv
6cpZH+wNwv1B71RG9Tg6Pf59H8csiq3lQs2XijVA71nUNKWRmaJwfBzG1HCGd0Ae
Bzv48mbX4nfRndyq
=C971
-----END PGP SIGNATURE-----