Announcement

Collapse
No announcement yet.

[SOLVED] Need help setting up multi-boot with btrfs

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Schwarzer Kater
    replied
    Originally posted by oshunluvr View Post
    os_prober didn't work in the past with btrfs partitions other than the host partition because of the use of subvolumes prevented finding the kernel and initramfs files. This was identified as a bug quite awhile ago but I don't know if it was ever fixed.
    […]
    In e.g. openSUSE and Garuda it currently does work, in *Ubuntu and Debian it does not.

    As Debian- and *Ubuntu-based systems are two of my three primary systems I use a custom.cfg in /boot/grub to be able to boot from systems that I installed on btfrs partitions.
    Last edited by Schwarzer Kater; Jul 03, 2023, 06:50 AM.

    Leave a comment:


  • oshunluvr
    replied
    os_prober didn't work in the past with btrfs partitions other than the host partition because of the use of subvolumes prevented finding the kernel and initramfs files. This was identified as a bug quite awhile ago but I don't know if it was ever fixed.

    In my view you have a few choices:

    1. Leaving things as they are and:
    Add Kubuntu to /etc/grub.d/40_custom like this:
    Code:
    menuentry 'Kubuntu 22.04' --class kubuntu {
       insmod part_gpt
       insmod btrfs
       search --no-floppy --fs-uuid --set=root <UUID FROM SDA3 HERE>
       configfile /@/boot/grub/grub.cfg
    }​
    Obviously change the above if needed. For example, "@" is the default root subvolume so if you changed it in the Kubuntu install, you would need to change it here also. Also "insmod part_gpt" would need to be "insmode_mbr" if you're not using GPT (you should be IMO). Then make 40_custom executable and run update-grub. This should be maintenance free going forward as any time you do a kernel update to Kubuntu, it will update it's own grub.cfg. It won.t matter if Kali updated gr or not. This is also the easiest option to set up.

    Other options include:

    2. Moving the Kali subvolumes to SDA3 and booting from a single btrfs file system. This may require renaming subvolume(s).
    3. Creating a third install to just handle booting.

    The disadvantage to dual booting on a single disk is Kali currently "owns" grub. Thus if Kali becomes unbootable or you remove it, your entire system is not bootable. You could re-install grub from Kubuntu and flip the setyp but you're still in the same predicament of have a "one fail means all are failed" situation. This is why I use the third option.

    Both the 2nd and 3rd options are more work to set up, but have advantages like taking advantage of the shared partition space made possible by the use of btrfs subvolumes.
    ​​
    The 3rd option is the most unlikely to leave you with an unbootable computer and adds the advantage of one more bootable OS to "fix" one of the others if need be. I use Ubuntu Server as my "grub" OS with no desktop at all, just console access. I set up it's grub menu to default to my primary OS with a 3 second menu window to change to another if I want to. Once it's set up, I need only update grub on the boot OS when I add or delete an install. I also have set up the ability to boot directly to many different ISOs. This makes it super easy to install a new distro or just try one out in a live session on bare metal.

    Leave a comment:


  • TwoFistedJustice
    replied
    I've read Oshunluvr's posts on maintaining grub and multi-booting from a single btrfs partition. I played with it a bit in my skunky-funky kubuntu/kali install and ended up not being able to boot into either. So I wiped them and now I have one big btrfs partition with Kubuntu 22.04, alongside the original ESP and swap.

    The short-short version of the steps to begin multi-boot from a single partition as I grasped them are:

    1. Boot with live and rename @ and @home
    2. Edit fstab to match new names
    3. Edit /boot/grub/grub.cfg
    4. Edit 40_custom
    5. boot into system and run `update-grub`

    With a 40_custom entry of:

    Code:
    menuentry 'MENU_ENTRY' {
      insmod btrfs
      set root='(hd0,Kubuntu22)'
      configfile /boot/grub/grub.cfg
    }
    One thing I found was that I could not edit grub.cfg from a live-usb. Which leads me to think I should edit the file that explicitly states that I should not edit it as step 1 with live-booting being step 2.

    How am I doing?


    Leave a comment:


  • jlittle
    replied
    Assuming kali uses grub, and your system has booted into it.

    Firstly, does the /etc/default/grub have this line:
    Code:
    GRUB_DISABLE_OS_PROBER=false
    If not, or it is commented out, edit it so that it does, then run sudo update-grub.

    The update-grub used to run the OS prober by default, but that was deemed to be a security risk, so now for it to run the weird double negative is needed.

    However, with btrfs, I'm not sure the os-prober works.

    So, another approach is creating the file /boot/grub/custom.cfg on kali with the contents:
    Code:
    menuentry 'Kubuntu from custom'  {
        search --no-floppy --set=root --label kubuntu
        linux /@/boot/vmlinuz root=LABEL=kubuntu ro rootflags=subvol=@
        initrd /@/boot/initrd.img
    }
    Grub these days checks for custom.cfg at boot time.

    Now,
    Each distro on a its own single partition
    With btrfs this is not necessary; several distro installs can share one btrfs, and juggling free space by resizing partitions is obviated. A huge time saver. The different installs just have to use different subvolumes, with grub and /etc/fstab adjusted accordingly. IMO becoming up to speed with this approach is really good when problems occur; one can boot into snapshots to try things. At dist-upgrade time I usually have before and after bootable, and often keep an LTS going (that is, bootable and upgraded). Your install of kali suggests that you are the type of user that would benefit from this flexibility.

    Leave a comment:


  • otisklt
    replied
    There are some good mulit-boot btrfs/grub resources here: https://www.kubuntuforums.net/forum/...trfs-subvolume

    I would suggest trying a sudo update-grub command to see if it can pick up the Kubuntu and add it to the menu for you

    Leave a comment:


  • [SOLVED] Need help setting up multi-boot with btrfs

    [EDIT]

    The posts that lead directly to the solution in this thread are: [ 2, 4, 5, 22, 27 ]

    Synopsis:
    This clarifies oshunluvr's post on "
    More BTRFS fun: Multibooting to subvolumes on the same partition"

    It reconciles that post with booting from EFI ( original post is for MBR ) and shows how to configure grub for both distros.

    Note: my solution does not solve for problems arising from kernel updates. Oshunluvr's post on how to create a dedicated grub partition covers that. Mine is an intermediate solution which is easier in the short run but harder in the long run. Mine may help you understand grub a little better, which will make his more elegant solution easier to understand.

    [/EDIT]

    I've installed single boot distros many times. I tried to set up a dual-Linux boot system and what I ended up with is a 500gb drive with a 30gb Kali partition on sda4 without the ability to boot back into Kubuntu (that I could find). There are a lot of tutorials out there, most of which don't seem to really help.

    I'd like to set up my Thinkpad with at least two distros. My main would be Kubuntu 22.04 and then I want to have Kali as a second option.

    Some things I have noticed in the system as I have it now:
    • Partition manager (in Kali) shows Kubuntu has no mount point
    • Prior to installing Kali it was booting to grub from which I could run Kubuntu
    • After installing Kali /boot/grub/grub.cfg shows only Kali

    The parts I succeeded at:
    • created ESP on sda1
    • created swap on sda2 ( for hibernation )

    My criteria for success:
    • At least two distros
    • Each distro on a its own single partition
    • All partitions using btrfs
    • Each distro has its own home directory (not shared with other distros)
    • Each distro having a subvolume for @ and @home
    • Ability to boot to any installed distro from boot manager (grub or refind)

    What I need help with is the side by side installation of:
    • Kubunutu on sda3
    • Kali on sda4


    Partitions as currently set up:

    Click image for larger version  Name:	IMG_5821.jpg Views:	44 Size:	52.1 KB ID:	671910
    Last edited by Snowhog; Jul 18, 2023, 11:31 AM.

Users Viewing This Topic

Collapse

There are 0 users viewing this topic.

Working...
X