Announcement

Collapse
No announcement yet.

Confused about grub partitions

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

    [GRUB] Confused about grub partitions

    I'm actually using Neon:

    Code:
    $ uname -a
    Linux jon-neon 4.4.0-112-generic #135-Ubuntu SMP Fri Jan 19 11:48:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
    I have several levels installed:

    Code:
    $ ls /boot/vml*
    /boot/vmlinuz-4.13.0-32-generic             /boot/vmlinuz-4.4.0-116-generic
    /boot/vmlinuz-4.13.0-36-generic             /boot/vmlinuz-4.4.0-116-generic.efi.signed
    /boot/vmlinuz-4.4.0-112-generic             /boot/vmlinuz-4.4.0-77-generic
    /boot/vmlinuz-4.4.0-112-generic.efi.signed  /boot/vmlinuz-4.4.0-77-generic.efi.signed
    And grub seems to find them all:

    Code:
    $ sudo update-grub
    Generating grub configuration file ...
    Found theme: /boot/grub/themes/breeze/theme.txt
    Found linux image: /boot/vmlinuz-4.13.0-36-generic
    Found initrd image: /boot/initrd.img-4.13.0-36-generic
    Found linux image: /boot/vmlinuz-4.13.0-32-generic
    Found initrd image: /boot/initrd.img-4.13.0-32-generic
    Found linux image: /boot/vmlinuz-4.4.0-116-generic
    Found initrd image: /boot/initrd.img-4.4.0-116-generic
    Found linux image: /boot/vmlinuz-4.4.0-112-generic
    Found initrd image: /boot/initrd.img-4.4.0-112-generic
    Found linux image: /boot/vmlinuz-4.4.0-77-generic
    Found initrd image: /boot/initrd.img-4.4.0-77-generic
    Found Ubuntu 16.04.3 LTS (16.04) on /dev/sda3
    Found Ubuntu 16.04.2 LTS (16.04) on /dev/sda6
    Found Debian GNU/Linux (8.2) on /dev/sdb1
    Found Ubuntu 14.04.2 LTS (14.04) on /dev/sdc3
    Adding boot menu entry for EFI firmware configuration
    done
    Don't know what breeze theme bit is about. That's not my problem right now.

    When I boot and select advanced options for Neon on /dev/sda5 (my only Neon system and my default), it only sees a subset of these, clear evidence that grub is not writing this disk. These are shown in the first attachment.

    I have tried doing

    sudo grub-install /dev/sda

    but that changes nothing. Here is my partition config:

    Code:
    $ df
    Filesystem     1K-blocks      Used Available Use% Mounted on
    udev             4009736         0   4009736   0% /dev
    tmpfs             806220     10036    796184   2% /run
    /dev/sda5       61796348  22016564  36617672  38% /
    tmpfs            4031092    349496   3681596   9% /dev/shm
    tmpfs               5120         4      5116   1% /run/lock
    tmpfs            4031092         0   4031092   0% /sys/fs/cgroup
    /dev/sda1         245996      9078    236919   4% /boot/efi
    /dev/sdc6       51475068  29885992  18951252  62% /samba-transfer
    /dev/sdb2      897816032 724926168 127260424  86% /mnt/areca-bak
    /dev/sdc4      361112164 221117840 121627860  65% /home/jon/our-pix
    /dev/sdc5      206293688 125076680  70714864  64% /home/jon/music-mp3
    /dev/sda4      206293688 118768256  77023288  61% /home/jon/jon-files
    tmpfs             806220        20    806200   1% /run/user/1000
    so I'm using EFI. When I boot and try to select the partition to boot, I see the mess in the 2nd and 3rd attachments. This is the second part of my problem: I have little idea what all that means. What are P0 and P1, e.g.? I will settle, tho, for getting my grub to write to the same place I boot from, by modifying either the former or the latter.

    Thanks in advance.
    Attached Files
    'I must have a prodigious quantity of mind; it takes me as much as a week sometimes to make it up.' Mark Twain

    #2
    How many OSes do you have installed?

    What are the outputs of:

    Code:
    sudo efibootmgr -v
    and

    Code:
    sudo parted -l
    and

    Code:
    [FONT=monospace]sudo cat /boot/efi/EFI/ubuntu/grub.cfg
    
    [/FONT]

    Comment


      #3
      Originally posted by mr_raider View Post
      How many OSes do you have installed?
      Five, I think. 3 on sda, 1 each on sdb and sdc, which are both way out of date. They are just there for emergencies. I would delete one of the ones on sda if I knew how. Is it enough to erase/format the partition?

      Code:
      $ sudo efibootmgr -v
      [sudo] password for jon: 
      BootCurrent: 0003
      Timeout: 1 seconds
      BootOrder: 0003,0000,0002,0006,0007,0009,000A,0004,0005,000B,0001
      Boot0000* ubuntu        HD(1,GPT,9334e04f-d435-4913-b2ea-b3da699d73be,0x800,0x7a000)/File(\EFI\ubuntu\shimx64.efi)
      Boot0001  rEFInd Boot Manager   HD(1,GPT,9334e04f-d435-4913-b2ea-b3da699d73be,0x800,0x7a000)/File(\EFI\refind\refind_x64.efi)
      Boot0002* debian        HD(1,GPT,9334e04f-d435-4913-b2ea-b3da699d73be,0x800,0x7a000)/File(\EFI\debian\grubx64.efi)
      Boot0003* neon  HD(1,GPT,9334e04f-d435-4913-b2ea-b3da699d73be,0x800,0x7a000)/File(\EFI\neon\shimx64.efi)
      Boot0004* CD/DVD Drive  BBS(CDROM,,0x0)AMGOAMNO...o.T.S.S.T.c.o.r.p. .C.D.D.V.D.W. .S.H.-.2.2.4.F.B...A...>..Gd-.;.A..MQ..L.1.S.S.6.Y.6.G.A.0.9.H.1.7.S. . . . . . ...AMBO
      Boot0005* Hard Drive    BBS(HD,,0x0)AMGOAMNO...o.K.I.N.G.S.T.O.N. .S.V.3.0.0.S.3.7.A.4.8.0.G...A...>..Gd-.;.A..MQ..L.0.5.2.0.B.6.2.7.A.5.9.0.F.0.6.A.
      
      . . . ...AMBOAMNO...o.H.i.t.a.c.h.i. .H.D.S.7.2.1.0.1.0.C.L.A.3.3.0...A...>..Gd-.;.A..MQ..L. . . . . .
      
      .P.J.9.S.0.3.1.N.4.2.P.A.L.X...AMBOAMNO...o.S.T.1.0.0.0.D.M.0.0.3.-.1.C.H.1.6.2...A...>..Gd-.;.A..MQ..L. . . . . . . . . .
      
      . . .1.W.4.D.7.M.D.Y...AMBO
      Boot0006* UEFI: Hitachi HDS721010CLA330 PciRoot(0x0)/Pci(0x1f,0x2)/Sata(1,65535,0)/HD(3,GPT,c50972c3-65c4-4695-8c45-7a0b7168f5e7,0x800,0x64000)AMBO
      Boot0007* UEFI: ST1000DM003-1CH162      PciRoot(0x0)/Pci(0x1f,0x2)/Sata(5,65535,0)/HD(1,GPT,461d80f1-3d02-44da-9ef5-cc1d2c446e7e,0x800,0x64000)AMBO
      Boot0009* UEFI OS       HD(2,GPT,d8e5b8ea-426c-46d8-850d-ac460ef8417d,0x7a800,0x6400000)/File(\EFI\BOOT\BOOTX64.EFI)
      Boot000A* UEFI: KINGSTON SV300S37A480G  PciRoot(0x0)/Pci(0x1f,0x2)/Sata(0,65535,0)/HD(2,GPT,d8e5b8ea-426c-46d8-850d-ac460ef8417d,0x7a800,0x6400000)/HD(1,MBR,0x120,0x29c,0x1280)AMBO
      Boot000B* ubuntu        HD(1,GPT,9334e04f-d435-4913-b2ea-b3da699d73be,0x800,0x7a000)/File(\EFI\Ubuntu\grubx64.efi)
      Code:
      $ sudo parted -l
      Model: ATA KINGSTON SV300S3 (scsi)
      Disk /dev/sda: 480GB
      Sector size (logical/physical): 512B/512B
      Partition Table: gpt
      Disk Flags: 
      
      Number  Start   End     Size    File system  Name        Flags
      1      1049kB  257MB   256MB   fat32        EFI System  boot, esp
      2      257MB   53.9GB  53.7GB
      3      53.9GB  108GB   53.7GB  ext4
      4      108GB   322GB   215GB   ext4
      5      322GB   387GB   64.4GB  ext4                     msftdata
      6      429GB   480GB   51.2GB  ext4
      
      Model: ATA Hitachi HDS72101 (scsi)
      Disk /dev/sdb: 1000GB
      Sector size (logical/physical): 512B/512B
      Partition Table: gpt
      Disk Flags: 
      
      Number  Start   End     Size    File system  Name              Flags
      3      1049kB  211MB   210MB   fat32        EFI System        boot, esp
      6      211MB   262MB   51.4MB  ext4
      1      262MB   53.7GB  53.4GB  ext4         Deb-82
      4      53.7GB  64.4GB  10.7GB  ext4         Linux filesystem
      2      64.4GB  999GB   934GB   ext4         Linux filesystem
      
      Model: ATA ST1000DM003-1CH1 (scsi)
      Disk /dev/sdc: 1000GB
      Sector size (logical/physical): 512B/4096B
      Partition Table: gpt
      Disk Flags: 
      
      Number  Start   End     Size    File system     Name              Flags
      1      1049kB  211MB   210MB   fat32           EFI System        boot, esp
      3      211MB   53.7GB  53.5GB  ext4
      4      268GB   644GB   376GB   ext4            Linux filesystem
      5      644GB   859GB   215GB   ext4            Linux filesystem
      6      859GB   913GB   53.7GB  ext4            Linux filesystem
      7      913GB   923GB   10.7GB  linux-swap(v1)  Linux swap
      
      Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0
      has been opened read-only.
      Error: /dev/sr0: unrecognised disk label
      Model: TSSTcorp CDDVDW SH-224FB (scsi)                                    
      Disk /dev/sr0: 677MB
      Sector size (logical/physical): 2048B/2048B
      Partition Table: unknown
      Disk Flags:
      Code:
      $ sudo cat /boot/efi/EFI/ubuntu/grub.cfg
      search.fs_uuid 5bab455f-c534-46a2-aaff-7b5810bfa518 root hd0,gpt3 
      set prefix=($root)'/boot/grub'
      configfile $prefix/grub.cfg
      'I must have a prodigious quantity of mind; it takes me as much as a week sometimes to make it up.' Mark Twain

      Comment


        #4
        Wow! Three EFI partitions. I'm not certain, but I believe it's not a good idea to have more than one on a system. You sure have a complicated mess to sort out.

        Yes, erasing or formatting a partition is enough to wipe a Linux system off a hard drive. You will need to execute a sudo update-grub from the install that has control of grub to remove the superfluous boot entries after removing the Linux install.
        Desktop PC: Intel Core-i5-4670 3.40Ghz, 16Gb Crucial ram, Asus H97-Plus MB, 128Gb Crucial SSD + 2Tb Seagate Barracuda 7200.14 HDD running Kubuntu 18.04 LTS and Kubuntu 14.04 LTS (on SSD).
        Laptop: HP EliteBook 8460p Core-i5-2540M, 4Gb ram, Transcend 120Gb SSD, currently running Deepin 15.8 and Manjaro KDE 18.

        Comment


          #5
          Hi Rod J: actually, you can have multiple ESPs -- assuming you did it by design for dual-booting (and there is a precise procedure for constructing the ESPs)!
          And, yes, it sure looks like a mess.
          And it is Neon, which I'm told deals with GRUB differently ( ? ) , I know nothing about it, so ...
          An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

          Comment


            #6
            Yeah. Where does grub want to write his file: to /dev/sda or to /dev/sdax? If the latter, is it to the EFI partition?

            I certainly do NOT want to mess that up. In other words, where should the following command point?

            sudo grub-install /dev/sda

            sudo grub-install /dev/sda1

            or elsewhere?
            Last edited by joneall; Mar 02, 2018, 10:31 AM.
            'I must have a prodigious quantity of mind; it takes me as much as a week sometimes to make it up.' Mark Twain

            Comment


              #7
              Ok. You have a mess. I'll give you general advice:

              1. You can have multiple EFI partitions, one on each disk. But you MUST use the BIOS/firmware bootorder to select which EFI partition boots.

              2. If you install an ubuntu derivative OS (kubuntu, neon, mint) on a system with an existing EFI partition, it will re-use it even if you recreate a new EFI partition.

              3. Multiple ubuntu derived installs can not exist in EFI mode using the same EFI partition. The grub2/ubuntu loader will always like for EFI/ubuntu. Even you are pointing to EFI/neon, EFI/ubuntu will be used. So your neon and ubuntu may be using the same EFI partition.

              My advice:

              1. Create a refind iso disk or USB. You clearly know how refind works.

              2. Physically disconnect all drives except for the one that has neon installed on it.

              3. Boot the disk. If it fails, boot the refind disk/USB and then use that to boot the disk.

              4. When you succeed, update the OS, run update-grub and see if it has restored your problems.

              Comment


                #8
                Originally posted by mr_raider View Post
                Ok. You have a mess. I'll give you general advice:

                3. Multiple ubuntu derived installs can not exist in EFI mode using the same EFI partition. The grub2/ubuntu loader will always like for EFI/ubuntu. Even you are pointing to EFI/neon, EFI/ubuntu will be used. So your neon and ubuntu may be using the same EFI partition.
                Really? That would mean only one Ubuntu per disk? I find that quite odd, since grub2 allows several. Is there a way to look at the EFI partition to see what is on it? It seems to me from way back when I installed it, there was, tho I've completely forgot since.

                My advice:

                1. Create a refind iso disk or USB. You clearly know how refind works

                2. Physically disconnect all drives except for the one that has neon installed on it.

                3. Boot the disk. If it fails, boot the refind disk/USB and then use that to boot the disk..
                Can't see why it would fail, since it's the disk I am booting on now.


                4. When you succeed, update the OS, run update-grub and see if it has restored your problems.
                I can boot the system just fine. It's just that update-grub is writing to a partition different from the one I am booting from and I don't know which one.

                Thanks for your suggestions. Guess I have to dig back into EFI functioning. Sigh.
                'I must have a prodigious quantity of mind; it takes me as much as a week sometimes to make it up.' Mark Twain

                Comment


                  #9
                  I found out how to look at /boot/efi (root).

                  Code:
                  root@jon-neon:/boot/efi/EFI# ll
                  total 4
                  drwx------ 7 root root  512 févr. 19  2017 ./
                  drwx------ 3 root root  512 janv. 1  1970 ../
                  drwx------ 2 root root  512 déc. 17  2015 debian/
                  drwx------ 2 root root  512 juin  17  2017 neon/
                  drwx------ 5 root root  512 déc. 20  2015 refind/
                  drwx------ 2 root root  512 déc. 20  2015 tools/
                  drwx------ 3 root root 1024 févr. 2 18:02 ubuntu/
                  I re-ran update-grub.

                  Code:
                  $ sudo update-grub
                  Generating grub configuration file ...
                  Found theme: /boot/grub/themes/breeze/theme.txt
                  Found linux image: /boot/vmlinuz-4.13.0-36-generic
                  Found initrd image: /boot/initrd.img-4.13.0-36-generic
                  Found linux image: /boot/vmlinuz-4.13.0-32-generic
                  Found initrd image: /boot/initrd.img-4.13.0-32-generic
                  Found linux image: /boot/vmlinuz-4.4.0-116-generic
                  Found initrd image: /boot/initrd.img-4.4.0-116-generic
                  Found linux image: /boot/vmlinuz-4.4.0-112-generic
                  Found initrd image: /boot/initrd.img-4.4.0-112-generic
                  Found Ubuntu 16.04.3 LTS (16.04) on /dev/sda3
                  Found Ubuntu 16.04.2 LTS (16.04) on /dev/sda6
                  Found Debian GNU/Linux (8.2) on /dev/sdb1
                  Found Ubuntu 14.04.2 LTS (14.04) on /dev/sdc3
                  Adding boot menu entry for EFI firmware configuration
                  done
                  It clear from the dates that it did NOT write the efi partition, at least not this one. I mounted the efi partitions on the other two disks and they are completely empty. So grub2 is not writing to them. Then where the hell IS it writing?

                  This is most perplexing. Is there no way to get grub to indicate where is writing? I took a quick look at /usr/sbin/grub-mkconfig, but a quick look is not enough.
                  'I must have a prodigious quantity of mind; it takes me as much as a week sometimes to make it up.' Mark Twain

                  Comment


                    #10
                    You have to understand how grub boots in EFI mode.

                    1. The firmware locates the EFI partition and finds EFI/Ubuntu/grubx64.efi

                    2. Grub boots using the parameters in the Ubuntu folder.

                    4. It looks for EFI/Ubuntu/grub.cfg which points to the UUID of the partition holding /boot

                    5. The next stage of grub finds initrd

                    For step 1, all Ubuntu derivatives will look for the same location. Whether you call the folder neon or linuxmint or Ubuntu it will look for grub.cfg in Ubuntu.

                    Grub.cfg can only point to one UUID. It does not matter if you have multiple /boot partitions in multiple installs. The EFI bootloader will only pass control of the boot process to the UUID listed in grub.cfg.

                    Note that once the next stage of grub loads from /boot partition, it can then boot any Linux distro it finds on the disk and lists in the boot menu. That's what update-grub does. This gives you the illusion of EFI multibooting.

                    But the firmware can only pass control to a single bootloader (grub or Windows) at any time.

                    In the case of the OP he has a mismatch between the grub he is updating and the one that is controlling the boot process.

                    Refind allows you to bypass grub and directly boot a Linux kernel. The OP would be best served with one refind install than configuring it to recognize all his /boot partitions and boot the kernel directly.

                    Sent from my ONEPLUS A5010 using Tapatalk

                    Comment


                      #11
                      Really? That would mean only one Ubuntu per disk?
                      No, you can have as many as you want. But, what mr_raider says is also correct: in the ESP, you would see only the label ubuntu to describe any Ubuntu derivative (Kubuntu, Ubuntu, etc.). OK, look, you do have quite a lot going on with your setup, for sure, and you are dealing with Neon and UEFI ... all I can offer, time-wise right now, is my how-to, which covers ALL your options for dual booting, UEFI, multiple Ubuntu's, and multiple ESPs:

                      https://www.kubuntuforums.net/showth...l=1#post379977

                      Fact is, IF you really study these principles and methods, you could--no doubt--get this sorted out; BUT ... you may have to do some re-installing and/or re-building (of, say, ESPs) to pull it off. Again, a BUT: I would try to cook up a way to do it as per mr_raider's approach -- try to simply fix what you have going on, as is.
                      An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                      Comment


                        #12
                        (We are cross-posting :-) ) Refind sounds good to me.
                        An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                        Comment


                          #13
                          To see which EFI partition is in control do:

                          cat /etc/fstab

                          That will show you the UUID of the EFI that this install is using.

                          Sent from my ONEPLUS A5010 using Tapatalk

                          Comment


                            #14
                            Thanks, all. I will read Qqmike's document grub2 et al. I still have one point of confusion, but it is perhaps explained in that document. I will ask anyway. As I said, in the efi partition, I see:

                            Code:
                            $ sudo ls -l efi/EFI
                            total 3
                            drwx------ 2 root root  512 déc. 17  2015 debian
                            drwx------ 2 root root  512 juin  17  2017 neon
                            drwx------ 5 root root  512 déc. 20  2015 refind
                            drwx------ 2 root root  512 déc. 20  2015 tools
                            drwx------ 3 root root 1024 févr. 2 18:02 ubuntu
                            From what you say, all my systems will use ubuntu for booting. Even neon? If not, why is the neon one there? Surely, one can have a multi-boot system with xubuntu, neon, windoze and even macOS. Is each one going to use a different subdirectoryof efi/EFI? If so, will they find each other without my having to loop thru all those systems to run grub2?
                            'I must have a prodigious quantity of mind; it takes me as much as a week sometimes to make it up.' Mark Twain

                            Comment


                              #15
                              AND, how will the refind configuration be updated when I run apt-dist-upgrade?
                              'I must have a prodigious quantity of mind; it takes me as much as a week sometimes to make it up.' Mark Twain

                              Comment

                              Working...
                              X