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

Erol SANER <[email protected]> Sun, 26 Jul 2026 03:23:34 +0300
Newsgroups gmane.linux.debian.devel.boot
Organization Personal Mail
Message-ID <0ab32011-bb8e-47ce-b8f7-b7015fa7cda6__15378.7878270791$1785025526$gmane$org@gmail.com>
Package: os-prober
Version: 1.83
Severity: normal

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.