dimanche 1 février 2015

How to generate grub.cfg for different disk?


I have 2 disks:

1-st disk contains base operating system (/dev/sda with many partitions and OSes)

2-nd disc should be setup (/dev/sdb1=/boot,/dev/sdb2=/)


I have grub2 package installed in the base operating system. I want to create grub.config file for the operating systems on the second disk (without installing grub2 package in chroot on second disk, because this disk is for different architecture. I just want to regenerate config)


if I use



mkdir -p /mnt/gentoo
mount /dev/sdb2 /mnt/gentoo
mount /dev/sdb1 /mnt/gentoo/boot
grub-mkconfig -o /mnt/gentoo/boot/grub/grub.cfg


then there is no way to specify /dev/sdb as a base disk for enumerating installed OSes for grub-mkconfig


If disk /dev/sda contains N partitions, then grub-mkconfig creates ~ N * number_of_kernels menu entries. But I want make it creating entries for partitions of disk /dev/sdb (which have one partition /dev/sdb2 with one installed OS).


I also tried grub-customizer utility, because it have disk selection in parameters dialog. But looks like grub-customizer uses all utilities and files which are relative to the choosen disk, and I don't have grub2 on /dev/sdb installed (see note above about different architecture)


Someone told me that it is possible to do this by temporary correcting fstab of base system, but I doubt this will help.


So, how to generate grub.conf for different disk? (without writing it by hands with texteditor)


UPD: feature request - http://ift.tt/15N34GA



Aucun commentaire:

Enregistrer un commentaire