Thanks to @rtaft and @mook765 for helping.
I'm not very experiencing in grub internals, and actually I don't have much desire to read tons of documentation.
In my case I have to HDD:
- /dev/sda - Debian
- /dev/sdb - Ubuntu.
Both of these have their own copy of /boot/grub/grub.cfg.
Let's say I login to Debian now, it means all commands like
sudo grub-update sudo grub-set-default x
etc. will affect grub.cfg of Debian dist currently running.
Taking into account, that I don't know order of executing of these two versions of grub.cfg. I decided to change line with set default="Desired OS", in my case
set default="Debian GNU/Linux 9 (stretch) (on /dev/sda3)"
for BOTH these grub.cfg.
Summary:
- I changed
/boot/grub/grub.cfg
manually and set desired default.
- I mount second HDD (/dev/sdb -> ~/mnt_devsdb).
- I changed
~/mnt_devsdb/boot/grub/grub.cfg
manually and set desired default(the same as for p.1).
- reboot and .... voila! it works!
To boot Ubuntu I need to repeat all these steps and set proper default again.
/dev/sdb1
and view/boot/grub/grub.cfg
to see if it is pointing back to sda?sudo mkdir /media/ubuntu
andsudo mount /dev/sdb1 /media/ubuntu
, Then view/media/ubuntu/boot/grub/grub.cfg
and look at the lineset default
to see what it says, I think that's the setting to look at.