Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22

Thread: Broken grub on installing the 2nd Leap on the same machine

  1. #11
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    11,187
    Blog Entries
    3

    Default Re: Broken grub on installing the 2nd Leap on the same machine

    Quote Originally Posted by moshpuke View Post
    I just tried to modify the 40_custom line for the boot uuid to direct it to the /boot partition in drive B
    Here's what should work (I think) in 40_custom:
    Code:
    set btrfs_relative_path="yes"
    search --fs-uuid --set=root *uuid of drive B part 2 which was mounted as /boot for leap B during its installation*
    set bootdir=(${root})/grub2
    configfile "${bootdir}/grub.cfg"
    I actually took this directly from what you posted as "/mnt/tmp/EFI/opensuse/grub.cfg", except:

    • I changed "prefix" to "bootdir" because "$prefix" has a special meaning to grub;
    • I changed "source" to "configfile"


    You can do just that copying and changing yourself, and it should get the right uuid there.

    Can you post the output from:
    Code:
    efibootmgr -v
    openSUSE Leap 15.0; KDE Plasma 5;

  2. #12

    Default Re: Broken grub on installing the 2nd Leap on the same machine

    Quote Originally Posted by nrickert View Post
    Here's what should work (I think) in 40_custom:
    Code:
    set btrfs_relative_path="yes"
    search --fs-uuid --set=root *uuid of drive B part 2 which was mounted as /boot for leap B during its installation*
    set bootdir=(${root})/grub2
    configfile "${bootdir}/grub.cfg"
    I actually took this directly from what you posted as "/mnt/tmp/EFI/opensuse/grub.cfg", except:

    • I changed "prefix" to "bootdir" because "$prefix" has a special meaning to grub;
    • I changed "source" to "configfile"


    You can do just that copying and changing yourself, and it should get the right uuid there.
    It's working! It's a bit strange but I actually like the result. Now leap B has its entry in the grub of leap A. When I choose to boot Leap B, I am welcomed by grub of Leap B. So I need to get through 2 grub pages to get to boot Leap B.

    Leap B will rarely be used so I'm totally fine with it. I just updated both leap A and leap B's grub (using Yast bootloader) and reboot them. Now it's OK if the machine boots from drive A, but if the machine boots from drive B it'll get to grub rescue page. So in bios I disabled drive B as a boot option.

    I just wonder if everything will not break and btrfs snapper can all work fine?

    If not I'm also fine to reinstall leap B since I have not set the working environment up much yet.

  3. #13
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    11,187
    Blog Entries
    3

    Default Re: Broken grub on installing the 2nd Leap on the same machine

    Quote Originally Posted by moshpuke View Post
    It's working! It's a bit strange but I actually like the result.
    Great. I'm glad to hear that.

    Now leap B has its entry in the grub of leap A. When I choose to boot Leap B, I am welcomed by grub of Leap B. So I need to get through 2 grub pages to get to boot Leap B.
    Yes, but this can be an advantage.

    If your Leap A has an entry to boot Leap B directly, without this extra menu page, then that can be out of date. When there is a kernel update in Leap B, then that direct entry will be wrong until you rebuild the boot menu on Leap A. But with this two page way of doing it, you always get the updated boot entry for Leap B.

    I just wonder if everything will not break and btrfs snapper can all work fine?
    I think the problem you might have there, is that btrfs snapper and rollback does not work well when you have a separate "/boot" partition. And that's because the grub boot menu is not part of the snapshot. The double layer of grub menu won't itself cause any problems.
    openSUSE Leap 15.0; KDE Plasma 5;

  4. #14

    Default Re: Broken grub on installing the 2nd Leap on the same machine

    Quote Originally Posted by nrickert View Post
    Great. I'm glad to hear that.

    I think the problem you might have there, is that btrfs snapper and rollback does not work well when you have a separate "/boot" partition. And that's because the grub boot menu is not part of the snapshot. The double layer of grub menu won't itself cause any problems.
    It seems having /boot partition in the lvm encrypted partition will cause one to submit the luks password twice to boot the system. No? My leap A also has /boot in a separated partition, and I did use snapper quite a few times when installing the nvidia driver, snapper did the rolling back well for me. Do you mean if one wants to roll back some content in /boot it would not work?

    Do you have suggestion on a better scheme if I want to re-install Leap B?

    Thanks again.

  5. #15
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    11,187
    Blog Entries
    3

    Default Re: Broken grub on installing the 2nd Leap on the same machine

    Quote Originally Posted by moshpuke View Post
    It seems having /boot partition in the lvm encrypted partition will cause one to submit the luks password twice to boot the system. No?
    Normally, yes. And that's what I do on the system I have setup that way.

    However, there is an alternative if you don't mind putting the encryption key in a file and in the "initrd". I have a VM setup that way. I have to give the encryption key for grub, but the rest of the boot uses the key from the file and from the initrd.

    Here's a recent post by somebody using that method:

    I think I add root key to wrong partition when trying to avoid typing password twice.

    My leap A also has /boot in a separated partition, and I did use snapper quite a few times when installing the nvidia driver, snapper did the rolling back well for me. Do you mean if one wants to roll back some content in /boot it would not work?
    Okay, so I guess rollback works the way you are doing it.

    As I understand it, the problem is that you cannot boot to a read-only snapshot. So if your system fails to boot, you cannot boot an older snapshot and then rollback to that.

    Note, however, that I'm not using "btrfs", so this is outside my experience. I did briefly use it, and I did boot to a snapshot (just for testing). But I never tried a rollback.
    openSUSE Leap 15.0; KDE Plasma 5;

  6. #16
    Join Date
    Sep 2012
    Posts
    4,783

    Default Re: Broken grub on installing the 2nd Leap on the same machine

    Quote Originally Posted by nrickert View Post
    As I understand it, the problem is that you cannot boot to a read-only snapshot.
    The problem is that content of /boot no more matches content of root. It means that if you revert to snapshot where your current kernel did not exist you will still boot into this kernel (it is present in /boot) but drivers for this kernel will be missing (they are locate in /lib/modules). So kernel will have rather limited functionality.

    When /boot is part of /, reverting to previous snapshot also reverts content of /boot (and /boot/grub2/grub.cfg) so you boot into kernels available in this snapshot.

    There is no automatic process to clean up "stale" kernels in /boot, although it is certainly possible to do manually once you are aware of it.

    P.S. sorry, I meant to answer your question earlier but it turned out more involved and I could not find time I'm still hoping to do it.

  7. #17

    Default Re: Broken grub on installing the 2nd Leap on the same machine

    Quote Originally Posted by arvidjaar View Post
    The problem is that content of /boot no more matches content of root. It means that if you revert to snapshot where your current kernel did not exist you will still boot into this kernel (it is present in /boot) but drivers for this kernel will be missing (they are locate in /lib/modules). So kernel will have rather limited functionality.

    When /boot is part of /, reverting to previous snapshot also reverts content of /boot (and /boot/grub2/grub.cfg) so you boot into kernels available in this snapshot.

    There is no automatic process to clean up "stale" kernels in /boot, although it is certainly possible to do manually once you are aware of it.
    Could you give a more detailed example like how it will fail because of this snapshot roll back failure? What are some pre-cautions I need or how do I fix it if it happens? I'll take note, I don't and don't plan to use snapshot roll back feature much though. Just in case a system failure I hope to get to the system that's all.

  8. #18
    Join Date
    Sep 2012
    Posts
    4,783

    Default Re: Broken grub on installing the 2nd Leap on the same machine

    Quote Originally Posted by nrickert View Post
    Thanks, though I'm not quite sure what "match" means here.
    btrfs_relative_path changes how grub interprets pathnames on btrfs. Normally they are assumed to be absolute pathnames (i.e. relative to root). If btrfs_relative_path is set, grub interprets then as relative to the default subvolume. If pathnames used in grub configuration file (grub.cfg in the first place) are created assuming one value of btrfs_relative_path but during execution grub is using different value, it either does not find files or finds wrong files.

    Normally user space tools (grub-install, grub-mkconfig) read value of SUSE_BTRFS_SNAPSHOT_BOOTING in /etc/default/grub; if it is "true", they both generate paths relative to default subvlume and make sure btrfs_relative_path is set during execution.

    Now when you read grub configuration created under different system value of SUSE_BTRFS_SNAPSHOT_BOOTING in this system may be different; that what I meant under "match".

    After looking at it once more - openSUSE installation always sets SUSE_BTRFS_SNAPSHOT_BOOTING=true, even if snapshots were explicitly disabled during installation. So it should be relatively safe to always set btrfs_relative_path either.

  9. #19
    Join Date
    Sep 2012
    Posts
    4,783

    Default Re: Broken grub on installing the 2nd Leap on the same machine

    Quote Originally Posted by moshpuke View Post
    Could you give a more detailed example like how it will fail because of this snapshot roll back failure?
    You installed kernel version 1.2.3. Now you have /boot/vmlinuz-1.2.3 and /boot/initrd-1.2.3 and /boot/grub2/grub.cfg that contains reference to /boot/vmlinuz-1.2.3 as default kernel. You also have /lib/modules/1.2.3 directory that contains most of kernel modules (drivers) for this kernel.

    Now you revert to snapshot created before this kernel was installed. You still have /boot/vmlinuz-1.2.3 and reference to it in grub.cfg (because /boot is not part of snapshot) but you no more have /lib/modules/1.2.3 directory. So you will be able to load this kernel, probably mount root (drivers for it are in initrd) but that basically all - it is very unlikely you will be able to do anything useful (even drivers for your network won't be present). In the worst case if snapshot is sufficiently old none of kernels in /boot will have matching /lib/modules sub-directory and you won't be able to boot at all.

  10. #20

    Default Re: Broken grub on installing the 2nd Leap on the same machine

    Quote Originally Posted by arvidjaar View Post
    You installed kernel version 1.2.3. Now you have /boot/vmlinuz-1.2.3 and /boot/initrd-1.2.3 and /boot/grub2/grub.cfg that contains reference to /boot/vmlinuz-1.2.3 as default kernel. You also have /lib/modules/1.2.3 directory that contains most of kernel modules (drivers) for this kernel.

    Now you revert to snapshot created before this kernel was installed. You still have /boot/vmlinuz-1.2.3 and reference to it in grub.cfg (because /boot is not part of snapshot) but you no more have /lib/modules/1.2.3 directory. So you will be able to load this kernel, probably mount root (drivers for it are in initrd) but that basically all - it is very unlikely you will be able to do anything useful (even drivers for your network won't be present). In the worst case if snapshot is sufficiently old none of kernels in /boot will have matching /lib/modules sub-directory and you won't be able to boot at all.
    Thank you. I see. So I guess I'll try keeping a few more kernels just in case following this guide: https://en.opensuse.org/SDB:Keep_mul...ernel_versions

    Say if one day I need to roll back with snapper (that's to use an older kernel), I'll be able to choose to boot to an older kernel in grub right? When you say I won't be able to boot, you didn't mean grub wouldn't appear either but that I just wouldn't be able to boot the latest kernel, right?

Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •