'Chrooted OS grub2-mkconfig / os-prober is identifying host OS - not the target OS

The project is to build a new boot grub2 boot entry. The OS is loaded and chrooted to.

Below is the commands to mount the target

mount /dev/sda2 /mnt/root/boot
mount /dev/ssd_2tb_1/home /mnt/root/home
mount /dev/ssd_2tb_1/var /mnt/root/var
mount --bind  /proc  /mnt/root/proc
mount --bind  /sys   /mnt/root/sys
mount --bind  /dev   /mnt/root/dev
mount -o bind /dev   /mnt/root/dev/pts
mount -o bind /run   /mnt/root/run
chroot /mnt/root

--- this works successfully. The target OS is accessed properly except for the os-prober command

df
Filesystem                 1K-blocks      Used Available Use% Mounted on
/dev/mapper/ssd_2tb_1-root  28637220  10952984  16199848  41% /
/dev/sda2                     736509    290436    403732  42% /boot
/dev/mapper/ssd_2tb_1-home 308587328 279016328  13825976  96% /home
/dev/mapper/ssd_2tb_1-var   16448380   2972412  12662672  20% /var
devtmpfs                        4096         0      4096   0% /dev
tmpfs                        3213596      1904   3211692   1% /run

/etc/default/grug.cfg has been edited to reflect the target OS

/etc/fstab has been updated to reflect the target OS

Except for the above non of the files in /boot have been changed. Is os-prober dependent on /boot ??

However grub2-mkconfig using os-prober identifies the host OS not the target OS. How can the mount configuration be changed such that os-prober will correctly identify the target OS?

It appears as though /proc/cmdline has the host OS. Is this where os-prober is getting the OS ? If so how can this be modified to reflect the target OS rather than the host?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source