Re: os-prober and LUKS

2025-12-28 Thread Josef Wolf
Thanks for your reply, Rolf!

On Sat, Dec 27, 2025 at 10:37:06PM +0100, Rolf Reintjes wrote:
> Am 27.12.2025 um 09:28 schrieb Josef Wolf:
> > I am not sure where to discuss these things, since I can't find the original
> > repository of os-prober.

Unfortunately, my original report was 18 months ago against the only repo I
could find at that time. Seems to be some bogus, outdated repo:
https://github.com/MaddieM4/os-prober/issues/10

This is why I asked where would be the correct place to discuss this problem.

> I think the original code is correct.
> If the path is not found in the mounted ones it means: The boot-files are
> direct on the main partition or the separat boot partition is yet not being
> detected/mounted.

Actually, the partition to be checked _IS_ mounted at $mtpt. But the test
checks for $mtpt/boot, which happens to be /old/boot/boot in the case of the
old boot partition and /old/boot for the old root partition. Thus I suspect
the problem occures while checking old root partition.

The problem occured during install, and removing the negation fixed the
problem at that time. I'll have to do a fresh install to investigate the
situation in more detail.

Here's some additional context:

I've set up a system with full disk encryption (including boot partitions) and
two installs, like this:

   $ lsblk | tail -19
   nvme0n1   259:00   1,8T  0 disk  
   ├─nvme0n1p1   259:10 1M  0 part  
   ├─nvme0n1p2   259:20   128M  0 part  /boot/efi
   ├─nvme0n1p3   259:30 1G  0 part  
   │ └─cr-boot-1 252:20  1022M  0 crypt /old/boot
   ├─nvme0n1p4   259:40 1G  0 part  
   │ └─cr-boot-2 252:30  1022M  0 crypt /boot
   ├─nvme0n1p5   259:5080G  0 part  
   │ └─cr-root-1 252:5080G  0 crypt /old
   ├─nvme0n1p6   259:6080G  0 part  
   │ └─cr-root-2 252:0080G  0 crypt /
   ├─nvme0n1p7   259:7032G  0 part  
   │ └─cr-swap   252:1032G  0 crypt [SWAP]
   └─nvme0n1p8   259:80   1,6T  0 part  
 └─cr-m  252:40   1,6T  0 crypt /var/tmp
/var/spool/mail
/usr/local
/home
/m

Any comments on the second one?

> > Second is a missing feature. OS on LUKS volumes wont be checked at all, even
> > if the partition is currently unlocked. Please check/comment on this patch:
> > 
> > 
> > --- /usr/bin/os-prober-orig 2021-07-11 04:43:50.0 +0200
> > +++ /usr/bin/os-prober  2024-06-21 22:13:54.286221887 +0200
> > @@ -74,6 +74,15 @@
> > echo "$(LVM_SUPPRESS_FD_WARNINGS=1 log_output lvs --noheadings 
> > --separator : -o vg_name,lv_name |
> > sed 
> > "s|-|--|g;s|^[[:space:]]*\(.*\):\(.*\)$|/dev/mapper/\1-\2|")"
> > fi
> > +
> > +   # Also detect OSes on LUKS encrypted volumes that are currently unlocked
> > +   if type cryptsetup >/dev/null 2>&1; then
> > +   for device in $(ls /dev/mapper); do
> > +   if [ "$(cryptsetup status /dev/mapper/$device | grep 
> > LUKS)" != "" ]; then
> > +   echo "/dev/mapper/$device"
> > +   fi
> > +   done
> > +   fi
> >   }
> >   parse_proc_swaps () {

-- 
Josef Wolf
[email protected]



Re: os-prober and LUKS

2025-12-27 Thread Rolf Reintjes

Hello,

On 12/27/25 09:28, Josef Wolf wrote:

Hello,

I am not sure where to discuss these things, since I can't find the original
repository of os-prober.


https://salsa.debian.org/installer-team/os-prober

Rolf



While playing around with full-disk-encryption, I stumbled over two problems.

First problem is, that IMHO, the test for separate boot partition seems to be
inversed. Please check/comment this patch:

--- /usr/bin/linux-boot-prober-orig 2024-06-22 01:28:39.158074714 +0200
+++ /usr/bin/linux-boot-prober  2024-06-22 01:27:42.877687702 +0200
@@ -35,7 +35,7 @@
mpoint="$(unescape_mount "$mpoint")"
if [ "$mpoint" != "/target/boot" ] && [ "$mpoint" != "/target" ] && [ "$mpoint" 
!= "/" ]; then
type=$(grep "^$mapped " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d 
" " -f 3)
-   if ! grep -q " $mpoint/boot " "$OS_PROBER_TMP/mounted-map"; then
+   if grep -q " $mpoint/boot " "$OS_PROBER_TMP/mounted-map"; then
linux_mount_boot "$partition" "$mpoint"
bootpart="${mountboot%% *}"
bootmounted="${mountboot#* }"


Second is a missing feature. OS on LUKS volumes wont be checked at all, even
if the partition is currently unlocked. Please check/comment on this patch:


--- /usr/bin/os-prober-orig 2021-07-11 04:43:50.0 +0200
+++ /usr/bin/os-prober  2024-06-21 22:13:54.286221887 +0200
@@ -74,6 +74,15 @@
echo "$(LVM_SUPPRESS_FD_WARNINGS=1 log_output lvs --noheadings 
--separator : -o vg_name,lv_name |
sed 
"s|-|--|g;s|^[[:space:]]*\(.*\):\(.*\)$|/dev/mapper/\1-\2|")"
fi
+
+   # Also detect OSes on LUKS encrypted volumes that are currently unlocked
+   if type cryptsetup >/dev/null 2>&1; then
+   for device in $(ls /dev/mapper); do
+   if [ "$(cryptsetup status /dev/mapper/$device | grep LUKS)" != 
"" ]; then
+   echo "/dev/mapper/$device"
+   fi
+   done
+   fi
  }
  
  parse_proc_swaps () {







Re: os-prober and LUKS

2025-12-27 Thread Rolf Reintjes

Hello,

Am 27.12.2025 um 09:28 schrieb Josef Wolf:

Hello,

I am not sure where to discuss these things, since I can't find the original
repository of os-prober.

While playing around with full-disk-encryption, I stumbled over two problems.

First problem is, that IMHO, the test for separate boot partition seems to be
inversed. Please check/comment this patch:


I think the original code is correct.
If the path is not found in the mounted ones it means: The boot-files 
are direct on the main partition or the separat boot partition is yet 
not being detected/mounted.


Rolf



--- /usr/bin/linux-boot-prober-orig 2024-06-22 01:28:39.158074714 +0200
+++ /usr/bin/linux-boot-prober  2024-06-22 01:27:42.877687702 +0200
@@ -35,7 +35,7 @@
mpoint="$(unescape_mount "$mpoint")"
if [ "$mpoint" != "/target/boot" ] && [ "$mpoint" != "/target" ] && [ "$mpoint" 
!= "/" ]; then
type=$(grep "^$mapped " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d 
" " -f 3)
-   if ! grep -q " $mpoint/boot " "$OS_PROBER_TMP/mounted-map"; then
+   if grep -q " $mpoint/boot " "$OS_PROBER_TMP/mounted-map"; then
linux_mount_boot "$partition" "$mpoint"
bootpart="${mountboot%% *}"
bootmounted="${mountboot#* }"


Second is a missing feature. OS on LUKS volumes wont be checked at all, even
if the partition is currently unlocked. Please check/comment on this patch:


--- /usr/bin/os-prober-orig 2021-07-11 04:43:50.0 +0200
+++ /usr/bin/os-prober  2024-06-21 22:13:54.286221887 +0200
@@ -74,6 +74,15 @@
echo "$(LVM_SUPPRESS_FD_WARNINGS=1 log_output lvs --noheadings 
--separator : -o vg_name,lv_name |
sed 
"s|-|--|g;s|^[[:space:]]*\(.*\):\(.*\)$|/dev/mapper/\1-\2|")"
fi
+
+   # Also detect OSes on LUKS encrypted volumes that are currently unlocked
+   if type cryptsetup >/dev/null 2>&1; then
+   for device in $(ls /dev/mapper); do
+   if [ "$(cryptsetup status /dev/mapper/$device | grep LUKS)" != 
"" ]; then
+   echo "/dev/mapper/$device"
+   fi
+   done
+   fi
  }
  
  parse_proc_swaps () {