Announcement

Collapse
No announcement yet.

[BTRFS] [GRUB] Problem with GRUB recognizing my two installations

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

    [SOLVED] [BTRFS] [GRUB] Problem with GRUB recognizing my two installations

    Hello!

    First again thank you for helping me with a similar thread ( https://www.kubuntuforums.net/showth...oot-info-both& ), on forunatelly the help on that thread somehow doesnt work for the current problem i have, even though i thought it should. Let me explain my problem.

    I made three partitions (ok four is i also count swap area) on my hard drive. One is kde4 btrfs partition, one is plasma 5 btrfs partition and the rest is my data (disk) btrfs partition.

    sudo blkid reveals this:

    Code:
    fani@avatar:~$ sudo blkid
    [sudo] password for fani: 
    /dev/sda1: UUID="d2ad0990-78e3-464e-8ac9-1dc67be49963" TYPE="swap" 
    /dev/sda5: LABEL="plasma5" UUID="3af2cb3c-34d8-4f4e-94be-4e7138e331de" UUID_SUB="ee92358e-4e0d-4b63-994e-aa697f36c1b8" TYPE="btrfs" 
    /dev/sda6: LABEL="kde4" UUID="821f7ab0-4351-45f1-b870-1a4b33db1b5c" UUID_SUB="22361e2c-49cf-453e-ae0e-1b6cead244be" TYPE="btrfs" 
    /dev/sda7: LABEL="disk" UUID="da357d7a-0b07-4cf4-913b-bf401349c598" UUID_SUB="896321ca-6656-4e07-b6aa-21cdf31671f6" TYPE="btrfs"
    i wanted to do the same thing as i did with my previous disk partitions - and what the previous thread has helped me with, but this time i dont know why it doesnt work. First i installed kde4, and then plasma5. When i installed plasma5 i remembered i forgot to create already a menu entry in kde4, so (after i made them menu entry in plasma5 for kde4) i chrooted and ran grub-install /dev/sda in my plasma5 system and in the next reboot the grub menu came for kde4.... i went in the kde4 and it booted fine... then i restarted the system and tried to select the plasma 5 entry and the *same* kde4 menu reappeared alsmost instantly...if i selected "plasma5" multiple times, same thing happened. So i went to kde4 and i tried to chroot into plasma5 system and ran grub-install /dev/sda there, but the command had an error. After reboot, if i selected the Plasma5 menu entry the computer immediately rebooted this time. It means the behaviour is now different. But i dont know if the behaviour is now better or worse... the main thing is, i cannot boot back in the plasma 5.

    Here is how i chrooted in both systems:

    Code:
    fani@avatar:~$ sudo mount -o subvol=@ /dev/sda5 /media/fani/plasma5
    
    fani@avatar:~$ for i in dev/pts sys proc run; do sudo mount --bind /$i /media/fani/plasma5/$i; done
    
    fani@avatar:~$ sudo chroot /media/fani/plasma5
    
    root@avatar:/# sudo grub-install /dev/sda
    Installing for i386-pc platform.
    grub-install: napaka: failed to get canonical path of `/dev/sda5'.
    i also tried to do this (in chrooted plasma5):

    Code:
    fani@avatar:~$ sudo mount -o subvol=@ /dev/sda5 /media/fani/plasma5
    
    fani@avatar:~$ for i in dev/pts sys proc run; do sudo mount --bind /$i /media/fani/plasma5/$i; done
    
    fani@avatar:~$ sudo chroot /media/fani/plasma5
    
    root@avatar:/# sudo grub-mkconfig -o /boot/grub/grub.cfg
    /usr/sbin/grub-probe: napaka: failed to get canonical path of `/dev/sda5'.
    and

    Code:
    fani@avatar:~$ sudo mount -o subvol=@ /dev/sda5 /media/fani/plasma5
    
    fani@avatar:~$ for i in dev/pts sys proc run; do sudo mount --bind /$i /media/fani/plasma5/$i; done
    
    fani@avatar:~$ sudo chroot /media/fani/plasma5
    
    root@avatar:/# sudo grub-install --recheck --root-directory=/media/fani/plasma5 /dev/sda
    Installing for i386-pc platform.
    grub-install: napaka: failed to get canonical path of `/dev/sda5'.

    my "40_custom" in kde4 (/etc/grub.d/40_custom):

    Code:
    #!/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 'Plasma5' {
    insmod part_msdos
    insmod btrfs
    search --no-floppy --fs-uuid --set=root 3af2cb3c-34d8-4f4e-94be-4e7138e331de
    configfile /boot/grub/grub.cfg
    }
    my "40_custom" in plasma5 (/etc/grub.d/40_custom):

    Code:
    #!/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 'kde4' {
    insmod part_msdos
    insmod btrfs
    search --no-floppy --fs-uuid --set=root 821f7ab0-4351-45f1-b870-1a4b33db1b5c
    configfile /boot/grub/grub.cfg
    }
    my grub.cfg in kde4 (/boot/grub/grub.cfg):

    Code:
    #
    # DO NOT EDIT THIS FILE
    #
    # It is automatically generated by grub-mkconfig using templates
    # from /etc/grub.d and settings from /etc/default/grub
    #
    
    ### BEGIN /etc/grub.d/00_header ###
    if [ -s $prefix/grubenv ]; then
      set have_grubenv=true
      load_env
    fi
    if [ "${next_entry}" ] ; then
       set default="${next_entry}"
       set next_entry=
       save_env next_entry
       set boot_once=true
    else
       set default="0"
    fi
    
    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=1
      # GRUB lacks write support for btrfs, so recordfail support is disabled.
    }
    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
    }
    
    if [ x$feature_default_font_path = xy ] ; then
       font=unicode
    else
    insmod part_msdos
    insmod btrfs
    set root='hd0,msdos6'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  821f7ab0-4351-45f1-b870-1a4b33db1b5c
    else
      search --no-floppy --fs-uuid --set=root 821f7ab0-4351-45f1-b870-1a4b33db1b5c
    fi
        font="/@/usr/share/grub/unicode.pf2"
    fi
    
    if loadfont $font ; then
      set gfxmode=auto
      load_video
      insmod gfxterm
      set locale_dir=$prefix/locale
      set lang=sl_SI
      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=10
      # Fallback normal timeout code in case the timeout_style feature is
      # unavailable.
      else
        set timeout=10
      fi
    fi
    ### END /etc/grub.d/00_header ###
    
    ### BEGIN /etc/grub.d/05_debian_theme ###
    set menu_color_normal=white/black
    set menu_color_highlight=black/light-gray
    #set_background_image "images/tile.png";
    
    set menu_color_normal=white/black
    set menu_color_highlight=black/light-gray
    if background_color 0,0,0; then
      clear
    fi
    ### END /etc/grub.d/05_debian_theme ###
    
    ### BEGIN /etc/grub.d/10_linux ###
    function gfxmode {
        set gfxpayload="${1}"
        if [ "${1}" = "keep" ]; then
            set vt_handoff=vt.handoff=7
        else
            set vt_handoff=
        fi
    }
    if [ "${recordfail}" != 1 ]; then
      if [ -e ${prefix}/gfxblacklist.txt ]; then
        if hwmatch ${prefix}/gfxblacklist.txt 3; then
          if [ ${match} = 0 ]; then
            set linux_gfx_mode=keep
          else
            set linux_gfx_mode=text
          fi
        else
          set linux_gfx_mode=text
        fi
      else
        set linux_gfx_mode=keep
      fi
    else
      set linux_gfx_mode=text
    fi
    export linux_gfx_mode
    menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-821f7ab0-4351-45f1-b870-1a4b33db1b5c' {
        recordfail
        load_video
        gfxmode $linux_gfx_mode
        insmod gzio
        insmod part_msdos
        insmod btrfs
        set root='hd0,msdos6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  821f7ab0-4351-45f1-b870-1a4b33db1b5c
        else
          search --no-floppy --fs-uuid --set=root 821f7ab0-4351-45f1-b870-1a4b33db1b5c
        fi
        linux    /@/boot/vmlinuz-3.19.0-42-generic root=UUID=821f7ab0-4351-45f1-b870-1a4b33db1b5c ro rootflags=subvol=@  quiet splash $vt_handoff
        initrd    /@/boot/initrd.img-3.19.0-42-generic
    }
    submenu 'Napredne možnosti za Ubuntu' $menuentry_id_option 'gnulinux-advanced-821f7ab0-4351-45f1-b870-1a4b33db1b5c' {
        menuentry 'Ubuntu, z Linuxom 3.19.0-42-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-42-generic-advanced-821f7ab0-4351-45f1-b870-1a4b33db1b5c' {
            recordfail
            load_video
            gfxmode $linux_gfx_mode
            insmod gzio
            insmod part_msdos
            insmod btrfs
            set root='hd0,msdos6'
            if [ x$feature_platform_search_hint = xy ]; then
              search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  821f7ab0-4351-45f1-b870-1a4b33db1b5c
            else
              search --no-floppy --fs-uuid --set=root 821f7ab0-4351-45f1-b870-1a4b33db1b5c
            fi
            echo    'Nalaganje Linuxa 3.19.0-42-generic ...'
            linux    /@/boot/vmlinuz-3.19.0-42-generic root=UUID=821f7ab0-4351-45f1-b870-1a4b33db1b5c ro rootflags=subvol=@  quiet splash $vt_handoff
            echo    'Nalaganje začetnega ramdiska ...'
            initrd    /@/boot/initrd.img-3.19.0-42-generic
        }
        menuentry 'Ubuntu, with Linux 3.19.0-42-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-42-generic-recovery-821f7ab0-4351-45f1-b870-1a4b33db1b5c' {
            recordfail
            load_video
            insmod gzio
            insmod part_msdos
            insmod btrfs
            set root='hd0,msdos6'
            if [ x$feature_platform_search_hint = xy ]; then
              search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  821f7ab0-4351-45f1-b870-1a4b33db1b5c
            else
              search --no-floppy --fs-uuid --set=root 821f7ab0-4351-45f1-b870-1a4b33db1b5c
            fi
            echo    'Nalaganje Linuxa 3.19.0-42-generic ...'
            linux    /@/boot/vmlinuz-3.19.0-42-generic root=UUID=821f7ab0-4351-45f1-b870-1a4b33db1b5c ro recovery nomodeset rootflags=subvol=@ 
            echo    'Nalaganje začetnega ramdiska ...'
            initrd    /@/boot/initrd.img-3.19.0-42-generic
        }
        menuentry 'Ubuntu, z Linuxom 3.19.0-25-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-25-generic-advanced-821f7ab0-4351-45f1-b870-1a4b33db1b5c' {
            recordfail
            load_video
            gfxmode $linux_gfx_mode
            insmod gzio
            insmod part_msdos
            insmod btrfs
            set root='hd0,msdos6'
            if [ x$feature_platform_search_hint = xy ]; then
              search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  821f7ab0-4351-45f1-b870-1a4b33db1b5c
            else
              search --no-floppy --fs-uuid --set=root 821f7ab0-4351-45f1-b870-1a4b33db1b5c
            fi
            echo    'Nalaganje Linuxa 3.19.0-25-generic ...'
            linux    /@/boot/vmlinuz-3.19.0-25-generic root=UUID=821f7ab0-4351-45f1-b870-1a4b33db1b5c ro rootflags=subvol=@  quiet splash $vt_handoff
            echo    'Nalaganje začetnega ramdiska ...'
            initrd    /@/boot/initrd.img-3.19.0-25-generic
        }
        menuentry 'Ubuntu, with Linux 3.19.0-25-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.19.0-25-generic-recovery-821f7ab0-4351-45f1-b870-1a4b33db1b5c' {
            recordfail
            load_video
            insmod gzio
            insmod part_msdos
            insmod btrfs
            set root='hd0,msdos6'
            if [ x$feature_platform_search_hint = xy ]; then
              search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  821f7ab0-4351-45f1-b870-1a4b33db1b5c
            else
              search --no-floppy --fs-uuid --set=root 821f7ab0-4351-45f1-b870-1a4b33db1b5c
            fi
            echo    'Nalaganje Linuxa 3.19.0-25-generic ...'
            linux    /@/boot/vmlinuz-3.19.0-25-generic root=UUID=821f7ab0-4351-45f1-b870-1a4b33db1b5c ro recovery nomodeset rootflags=subvol=@ 
            echo    'Nalaganje začetnega ramdiska ...'
            initrd    /@/boot/initrd.img-3.19.0-25-generic
        }
    }
    
    ### END /etc/grub.d/10_linux ###
    
    ### BEGIN /etc/grub.d/20_linux_xen ###
    
    ### END /etc/grub.d/20_linux_xen ###
    
    ### BEGIN /etc/grub.d/20_memtest86+ ###
    menuentry 'Memory test (memtest86+)' {
        insmod part_msdos
        insmod btrfs
        set root='hd0,msdos6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  821f7ab0-4351-45f1-b870-1a4b33db1b5c
        else
          search --no-floppy --fs-uuid --set=root 821f7ab0-4351-45f1-b870-1a4b33db1b5c
        fi
        knetbsd    /@/boot/memtest86+.elf
    }
    menuentry 'Memory test (memtest86+, serial console 115200)' {
        insmod part_msdos
        insmod btrfs
        set root='hd0,msdos6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  821f7ab0-4351-45f1-b870-1a4b33db1b5c
        else
          search --no-floppy --fs-uuid --set=root 821f7ab0-4351-45f1-b870-1a4b33db1b5c
        fi
        linux16    /@/boot/memtest86+.bin console=ttyS0,115200n8
    }
    ### END /etc/grub.d/20_memtest86+ ###
    
    ### BEGIN /etc/grub.d/30_os-prober ###
    menuentry 'Ubuntu Xenial Xerus (development branch) (16.04) (na /dev/sda5)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-3af2cb3c-34d8-4f4e-94be-4e7138e331de' {
        insmod part_msdos
        insmod btrfs
        set root='hd0,msdos5'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  3af2cb3c-34d8-4f4e-94be-4e7138e331de
        else
          search --no-floppy --fs-uuid --set=root 3af2cb3c-34d8-4f4e-94be-4e7138e331de
        fi
        linux /boot/vmlinuz-4.3.0-5-generic root=/dev/sda5
        initrd /boot/initrd.img-4.3.0-5-generic
    }
    submenu 'Napredne možnosti za Ubuntu Xenial Xerus (development branch) (16.04) (na /dev/sda5)' $menuentry_id_option 'osprober-gnulinux-advanced-3af2cb3c-34d8-4f4e-94be-4e7138e331de' {
        menuentry 'Ubuntu Xenial Xerus (development branch) (16.04) (na /dev/sda5)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.3.0-5-generic--3af2cb3c-34d8-4f4e-94be-4e7138e331de' {
            insmod part_msdos
            insmod btrfs
            set root='hd0,msdos5'
            if [ x$feature_platform_search_hint = xy ]; then
              search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  3af2cb3c-34d8-4f4e-94be-4e7138e331de
            else
              search --no-floppy --fs-uuid --set=root 3af2cb3c-34d8-4f4e-94be-4e7138e331de
            fi
            linux /boot/vmlinuz-4.3.0-5-generic root=/dev/sda5
            initrd /boot/initrd.img-4.3.0-5-generic
        }
        menuentry 'Ubuntu Xenial Xerus (development branch) (16.04) (na /dev/sda5)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.4.0-0-generic--3af2cb3c-34d8-4f4e-94be-4e7138e331de' {
            insmod part_msdos
            insmod btrfs
            set root='hd0,msdos5'
            if [ x$feature_platform_search_hint = xy ]; then
              search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  3af2cb3c-34d8-4f4e-94be-4e7138e331de
            else
              search --no-floppy --fs-uuid --set=root 3af2cb3c-34d8-4f4e-94be-4e7138e331de
            fi
            linux /boot/vmlinuz-4.4.0-0-generic root=/dev/sda5
            initrd /boot/initrd.img-4.4.0-0-generic
        }
    }
    
    set timeout_style=menu
    if [ "${timeout}" = 0 ]; then
      set timeout=10
    fi
    ### END /etc/grub.d/30_os-prober ###
    
    ### BEGIN /etc/grub.d/30_uefi-firmware ###
    ### END /etc/grub.d/30_uefi-firmware ###
    
    ### BEGIN /etc/grub.d/40_custom ###
    # 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 'Plasma5' {
    insmod part_msdos
    insmod btrfs
    search --no-floppy --fs-uuid --set=root 3af2cb3c-34d8-4f4e-94be-4e7138e331de
    configfile /boot/grub/grub.cfg
    }
    
    ### END /etc/grub.d/40_custom ###
    
    ### 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 ###
    my grub.cfg in plasma5 (/boot/grub/grub.cfg):

    Code:
    #
    # DO NOT EDIT THIS FILE
    #
    # It is automatically generated by grub-mkconfig using templates
    # from /etc/grub.d and settings from /etc/default/grub
    #
    
    ### BEGIN /etc/grub.d/00_header ###
    if [ -s $prefix/grubenv ]; then
      set have_grubenv=true
      load_env
    fi
    if [ "${next_entry}" ] ; then
       set default="${next_entry}"
       set next_entry=
       save_env next_entry
       set boot_once=true
    else
       set default="0"
    fi
    
    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=1
      # GRUB lacks write support for btrfs, so recordfail support is disabled.
    }
    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
    }
    
    if [ x$feature_default_font_path = xy ] ; then
       font=unicode
    else
    insmod part_msdos
    insmod btrfs
    set root='hd0,msdos5'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  3af2cb3c-34d8-4f4e-94be-4e7138e331de
    else
      search --no-floppy --fs-uuid --set=root 3af2cb3c-34d8-4f4e-94be-4e7138e331de
    fi
        font="/@/usr/share/grub/unicode.pf2"
    fi
    
    if loadfont $font ; then
      set gfxmode=auto
      load_video
      insmod gfxterm
      set locale_dir=$prefix/locale
      set lang=sl_SI
      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=10
      # Fallback normal timeout code in case the timeout_style feature is
      # unavailable.
      else
        set timeout=10
      fi
    fi
    ### END /etc/grub.d/00_header ###
    
    ### BEGIN /etc/grub.d/05_debian_theme ###
    set menu_color_normal=white/black
    set menu_color_highlight=black/light-gray
    ### END /etc/grub.d/05_debian_theme ###
    
    ### BEGIN /etc/grub.d/10_linux ###
    function gfxmode {
        set gfxpayload="${1}"
        if [ "${1}" = "keep" ]; then
            set vt_handoff=vt.handoff=7
        else
            set vt_handoff=
        fi
    }
    if [ "${recordfail}" != 1 ]; then
      if [ -e ${prefix}/gfxblacklist.txt ]; then
        if hwmatch ${prefix}/gfxblacklist.txt 3; then
          if [ ${match} = 0 ]; then
            set linux_gfx_mode=keep
          else
            set linux_gfx_mode=text
          fi
        else
          set linux_gfx_mode=text
        fi
      else
        set linux_gfx_mode=keep
      fi
    else
      set linux_gfx_mode=text
    fi
    export linux_gfx_mode
    menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-3af2cb3c-34d8-4f4e-94be-4e7138e331de' {
        recordfail
        load_video
        gfxmode $linux_gfx_mode
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_msdos
        insmod btrfs
        set root='hd0,msdos5'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  3af2cb3c-34d8-4f4e-94be-4e7138e331de
        else
          search --no-floppy --fs-uuid --set=root 3af2cb3c-34d8-4f4e-94be-4e7138e331de
        fi
        linux    /@/boot/vmlinuz-4.4.0-0-generic root=UUID=3af2cb3c-34d8-4f4e-94be-4e7138e331de ro rootflags=subvol=@  quiet splash $vt_handoff
        initrd    /@/boot/initrd.img-4.4.0-0-generic
    }
    submenu 'Napredne možnosti za Ubuntu' $menuentry_id_option 'gnulinux-advanced-3af2cb3c-34d8-4f4e-94be-4e7138e331de' {
        menuentry 'Ubuntu, z Linuxom 4.4.0-0-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-0-generic-advanced-3af2cb3c-34d8-4f4e-94be-4e7138e331de' {
            recordfail
            load_video
            gfxmode $linux_gfx_mode
            insmod gzio
            if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
            insmod part_msdos
            insmod btrfs
            set root='hd0,msdos5'
            if [ x$feature_platform_search_hint = xy ]; then
              search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  3af2cb3c-34d8-4f4e-94be-4e7138e331de
            else
              search --no-floppy --fs-uuid --set=root 3af2cb3c-34d8-4f4e-94be-4e7138e331de
            fi
            echo    'Nalaganje Linuxa 4.4.0-0-generic ...'
            linux    /@/boot/vmlinuz-4.4.0-0-generic root=UUID=3af2cb3c-34d8-4f4e-94be-4e7138e331de ro rootflags=subvol=@  quiet splash $vt_handoff
            echo    'Nalaganje začetnega ramdiska ...'
            initrd    /@/boot/initrd.img-4.4.0-0-generic
        }
        menuentry 'Ubuntu, with Linux 4.4.0-0-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-0-generic-recovery-3af2cb3c-34d8-4f4e-94be-4e7138e331de' {
            recordfail
            load_video
            insmod gzio
            if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
            insmod part_msdos
            insmod btrfs
            set root='hd0,msdos5'
            if [ x$feature_platform_search_hint = xy ]; then
              search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  3af2cb3c-34d8-4f4e-94be-4e7138e331de
            else
              search --no-floppy --fs-uuid --set=root 3af2cb3c-34d8-4f4e-94be-4e7138e331de
            fi
            echo    'Nalaganje Linuxa 4.4.0-0-generic ...'
            linux    /@/boot/vmlinuz-4.4.0-0-generic root=UUID=3af2cb3c-34d8-4f4e-94be-4e7138e331de ro recovery nomodeset rootflags=subvol=@ 
            echo    'Nalaganje začetnega ramdiska ...'
            initrd    /@/boot/initrd.img-4.4.0-0-generic
        }
        menuentry 'Ubuntu, z Linuxom 4.3.0-5-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.3.0-5-generic-advanced-3af2cb3c-34d8-4f4e-94be-4e7138e331de' {
            recordfail
            load_video
            gfxmode $linux_gfx_mode
            insmod gzio
            if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
            insmod part_msdos
            insmod btrfs
            set root='hd0,msdos5'
            if [ x$feature_platform_search_hint = xy ]; then
              search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  3af2cb3c-34d8-4f4e-94be-4e7138e331de
            else
              search --no-floppy --fs-uuid --set=root 3af2cb3c-34d8-4f4e-94be-4e7138e331de
            fi
            echo    'Nalaganje Linuxa 4.3.0-5-generic ...'
            linux    /@/boot/vmlinuz-4.3.0-5-generic root=UUID=3af2cb3c-34d8-4f4e-94be-4e7138e331de ro rootflags=subvol=@  quiet splash $vt_handoff
            echo    'Nalaganje začetnega ramdiska ...'
            initrd    /@/boot/initrd.img-4.3.0-5-generic
        }
        menuentry 'Ubuntu, with Linux 4.3.0-5-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.3.0-5-generic-recovery-3af2cb3c-34d8-4f4e-94be-4e7138e331de' {
            recordfail
            load_video
            insmod gzio
            if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
            insmod part_msdos
            insmod btrfs
            set root='hd0,msdos5'
            if [ x$feature_platform_search_hint = xy ]; then
              search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  3af2cb3c-34d8-4f4e-94be-4e7138e331de
            else
              search --no-floppy --fs-uuid --set=root 3af2cb3c-34d8-4f4e-94be-4e7138e331de
            fi
            echo    'Nalaganje Linuxa 4.3.0-5-generic ...'
            linux    /@/boot/vmlinuz-4.3.0-5-generic root=UUID=3af2cb3c-34d8-4f4e-94be-4e7138e331de ro recovery nomodeset rootflags=subvol=@ 
            echo    'Nalaganje začetnega ramdiska ...'
            initrd    /@/boot/initrd.img-4.3.0-5-generic
        }
    }
    
    ### END /etc/grub.d/10_linux ###
    
    ### BEGIN /etc/grub.d/20_linux_xen ###
    
    ### END /etc/grub.d/20_linux_xen ###
    
    ### BEGIN /etc/grub.d/20_memtest86+ ###
    menuentry 'Memory test (memtest86+)' {
        insmod part_msdos
        insmod btrfs
        set root='hd0,msdos5'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  3af2cb3c-34d8-4f4e-94be-4e7138e331de
        else
          search --no-floppy --fs-uuid --set=root 3af2cb3c-34d8-4f4e-94be-4e7138e331de
        fi
        knetbsd    /@/boot/memtest86+.elf
    }
    menuentry 'Memory test (memtest86+, serial console 115200)' {
        insmod part_msdos
        insmod btrfs
        set root='hd0,msdos5'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  3af2cb3c-34d8-4f4e-94be-4e7138e331de
        else
          search --no-floppy --fs-uuid --set=root 3af2cb3c-34d8-4f4e-94be-4e7138e331de
        fi
        linux16    /@/boot/memtest86+.bin console=ttyS0,115200n8
    }
    ### END /etc/grub.d/20_memtest86+ ###
    
    ### BEGIN /etc/grub.d/30_os-prober ###
    ### END /etc/grub.d/30_os-prober ###
    
    ### BEGIN /etc/grub.d/30_uefi-firmware ###
    ### END /etc/grub.d/30_uefi-firmware ###
    
    ### BEGIN /etc/grub.d/40_custom ###
    # 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 'KDE4' {
    insmod part_msdos
    insmod btrfs
    search --no-floppy --fs-uuid --set=root 821f7ab0-4351-45f1-b870-1a4b33db1b5c
    configfile /boot/grub/grub.cfg
    }
    
    ### END /etc/grub.d/40_custom ###
    
    ### 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 ###
    so,... i dont know what im doing wrong. one thing maybe i did wrong when installing... in both installations i named my computer name as "avatar" --- before i didnt do that, but i figured that maybe that doesnt matter because is a computer name... and the installations exist on different partitions...

    anyway,...please help

    thank you!

    nice day!

    Simon

    #2
    Lots of data in there, but at first glance I have a question: Did you use the default install setup for btrfs when you installed (K)Ubuntu? What I mean is; when installing - you used the installer and selected a btrfs file system as the target to install to?

    If yes, the default (K)Ubuntu btrfs install creates two subvolumes on the target btrfs partition: @ for / and @home for /home. This means that, for example, the file system on 821f7ab0-4351-45f1-b870-1a4b33db1b5c contains these two subvolumes - @ and @home. Therefore, grub is not finding the configfile grub.cfg because it's in /@/boot/grub/ not /boot/grub/. Your 40_custom grub stanzas need to reflect the subvolume /@/ in the configfile statements.

    If you did something non-standard during install, please detail what.

    After booting, the two subvolumes are transparent to you because in your fstab mounts the subvolumes are stated as options like this: subvol=@. In fact, you should see two separate fstab lines that are nearly identical for both the root and home mounts - the only differences being the mount points and subvolume names.
    Last edited by oshunluvr; Jan 03, 2016, 08:01 AM.

    Please Read Me

    Comment


      #3
      Originally posted by oshunluvr View Post
      Lots of data in there, but at first glance I have a question: Did you use the default install setup for btrfs when you installed (K)Ubuntu? What I mean is; when installing - you used the installer and selected a btrfs file system as the target to install to?

      If yes, the default (K)Ubuntu btrfs install creates two subvolumes on the target btrfs partition: @ for / and @home for /home. This means that, for example, the file system on 821f7ab0-4351-45f1-b870-1a4b33db1b5c contains these two subvolumes - @ and @home. Therefore, grub is not finding the configfile grub.cfg because it's in /@/boot/grub/ not /boot/grub/. Your 40_custom grub stanzas need to reflect the subvolume /@/ in the configfile statements.

      If you did something non-standard during install, please detail what.

      After booting, the two subvolumes are transparent to you because in your fstab mounts the subvolumes are stated as options like this: subvol=@. In fact, you should see two separate fstab lines that are nearly identical for both the root and home mounts - the only differences being the mount points and subvolume names.
      Hello!

      first let me say, your help is much appriciated, even more so, because IT WORKED! Thank you so much! By "it worked" i mean, i just had to minimally edit both of my "40_custom" files, to look like this:

      plasma 5 (etc/grub.d/40_custom):

      Code:
      #!/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 'kde4' {
      insmod part_msdos
      insmod btrfs
      search --no-floppy --fs-uuid --set=root 821f7ab0-4351-45f1-b870-1a4b33db1b5c
      configfile [COLOR=#ff0000][B]/@[/B][/COLOR]/boot/grub/grub.cfg
      }
      and my kde4 (etc/grub.d/40_custom):

      Code:
      #!/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 'Plasma5' {
      insmod part_msdos
      insmod btrfs
      search --no-floppy --fs-uuid --set=root 3af2cb3c-34d8-4f4e-94be-4e7138e331de
      configfile [COLOR=#ff0000][B]/@[/B][/COLOR]/boot/grub/grub.cfg
      }
      Let me also say both of my installations i used the default installation BTRFS settings (it means i selected btrfs partitions in the kubuntu installation menu), therefore my fstabs look like this:

      plasma5:

      Code:
      # /etc/fstab: static file system information.
      #
      # Use 'blkid' to print the universally unique identifier for a
      # device; this may be used with UUID= as a more robust way to name devices
      # that works even if disks are added and removed. See fstab(5).
      #
      # <file system> <mount point>   <type>  <options>       <dump>  <pass>
      # / was on /dev/sda5 during installation
      UUID=3af2cb3c-34d8-4f4e-94be-4e7138e331de /               btrfs   defaults,subvol=@ 0       1
      # /home was on /dev/sda5 during installation
      UUID=3af2cb3c-34d8-4f4e-94be-4e7138e331de /home           btrfs   defaults,subvol=@home 0       2
      # swap was on /dev/sda1 during installation
      UUID=d2ad0990-78e3-464e-8ac9-1dc67be49963 none            swap    sw              0       0
      
      
      # kde4 on /dev/sda6
      LABEL=kde4    /media/original/kde4root/               btrfs    defaults 0       1
      /media/original/kde4root/@/ /media/fani/kde4/   none  bind     0   0
      /media/original/kde4root/@home/ /media/fani/kde4_home/   none  bind     0   0
      
      # disk on /dev/sda7
      LABEL=disk    /media/original/diskroot/               btrfs    defaults 0       1
      /media/original/diskroot/disk/ /media/fani/disk/   none  bind     0   0
      and kde4:

      Code:
      # /etc/fstab: static file system information.
      #
      # Use 'blkid' to print the universally unique identifier for a
      # device; this may be used with UUID= as a more robust way to name devices
      # that works even if disks are added and removed. See fstab(5).
      #
      # <file system> <mount point>   <type>  <options>       <dump>  <pass>
      # / was on /dev/sda6 during installation
      UUID=821f7ab0-4351-45f1-b870-1a4b33db1b5c /               btrfs   defaults,subvol=@ 0       1
      # /home was on /dev/sda6 during installation
      UUID=821f7ab0-4351-45f1-b870-1a4b33db1b5c /home           btrfs   defaults,subvol=@home 0       2
      # swap was on /dev/sda1 during installation
      UUID=d2ad0990-78e3-464e-8ac9-1dc67be49963 none            swap    sw              0       0
      /dev/sdb        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
      
      
      # plasma5 on /dev/sda5
      LABEL=plasma5    /media/original/plasma5root/               btrfs    defaults 0       1
      /media/original/plasma5root/@/ /media/fani/plasma5/   none  bind     0   0
      /media/original/plasma5root/@home/ /media/fani/plasma5_home/   none  bind     0   0
      
      # disk on /dev/sda7
      LABEL=disk    /media/original/diskroot/               btrfs    defaults 0       1
      /media/original/diskroot/disk/ /media/fani/disk/   none  bind     0   0
      The only thing which i cannot right now still do is run "grub-install" when i chroot into another instalaltion. I know, now i can simply boot the other installation and "grub-install" from there, but i would like to know in case one day it might come in handy, if i find myself in situation that i cannot access the other installation other way than to chroot in it. Thats also the reason i (for now) wont mark this as solved just yet

      so if i do this:

      Code:
      fani@avatar:~$ sudo mount[COLOR=#ff0000][B] -o subvol=@[/B][/COLOR] /dev/sda5 /media/fani/plasma5
      
      fani@avatar:~$ for i in dev/pts sys proc run; do sudo mount --bind /$i /media/fani/plasma5/$i; done
      
      fani@avatar:~$ sudo chroot /media/fani/plasma5
      
      root@avatar:/# sudo grub-install /dev/sda
      Installing for i386-pc platform.
      grub-install: napaka: failed to get canonical path of `/dev/sda5'.
      then i tried this (without setting the "subvol"):

      Code:
      fani@avatar:~$ sudo mount /dev/sda5 /media/fani/plasma5
      
      fani@avatar:~$ for i in dev/pts sys proc run; do sudo mount --bind /$i /media/fani/plasma5/$i; done
      
      fani@avatar:~$ sudo chroot /media/fani/plasma5
      
      root@avatar:/# sudo grub-install /dev/sda
      Installing for i386-pc platform.
      grub-install: napaka: failed to get canonical path of `/dev/sda5'.
      same thing.... what am i doing wrong here?

      and..again thank you!

      nice day

      Simon

      Comment


        #4
        My setup is different than yours so I can't answer that last part. I see why you might want to do that, but I have no ideas at the moment. You might consider that you're going through more work than really necessary considering the value of skipping a reboot to upgrade grub. Of course, learning how to do it could be useful down the road.

        What I do is install ALL my versions and distros to the same btrfs flesystem by changing the default subvolume names to unique names. My btrfs root looks like this:
        Code:
        stuart@office:~$ ll /mnt/samsung/
        total 0
        drwxr-xr-x 1 root   root   382 May 28  2015 @Kubuntu_14_04
        drwxr-xr-x 1 root   root    48 Jan 25  2015 @Kubuntu_14_04_home
        drwxr-xr-x 1 root   root   306 Dec 19 12:47 @Kubuntu_15_04
        drwxr-xr-x 1 stuart stuart  86 Jul 27 09:51 @Kubuntu_15_04_home
        drwxr-xr-x 1 root   root   248 Dec 19 13:25 @Kubuntu_15_10
        drwxr-xr-x 1 root   root    52 Dec 19 13:13 @Kubuntu_15_10_home
        drwxr-xr-x 1 root   root   126 Dec 19 12:55 snapshots
        drwxr-x--- 1 stuart stuart 732 Nov  3 11:34 @stuart
        Then I use a dedicated grub install that uses the grub.cfg of each install to boot. IMO, there's little reason to upgrade grub often as it's not really a security issue.

        Please Read Me

        Comment


          #5
          hello!

          im just writing to say i managed to SOLVE it!

          the problem was with my "FOR" sentence.... The right way to do it is like this:

          Code:
          sudo mkdir /mnt
          sudo mount -o subvol=@ /dev/sdaX /mnt
          [COLOR=#ff0000]for i in /dev /dev/pts /proc /run /sys; do sudo mount -B /$i /mnt/$i; done[/COLOR]
          sudo chroot /mnt
          sudo grub-install /dev/sdX
          sudo update-grub
          
          [COLOR=#ff0000]for i in /dev /dev/pts /proc /run /sys; do sudo umount -B /$i /mnt/$i; done[/COLOR]
          sudo umount /mnt
          exit
          thank you for your help! much appriciated!

          nice day!

          Simon
          Last edited by SimonAndric; Jan 08, 2016, 08:26 PM. Reason: typos... :)

          Comment


            #6
            Excellent work and thanks for detailing it and your solution.

            Please Read Me

            Comment

            Working...
            X