How add opensuse to grub.cfg?

Hallo:

I was using OpenSuse 42.1 installed in a partition with BTRFS.

I’ve installed Ubuntu 16.04 to try it and opensuse 41.1 menu entry has gone.

Tried using “grub-mkconfig -o file”. It finds OpenSuse 13.1, Ubuntu 16.04 an Windows 7, but it can’t find OpenSuse 42.1.

I’ve read that grub-mkconfig can’t search in BTRFS partitions.

Trying coping OpenSuse 42.1 entry in grub.cfg to grub.cfg from Ubuntu. It’s displayed in menu, but it can’t start.

¿How can I add OpenSuse to menu and start it?

Thanks.

It depends on various things.

I’ll assume that you are using legacy BIOS booting and have only one hard drive.

Here’s what I do in that case: I add some lines to the end of “/etc/grub.d/40_custom”


### Entry to boot grub1 from "/dev/sda8"
menuentry "Alternate grub/linux on /dev/sda8"  {
        set root=(hd0,8)
        chainloader +1
}
menuentry "configfile for linux on /dev/sda8" {
       configfile (hd0,8)/boot/grub2/grub.cfg
}

This adds two entries to my boot menu. Either one will boot the linux that I have installed in “/dev/sda8”. Change that for whatever partition you are using.

The first of those works because I set opensuse to boot from “/dev/sda8” (from the root partition). So it just chainloads that.

The second of those does not depend on how opensuse boots, just as long as it uses grub2. So it should work if opensuse was installed to boot from the MBR. To be honest, though, I have not tested that with “btrfs”. So I’m not sure if it will work in your case. But it’s worth a try.

You would have to add the appropriate lines to “/etc/grub.d/40_custom” on your Ubuntu system. And then regenerate the “grub.cfg” (usually with “grub-mkconfig”).

The other alternative would be to reinstall grub2 for opensuse, and then boot Ubuntu from the opensuse boot menu.

Finally I’ve found a way.

The problem was with the brfs partition. So:

  • I’ve copied the partition to a file (dd).
  • Formatted the partition with ext4.
  • Mounted image file (mount -loop) and copied to ext4 partition.
  • Edited fstab on ext4 partition to replace references to btrfs.
  • Started using a usb install OpenSuse 42.1 (in rescue mode).
  • Mounted partition (/mnt/os421 and mounted with (mount --bind /xxx /mnt/os421/xxx , xxx for dev, sys, proc).
  • chroot to /mnt/os421
  • Created new initrd with mkinitrd.
  • Created new grub config (mkgrub-config) and installed it (mkgrub-install).

I can’t detail the process because I can’t remember. But more or less, that where the steps.
Of course, there are some dangerous commands here so don’t use if you are not sure.

Regards