grub2-mkconfig and chroot

need to run a failing system grub2-mkconfig I tried chrooted system

mount / dev/sda2 / mnt

for i in / dev / dev / pts / proc / sys / run, to mount-B $ i / mnt / $ i; done

chroot / mnt

grub2-mkconfig-o / boot/grub2/grub.cfg

But i end up with a message

ERROR: opening path / mounts / instsys / sys / block

ERROR: failed to discover devices

No volume group detect

Maybe you missed some mount options for some directories.

mount -t proc none
mount --rbind /sys
mount --rbind /dev

The Gentoo doc is helpful in that case:
Gentoo Linux Documentation – Installing the Gentoo Base System

I’ve written a while ago a short and simple script for chrooting. Maybe it is useful for you. (Syntax is “chroot.sh sdax”)

Kleines Script für Chroot :: kanotix.com :: GNU Linux Live system based on Debian, optimized for HD-install and high performance