On Sun, 2021-02-21 at 13:23 +0100, Thomas Seeling wrote: > Hallo, > > > Do I understand correctly that the main question is "which grub.cfg > > will be used by grub at next reboot after running grub-install"? Or > > is > > there more? > > basically yes, but no ;). I want to know where I came from, not where > I'm going to. If I use "grub-install" I know the grub.cfg from the > current patition is being used at the next reboot. I want to know > which > grub.cfg was used to get to the currently running instance of my OS. >
I think the grub code is completely erased in memory once the kernel is loaded and launched, and grub is very careful not to write to disk, so communication to the running OS is not very easy. I would try to put something like this in each instance of grub.cfg: whereiam=/dev/sdxy save_env --file (hdu,v)/boot/myroot whereiam with x the drive letter and y the partition number where this instance of grub.cfg resides, and u and v a fixed drive number and partition number of a disk partition that you can mount to examine the content after booting. After booting, you can then mount /dev/sdu'v to a spare mountpoint (u' is the kernel drive letter corresponding to drive number u in grub notation), let's say you mount it to /tmp/tmp, and run "grub-editenv /tmp/tmp/myroot list" to get the content of "whereiam". Note that I have not tried, but I hope it points you into the right direction. Pierre -- http://lists.linuxfromscratch.org/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page Do not top post on this list. A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? http://en.wikipedia.org/wiki/Posting_style