Announcement

Collapse
No announcement yet.

REVISITING - More BTRFS fun Multibooting to subvolumes - FIXING GRUB

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

  • steve7233
    replied
    I have a better computer now, so I guess I can quit trying to figure this out. I'll just assume it didn't work because the laptop was so old the normal procedures wouldn't work. I'll just use the hyperviser on this better computer. That should be more successful than messing with just a software solution.

    Leave a comment:


  • oshunluvr
    replied
    Also, notice the first line in my grub.cfg the default boot is:

    set default='KDE Neon'

    You'll want to put the name of your menu item you want to default to or the number in the list.

    ***ALSO*** You'll need to copy the Windows stanzas from your current grub.cfg and make sure they're in your custom grub.cfg. I forgot about that since I don't use windows.

    Leave a comment:


  • oshunluvr
    replied
    Which directory structure must be created on this partition? /boot/grub?
    My grub partition contains the contents of /boot/grub in the folder structure /boot/grub. All the Linux stuff under /boot is not there - just the folder structure and files of /boot/grub/*
    So in your case, format /dev/sda6 (i recommend ext2) and mount it (I use /mnt/grub). Copy won't make the target folders for you so:

    Code:
    sudo mkfs.ext2 /dev/sda6
    sudo mount /dev/sda6 /mnt/grub
    sudo mkdir /mnt/grub/boot
    sudo mkdir /mnt/grub/boot/grub
    sudo cp -R /boot/grub/* /mnt/grub/boot/grub/
    will do what you need for the file copy.

    The next question is what content must be maintained in grub.cfg?
    I initially copied my grub.cfg from my install, deleted everything after ### END /etc/grub.d/05_debian_theme ###, and then added my custom menu stanzas. Here's my entire /mnt/grub/boot/grub/grub.cfg file:
    Code:
    [FONT=monospace][COLOR=#54FF54][B]stuart@office[/B][/COLOR][COLOR=#000000]:[/COLOR][COLOR=#5454FF][B]~/Documents[/B][/COLOR][COLOR=#000000]$ cat /mnt/grub/boot/grub/grub.cfg[/COLOR]
    #
    # Custom grub config
    #
    set default='KDE Neon'
    
    if [ x"${feature_menuentry_id}" = xy ]; then
      menuentry_id_option="--id"
    else
      menuentry_id_option=""
    fi
    
    export menuentry_id_option
    
    if [ "${prev_saved_entry}" ]; then
      set saved_entry="${prev_saved_entry}"
      save_env saved_entry
      set prev_saved_entry=
      save_env prev_saved_entry
      set boot_once=true
    fi
    
    function savedefault {
      if [ -z "${boot_once}" ]; then
        saved_entry="${chosen}"
        save_env saved_entry
      fi
    }
    function recordfail {
      set recordfail=0
    
    }
    function load_video {
      if [ x$feature_all_video_module = xy ]; then
        insmod all_video
      else
        insmod efi_gop
        insmod efi_uga
        insmod ieee1275_fb
        insmod vbe
        insmod vga
        insmod video_bochs
        insmod video_cirrus
      fi
    }
    
    insmod part_gpt
    insmod ext2
    search --no-floppy --fs-uuid --set=root 4bd4447b-48df-43d8-9781-d444d68ce462
    font="/boot/grub/fonts/unicode.pf2"
    
    if loadfont $font ; then
      set gfxmode=3840x1600
      load_video
      insmod gfxterm
      set locale_dir=$prefix/locale
      set lang=en_US
      insmod gettext
    fi
    terminal_output gfxterm
    if [ "${recordfail}" = 1 ] ; then
      set timeout=30
    else
      if [ x$feature_timeout_style = xy ] ; then
        set timeout_style=menu
        set timeout=3
      # Fallback normal timeout code in case the timeout_style feature is
      # unavailable.
      else
        set timeout=3
      fi
    fi
    
    ### BEGIN /etc/grub.d/05_debian_theme ###
    
    set menu_color_normal=white/black
    set menu_color_highlight=black/light-gray
    #set_background_image /@KDEneon/usr/share/wallpapers/neonbykde2.jpg";
    insmod jpeg
    if background_image background1.jpg; then
      true
    else
    set menu_color_normal=white/black
    set menu_color_highlight=black/light-gray
    fi
    
    ### END /etc/grub.d/05_debian_theme ###
    
    ### BEGIN Custom menu ###
    menuentry 'KDE Neon' {
        insmod part_gpt
        insmod btrfs
        search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8
        configfile /@KDEneon/boot/grub/grub.cfg
    }
    menuentry 'KDE Neon - new' {
        insmod part_gpt
        insmod btrfs
        search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8
        configfile /@KDEneon_previous/boot/grub/grub.cfg
    }
    menuentry 'Kubuntu 16.04' {
        insmod part_gpt
        insmod btrfs
        search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8
        configfile /@Kubuntu_16_04/boot/grub/grub.cfg
    }
    menuentry 'Ubuntu 16.04' {
        insmod part_gpt
        insmod btrfs
        search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8
        configfile /@Ubuntu_16_04/boot/grub/grub.cfg
    }
    menuentry 'Manjaro free' {
        insmod part_gpt
        insmod btrfs
        search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8
        configfile /@Manjaro_free/boot/grub/grub.cfg
    }
    menuentry 'Manjaro nonfree' {
        insmod part_gpt
        insmod btrfs
        search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8
        configfile /@Manjaro_nonfree/boot/grub/grub.cfg
    }
    menuentry 'Memory test (memtest86+)' {
        insmod part_gpt
        insmod ext2
        search --no-floppy --fs-uuid --set=root 4bd4447b-48df-43d8-9781-d444d68ce462
        knetbsd /boot/memtest86+.elf
    }
    menuentry 'Memory test (memtest86+, serial console 115200)' {
        insmod part_gpt
        insmod ext2
        search --no-floppy --fs-uuid --set=root 4bd4447b-48df-43d8-9781-d444d68ce462
        linux16 /boot/memtest86+.bin console=ttyS0,115200n8
    }
    menuentry 'KDEneon ISO' {
        set isofile="/neon-useredition-20170608-2351-amd64.iso"
        loopback loop (hd0,2)$isofile
        linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
        initrd (loop)/casper/initrd.lz
    }
    ### END Custom menu###[/FONT]
    Then I install Grub with the --boot-directory option to the Grub partition.
    How should I do this?
    Code:
    grub-install --boot-directory /dev/sda6
    Or must I mount the Grub partition first and then run grub-install?
    Yes, you must mount the grub partition (actually /boot must be mounted or in the mounted location) somewhere then install grub using grub-install. This is per the normal grub repair methods. So assuming you mounted /dev/sda6 to /mnt/grub, you would do:
    Code:
    sudo grub-install --boot-directory=/mnt/grub/boot /dev/sda
    This will copy the needed info from /mnt/boot/grub/boot/grub to the boot area of sda6. Later, if grub gets an upgrade, run these commands again to upgrade your grub.

    ***NOTE*** ALWAYS a good idea to have a bootable USB stick at hand when messing with grub - just in case!
    Last edited by oshunluvr; Nov 16, 2017, 04:46 PM.

    Leave a comment:


  • Guest
    Guest replied
    THX for your detailed reply. However this raised more uncertaincies to me.

    Let's step back and start from beginning. Typically I boot a Live CD, e.g. SystemRescueCD, and chroot into my main Linux Distro Sparky; this offers all options for system maintenance.

    This is my current partition table:
    Code:
     Disk /dev/sda: 111.8 GiB, 120034123776 bytes, 234441648 sectorsUnits: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x1b5712ca
    
    Device     Boot     Start       End   Sectors  Size Id Type
    /dev/sda1  *         2048   2459647   2457600  1.2G  7 HPFS/NTFS/exFAT
    /dev/sda2         2459648 181531830 179072183 85.4G  7 HPFS/NTFS/exFAT
    /dev/sda3       181532670 234440703  52908034 25.2G  5 Extended
    /dev/sda5       181534720 225574911  44040192   21G 83 Linux
    /dev/sda6       225576960 225822719    245760  120M 83 Linux
    /dev/sda7       225824768 234440703   8615936  4.1G 82 Linux swap / Solaris
    This is the typical layout when running multiboot Windows + Linux on a single disk.
    /dev/sda1 SYSTEM
    /dev/sda2 Windows10
    /dev/sda5 BTRFS (with 2 distros / 4 subvolumes)
    /dev/sda6 Grub
    /dev/sda7 Swap

    To begin with the setup of Grub partition.
    Which directory structure must be created on this partition? /boot/grub?
    Or only /grub?
    Or only the files/directories
    Code:
     total 2.4Mdrwxr-xr-x 5 root root 1.0K Nov 16 20:51 .
    drwxr-xr-x 3 root root 1.0K Nov 16 20:14 ..
    -rw-r--r-- 1 root root  142 May 27  2013 device.map
    drwxr-xr-x 2 root root 1.0K Mar 14  2014 fonts
    -rw-r--r-- 1 root root 4.4K Nov 16 20:49 grub.cfg
    -rw-r--r-- 1 root root 1.0K May 27  2013 grubenv
    drwxr-xr-x 2 root root 6.0K Nov 16 00:49 i386-pc
    drwxr-xr-x 2 root root 1.0K Nov 16 00:49 locale
    -rw-r--r-- 1 root root 2.3M Jul 13 19:29 unicode.pf2
    The next question is what content must be maintained in grub.cfg?
    All section, e.g.
    Code:
    ### BEGIN /etc/grub.d/00_header ###
    (...)
    ### BEGIN /etc/grub.d/05_debian_theme ###
    (...)
    ### BEGIN /etc/grub.d/41_custom ###if [ -f  ${config_directory}/custom.cfg ]; then
    source ${config_directory}/custom.cfg
    elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
    source $prefix/custom.cfg;
    fi
    ### END /etc/grub.d/41_custom ###
    or only the customized section
    Code:
     ### BEGIN Custom menu ###menuentry 'Windows 10 (auf /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-E00486200485FA34' {
          insmod part_msdos
          insmod ntfs
          set root='hd0,msdos1'
          if [ x$feature_platform_search_hint = xy ]; then
            search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  E00486200485FA34
          else
            search --no-floppy --fs-uuid --set=root E00486200485FA34
          fi
          parttool ${root} hidden-
          drivemap -s (hd0) ${root}
          chainloader +1
    }
          fi
          parttool ${root} hidden-
          chainloader +1
    }
    menuentry 'Sparky Linux' {
     insmod part_gpt
     insmod btrfs
     search --no-floppy --fs-uuid --set=root cfb23b5f-d806-422f-aa10-b010a990cec3
     configfile /@sparky/boot/grub/grub.cfg
    }
    menuentry 'Kali Linux' {
     insmod part_gpt
     insmod btrfs
     search --no-floppy --fs-uuid --set=root cfb23b5f-d806-422f-aa10-b010a990cec3
     configfile /@kali/boot/grub/grub.cfg
    }
    ### END Custom menu###
    Then I install Grub with the --boot-directory option to the Grub partition.
    How should I do this?
    Code:
    grub-install --boot-directory /dev/sda6
    Or must I mount the Grub partition first and then run grub-install?
    Code:
    mount /dev/sda6 /mnt
    grub-install --boot-directory /mnt
    THX

    Leave a comment:


  • oshunluvr
    replied
    Hey, glad you're interested in this. It works great for me. grub uses about 9MB of a file system to hold it's files so you don't need much room. I made my grub boot partitions 512MB just so I could have enough room for background images or extra fonts. In your case, I assume you have no free space available on your drive.

    Is your first partition labeled SYSTEM is a Windows partition?
    Are you using grub to boot now or the Windows boot loader? - I assume you're using GRUB.
    Is Linux (Kubuntu) installed to sda5 - the btrfs partition?

    The first thing you need to do is to free up a little space for the grub partition. Since you still have one primary partition available, I suggest you shrink the Windows 10 partition 128-512MB using a Windows tool and reboot into Windows a couple times to insure it works. Then use the free space to make a new primary partition to hold the grub boot files.

    To answer your questions:

    1. Is it correct that the bootable grub partition is not mounted in any Linux installation?
    Not by default. I have it in my fstab with the "noauto" option so I can more easily mount it when I need to edit grub.cfg

    2. What do you mean with "Whenever I install a distro, I tell it to boot from sdc, but my boot drive is sda [...]"? Is sdc your BTRFS partition/disk?
    No, sdc is another disk (currently 4 on my system) that I do't normally boot from.

    3. What should I tell the installer to boot from as I have only one disk?

    In order to get all the working files and a using grub.cfg for each distro you have installed, you need to let the installer "install" grub but you don't want it over-riding your dedicated grub install. To solve this, I just tell the installer to use sdc as the boot disk, even though I never boot from it. That way grub runs it's full install and creates all it files but doesn't disturb the grub I actually boot from. In a single disk system, you can usually tell the installer to install grub to a partition instead of the disk. This has the same effect.

    Some installers will allow you to install without installing grub at all, but then a grub.cfg isn't created os you have to manually create the grub.cfg entry, which can be a bit tricky compared to just using the grub.cfg automatically created by each install within itself.

    In the event you run into an installer that requires you to install grub to sda, you would have to manually restore your preferred grub boot by re-installing grub with the --boot-directory option pointed at your mounted grub partition. However, this is also the method you would use to upgrade grub to a newer version is one becomes available - simply mount the grub partition, run grub-install with the -boot-directory option and grub is ungraded.

    The amount of manual editing of grub.cfg you will have to do will depend on how you work and how much you change your setup. In my case, I rename my btrfs subvolumes to the name of the installation distro so I can keep track of which is which. This is what my btrfs file system looks like at the root level:
    Code:
    [FONT=monospace][COLOR=#54FF54][B]stuart@office[/B][/COLOR][COLOR=#000000]:[/COLOR][COLOR=#5454FF][B]~[/B][/COLOR][COLOR=#000000]$ ll /subvol/[/COLOR]
    total 4
    drwxr-xr-x 1 root root 600 Nov 16 03:00 [COLOR=#5454FF][B].[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root 252 Nov  9 14:53 [COLOR=#5454FF][B]..[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root 252 Nov  9 14:53 [COLOR=#5454FF][B]@KDEneon[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root 252 Nov 14 02:00 [COLOR=#5454FF][B]@KDEneon_171114[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root 252 Nov 15 02:00 [COLOR=#5454FF][B]@KDEneon_171115[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root 252 Nov 16 02:00 [COLOR=#5454FF][B]@KDEneon_171116[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root  48 Sep  6 16:46 [COLOR=#5454FF][B]@KDEneon_home[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root  48 Nov 14 03:00 [COLOR=#5454FF][B]@KDEneon_home_171114[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root  48 Nov 15 03:00 [COLOR=#5454FF][B]@KDEneon_home_171115[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root  48 Nov 16 03:00 [COLOR=#5454FF][B]@KDEneon_home_171116[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root 196 Jun 13 16:49 [COLOR=#5454FF][B]@KDEneon_new[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root  12 Jun 13 16:41 [COLOR=#5454FF][B]@KDEneon_new_home[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root 286 Nov  8 14:59 [COLOR=#5454FF][B]@KDEneon_save[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root 262 Dec 13  2016 [COLOR=#5454FF][B]@Kubuntu_16_04[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root  32 Dec 22  2016 [COLOR=#5454FF][B]@Kubuntu_16_04_home[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root 282 Jun 27 09:31 [COLOR=#5454FF][B]@Manjaro_free[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root  12 Jun 11 08:11 [COLOR=#5454FF][B]@Manjaro_free_home[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root 216 Nov  9 14:06 [COLOR=#5454FF][B]@Manjaro_nonfree[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root  12 Jun 10 11:49 [COLOR=#5454FF][B]@Manjaro_nonfree_home[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root 234 Jun 13 17:21 [COLOR=#5454FF][B]@Ubuntu_16_04[/B][/COLOR][COLOR=#000000]/[/COLOR]
    drwxr-xr-x 1 root root  12 Jun 13 16:14 [COLOR=#5454FF][B]@Ubuntu_16_04_home[/B][/COLOR][COLOR=#000000]/[/COLOR]
    [/FONT]
    so I have a stanza in my grub.cfg to boot to each of the above installs. It looks like this:
    Code:
    [FONT=monospace][COLOR=#000000]### END /etc/grub.d/05_debian_theme ###[/COLOR]
    
    ### BEGIN Custom menu ###
    menuentry 'KDE Neon' {
        insmod part_gpt
        insmod btrfs
        search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8
        configfile /@KDEneon/boot/grub/grub.cfg
    }
    menuentry 'KDE Neon - new' {
        insmod part_gpt
        insmod btrfs
        search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8
        configfile /@KDEneon_previous/boot/grub/grub.cfg
    }
    menuentry 'Kubuntu 16.04' {
        insmod part_gpt
        insmod btrfs
        search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8
        configfile /@Kubuntu_16_04/boot/grub/grub.cfg
    }
    menuentry 'Ubuntu 16.04' {
        insmod part_gpt
        insmod btrfs
        search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8
        configfile /@Ubuntu_16_04/boot/grub/grub.cfg
    }
    menuentry 'Manjaro free' {
        insmod part_gpt
        insmod btrfs
        search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8
        configfile /@Manjaro_free/boot/grub/grub.cfg
    }
    menuentry 'Manjaro nonfree' {
        insmod part_gpt
        insmod btrfs
        search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8
        configfile /@Manjaro_nonfree/boot/grub/grub.cfg
    }
    menuentry 'Memory test (memtest86+)' {
        insmod part_gpt
        insmod ext2
        search --no-floppy --fs-uuid --set=root 4bd4447b-48df-43d8-9781-d444d68ce462
        knetbsd /boot/memtest86+.elf
    }
    menuentry 'Memory test (memtest86+, serial console 115200)' {
        insmod part_gpt
        insmod ext2
        search --no-floppy --fs-uuid --set=root 4bd4447b-48df-43d8-9781-d444d68ce462
        linux16 /boot/memtest86+.bin console=ttyS0,115200n8
    }
    menuentry 'KDEneon ISO' {
        set isofile="/neon-useredition-20170608-2351-amd64.iso"
        loopback loop (hd0,2)$isofile
        linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
        initrd (loop)/casper/initrd.lz
    }
    ### END Custom menu###
    [/FONT]
    Note that all the install have the same UUID except memtest - which I installed to my grub partition - and the bootable ISO in the last stanza. Anytime I do a new install, I go in and edit this file. However, if you where just interested in a dual boot - like "main" and "backup" - as your installs, you wouldn't ever have to edit this file, just change the subvolume names to match the grub.cfg stanzas. You could even have many more and just number them like "@1, @2, @3, @4" etc.
    Last edited by oshunluvr; Nov 16, 2017, 12:16 PM.

    Leave a comment:


  • Guest
    Guest replied
    Originally posted by oshunluvr View Post
    Solution 3:
    Make a bootable grub partition (another multi-disk solution):
    This is my method but it's not the easiest to initially set up. I have more than one drive on my system, so I created and mounted a 128MB EXT2 partition on one of them (actually two of them so I have a boot-able backup drive). I copied /boot/grub from one install to this partition. Then ran grub-install with the --root-directory option pointing at the grub partition. Whenever I install a distro, I tell it to boot from sdc, but my boot drive is sda (sdb as backup) so my grub is never messed with.

    Now regardless of deleting installs, I can always boot. I manually edit the grub.cfg on this bootable partition and add and subtract installs as I do them - using the same menuentry as you would in 40_custom. Here's the tail (the part after the header info) of my grub.cfg from that partition:
    Code:
    [FONT=monospace][COLOR=#000000]### BEGIN Custom menu ### [/COLOR]
    menuentry 'KDE Neon' { 
      insmod part_gpt 
      insmod btrfs 
      search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 
      configfile /@KDEneon/boot/grub/grub.cfg 
    } 
    menuentry 'KDE Neon - new' { 
      insmod part_gpt 
      insmod btrfs 
      search --no-floppy --fs-uuid --set=root fcc94981-05e4-4846-92e7-87bf9885178d 
      configfile /@KDEneon_new/boot/grub/grub.cfg 
    } 
    menuentry 'Kubuntu 16.04' { 
      insmod part_gpt 
      insmod btrfs 
      search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 
      configfile /@Kubuntu_16_04/boot/grub/grub.cfg 
    } 
    menuentry 'Ubuntu 16.04' { 
      insmod part_gpt 
      insmod btrfs 
      search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 
      configfile /@Ubuntu_16_04/boot/grub/grub.cfg 
    } 
    menuentry 'Manjaro free' { 
      insmod part_gpt 
      insmod btrfs 
      search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 
      configfile /@Manjaro_free/boot/grub/grub.cfg 
    } 
    menuentry 'Manjaro nonfree' { 
      insmod part_gpt 
      insmod btrfs 
      search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8 
      configfile /@Manjaro_nonfree/boot/grub/grub.cfg 
    } 
    menuentry 'Memory test (memtest86+)' { 
      insmod part_gpt 
      insmod ext2 
      search --no-floppy --fs-uuid --set=root 4bd4447b-48df-43d8-9781-d444d68ce462 
      knetbsd /boot/memtest86+.elf 
    } 
    menuentry 'Memory test (memtest86+, serial console 115200)' { 
      insmod part_gpt 
      insmod ext2 
      search --no-floppy --fs-uuid --set=root 4bd4447b-48df-43d8-9781-d444d68ce462 
      linux16 /boot/memtest86+.bin console=ttyS0,115200n8 
    } 
    menuentry 'KDEneon ISO' { 
      set isofile="/neon-useredition-20170608-2351-amd64.iso" 
      loopback loop (hd0,2)$isofile 
      linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject 
      initrd (loop)/casper/initrd.lz 
    } 
    ### END Custom menu###
    
    [/FONT]
    You can see by the UUID that all my installs reside on the same UUID. I also moved MEMTEST to the grub partition so it's not installed 10 times and the last stanza allowed me to boot from an ISO without burning it to a USB or DVD first.

    [#]btrfs[/#] [#]grub[/#] [#]multiboot[/#]
    I would prefer to go with solution 3.
    In my case, the partitions are as follows:
    /dev/sda1 SYSTEM
    /dev/sda2 Windows10
    /dev/sda5 btrfs
    /dev/sda6 swap

    Partitions sda1 / sda2 are primary partitions, and sda5 / sda6 are logical paritions.

    I want that booting partition is not modified after kernel upgrade of every single Linux installation in subvolumes.
    Therefore I need to add another partition for bootable grub.

    However I have the following questions:
    1. Is it correct that the bootable grub partition is not mounted in any Linux installation?
    2. What do you mean with "Whenever I install a distro, I tell it to boot from sdc, but my boot drive is sda [...]"? Is sdc your BTRFS partition/disk?
    3. What should I tell the installer to boot from as I have only one disk?

    THX

    Leave a comment:


  • steve7233
    replied
    Originally posted by Snowhog View Post
    Verify that the 40_custom file in /etc/grub.d is executable. If it isn’t, make it so and re-run update-grub.
    I already tried that. It behaves like it is trying to display but for some reason can't. Maybe the display needs to be redrawn when 40_custom executes? *Not sure if I am thinking along the right path here. I don't know Grub that well so maybe I am on the wrong path. At least I am trying to figure it out instead of just waiting for you guys. Maybe I need to add a console display command like vesa settings? Not doing it yet, just asking.

    Leave a comment:


  • Snowhog
    replied
    Verify that the 40_custom file in /etc/grub.d is executable. If it isn’t, make it so and re-run update-grub.

    Leave a comment:


  • steve7233
    replied
    I wonder if the menu is tying to display, but the monitor isn't being setup correctly such that the data never displays. If this is the the case then that would explain why it is taking longer to boot. Maybe it times out and defaults to lubuntu 17.04.

    Leave a comment:


  • steve7233
    replied
    I tried again and still no menu. It seems to be taking longer to boot so maybe that suggests something?

    Leave a comment:


  • oshunluvr
    replied
    Originally posted by steve7233 View Post
    I just grubpdate again and still the menu remains absent.
    Then either your grub isn't working right or 40_custom isn't executable. Other possibilities are the menu isn't set to be visible at all or that you're booting to grub from another install.

    There's no magic here;
    Here's the last 10 lines of my grub.cfg before editing 40_custom and running update-grub:
    stuart@office:~$ cat /boot/grub/grub.cfg |tail -10
    search --no-floppy --fs-uuid --set=root 8f0c1661-4e84-4512-b875-23bcfd5be1d8
    fi
    echo 'Loading Linux 4.8.0-58-generic ...'
    linux /@KDEneon/boot/vmlinuz-4.8.0-58-generic root=UUID=8f0c1661-4e84-4512-b875-23bcfd5be1d8 ro recovery nomodeset rootflags=subvol=@KDEneon
    echo 'Loading initial ramdisk ...'
    initrd /@KDEneon/boot/initrd.img-4.8.0-58-generic
    }
    }

    ### END /etc/grub.d/10_linux ###
    Here's my /etc/grub.d/40_custom:
    stuart@office:~$ cat /etc/grub.d/40_custom
    #!/bin/sh
    exec tail -n +3 $0
    # This file provides an easy way to add custom menu entries. Simply type the
    # menu entries you want to add after this comment. Be careful not to change
    # the 'exec tail' line above.
    menuentry 'THIS IS A TEST' {
    insmod part_gpt
    insmod btrfs
    search --no-floppy --fs-uuid --set=root 27a9a212-d177-4665-b6bc-bf304e8c1f3e
    configfile /@Kubuntu1704/boot/grub/grub.cfg
    }

    stuart@office:~$
    Here I am making it executable:
    stuart@office:~$ sudo chmod +x /etc/grub.d/40_custom
    stuart@office:~$ ll /etc/grub.d/40_custom
    -rwxr-xr-x 1 root root 407 Oct 23 13:11 /etc/grub.d/40_custom*
    Here I am running update-grub:
    stuart@office:~$ sudo update-grub
    Generating grub configuration file ...
    Found theme: /boot/grub/themes/breeze/theme.txt
    Found background image: /usr/share/wallpapers/neonbykde2.jpg
    Found linux image: /boot/vmlinuz-4.11.0-14-generic
    Found initrd image: /boot/initrd.img-4.11.0-14-generic
    Found linux image: /boot/vmlinuz-4.11.0-13-generic
    Found initrd image: /boot/initrd.img-4.11.0-13-generic
    Found linux image: /boot/vmlinuz-4.10.0-29-generic
    Found initrd image: /boot/initrd.img-4.10.0-29-generic
    Found linux image: /boot/vmlinuz-4.8.0-58-generic
    Found initrd image: /boot/initrd.img-4.8.0-58-generic
    done
    And here's the last 10 lines of grub.cfg now:
    stuart@office:~$ cat /boot/grub/grub.cfg |tail -10
    # menu entries you want to add after this comment. Be careful not to change
    # the 'exec tail' line above.
    menuentry 'THIS IS A TEST' {
    insmod part_gpt
    insmod btrfs
    search --no-floppy --fs-uuid --set=root 27a9a212-d177-4665-b6bc-bf304e8c1f3e
    configfile /@Kubuntu1704/boot/grub/grub.cfg
    }

    ### END /etc/grub.d/40_custom ###
    All worked here, so you either missed something or one of the above mentioned issues is in the way.

    I did notice in your post showing your 40_custom you are missing the last } but I assumed you just cut it accidentally out of your cut-n-paste. Otherwise, you'd have gotten an error message when running update-grub.

    I don't know what else to tell you, sorry.

    Leave a comment:


  • steve7233
    replied
    Originally posted by oshunluvr View Post
    I'm out of town, but in answer to the menu item not showing up in grub, did you update grub after editing 40_custom?
    I just grubpdate again and still the menu remains absent.

    Leave a comment:


  • oshunluvr
    replied
    I'm out of town, but in answer to the menu item not showing up in grub, did you update grub after editing 40_custom?

    Leave a comment:


  • steve7233
    replied
    At this rate I will have my computer replacement before I get this grub problem fixed.

    Leave a comment:


  • steve7233
    replied
    I wounder if the modifications that oshunluvr, told me to make might be wrong for my system. Of course I am not going to mess around trying to guess and risk hosing my system. I will just have wait for him or someone else that knows how to do this to respond.
    Last edited by steve7233; Oct 16, 2017, 02:49 PM. Reason: typo in the btrfs god's name. Lol.

    Leave a comment:

Working...
X