CJ Fearnley on 29 Aug 2016 12:23:17 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Making sure GRUB2 detects your root volume


Looks like I used dos mode:

cjf@tetrahelix:~$ sudo grub-install --target=i386-pc /dev/sda
Installing for i386-pc platform.
grub-install: error: disk
`lvmid/dcqgzj-awwK-OfNY-pVPk-dJNm-pEbM-OfP6VO/xAJ9fS-1bIS-oxAI-VF82-7no4-mrLe-XmNTzC'
not found.
[status 1]
cjf@tetrahelix:~$ sudo grub-install --target=x86_64-efi /dev/sda
grub-install: error: /usr/lib/grub/x86_64-efi/modinfo.sh doesn't exist. Please
specify --target or --directory.
[status 1]

This system successfull had grub installed for 4 years before disk
failure forced a reinstall. It booted once correctly via grub into
lvmid/dcqgzj-awwK-OfNY-pVPk-dJNm-pEbM-OfP6VO/xAJ9fS-1bIS-oxAI-VF82-7no4-mrLe-XmNTzC
that was straight lvm on one disk.

Then I converted the LVM to RAID-1 and grub has been failing ever since.

What step did I miss when converting the LVM to RAID-1 to make grub work?

Grub doesn't seem to have noticed the RAID-1 change and it appears to
remember the old LVM booting even after I purged and reinstalled all
grub packages.

Is there no way to tell grub which root partition to use?

Here is my gdisk output in case it helps any:

cjf@tetrahelix:~$  sudo gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 3907029168 sectors, 1.8 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): CC804C51-77C9-4754-B44F-5A4BADF99F3F
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 3907029134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2157 sectors (1.1 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048            4095   1024.0 KiB  EF02  
   2            4096          491519   238.0 MiB   8200  
   3          491520      3907028991   1.8 TiB     8E00  

$ sudo gdisk -l /dev/sdb
[sudo] password for cjf: 
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdb: 3907029168 sectors, 1.8 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 5C2A59E6-8DE1-4E00-BEE1-C208D42E1152
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 3907029134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048            4095   1024.0 KiB  EF02  
   2            4096          491519   238.0 MiB   8200  
   3          491520      3907029134   1.8 TiB     8E00  

On Mon, Aug 29, 2016 at 12:25:52PM -0400, Keith C. Perry wrote:
> Did you install in grub in dos or gpt mode?  In trying to get my Arch USB system to work on UEFI system and legacy boot system I recently went through this.  I seem to have gotta a build that does work for both cases but still not my Chromebook (which appears to only want to boot my Syslinux multiboot USB flashdrive- different issue)
> 
> My partition map...
> 
> gdisk -l /dev/sdb
> GPT fdisk (gdisk) version 1.0.1
> 
> Partition table scan:
>   MBR: protective
>   BSD: not present
>   APM: not present
>   GPT: present
> 
> Found valid GPT with protective MBR; using GPT.
> Disk /dev/sdb: 494403584 sectors, 235.8 GiB
> Logical sector size: 512 bytes
> Disk identifier (GUID): 1D5A0BBE-1D6B-44EA-A7E2-3FF3A9E30DB2
> Partition table holds up to 128 entries
> First usable sector is 34, last usable sector is 494403550
> Partitions will be aligned on 2-sector boundaries
> Total free space is 0 sectors (0 bytes)
> 
> Number  Start (sector)    End (sector)  Size       Code  Name
>    1            2048         1026047   500.0 MiB   EF00  EFI System
>    2         1026048       494403550   235.3 GiB   8300  Linux filesystem
>    4              34            2047   1007.0 KiB  EF02  BIOS boot partition
> 
> I originally has this as partition 1 - 3 but think I read something about the BIOS boot partition needing to be last.  I do think it will work that way actually.
> 
> The bigger problem I had on Arch was that I needed to create another preset for build the initrd with pointer to /boot/efi for the EFI partion.  Once I got that right, the it was just a matter of running grub for both cases.
> 
> First run update-grub (which is just a script that runs grub-mkconfig -o /boot/grub/grub.cfg) then,
> 
> So for dos...
> grub-install --target=i386-pc /dev/sda
> mkinitcpio -p linux
> 
> ...and for EFI... (making sure /dev/sda4 is mounted to /boot/efi)
> grub-install --target=x86_64-efi /dev/sda
> mkinitcpio -p linux-efi
> 
> I say all that for reference to see if it helps generally but specially for LV's I think key is to keep it  simple.  I have a system I recently rebuild and it does NOT use a BIOS partition.  It is a mirrored system with one drive being a dos and the other being gpt (they have size mis-match).  GPT is just used so that the entire partition can be seen for booting purposes but I NOT do grub-install with an EFI target.  Linux is apparently ok with such and animal (i.e. gpt drive with mbr install).
> 
> While that might be "wierd" it is clean because the system (which only has a 50Gb system volume) uses LVM so there are no partition size restrictions.
> 
> ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 
> Keith C. Perry, MS E.E. 
> Owner, DAO Technologies LLC 
> (O) +1.215.525.4165 x2033 
> (M) +1.215.432.5167 
> www.daotechnologies.com
> 
> ----- Original Message -----
> From: "cjf" <cjf@LinuxForce.net>
> To: "Philadelphia Linux User's Group Discussion List" <plug@lists.phillylinux.org>
> Sent: Sunday, August 28, 2016 7:16:29 PM
> Subject: Re: [PLUG] Making sure GRUB2 detects your root volume
> 
> I added the following to my /etc/default/grub:
> GRUB_CMDLINE_LINUX=""
> GRUB_CMDLINE_LINUX="rd.lvm.lv=tetrahelix/root
> rd.luks.uuid=bc49d20d-c4b8-4cfb-bd36-16e2c04062e9
> rd.lvm.lv=tetrahelix/root rhgb quiet"
> 
> But I get the same error as before:
> 
> $ sudo update-grub 
> Generating grub configuration file ...
> Found linux image: /boot/vmlinuz-3.16.0-4-amd64
> Found initrd image: /boot/initrd.img-3.16.0-4-amd64
> /usr/sbin/grub-probe: error: disk `lvmid/dcqgzj-awwK-OfNY-pVPk-dJNm-pEbM-OfP6VO/xAJ9fS-1bIS-oxAI-VF82-7no4-mrLe-XmNTzC' not found.
> /usr/sbin/grub-probe: error: disk `lvmid/dcqgzj-awwK-OfNY-pVPk-dJNm-pEbM-OfP6VO/xAJ9fS-1bIS-oxAI-VF82-7no4-mrLe-XmNTzC' not found.
> /usr/sbin/grub-probe: error: disk `lvmid/dcqgzj-awwK-OfNY-pVPk-dJNm-pEbM-OfP6VO/xAJ9fS-1bIS-oxAI-VF82-7no4-mrLe-XmNTzC' not found.
> done
> 
> $ sudo grub-mkconfig -o /boot/grub/grub.cfg 
> Generating grub configuration file ...
> Found linux image: /boot/vmlinuz-3.16.0-4-amd64
> Found initrd image: /boot/initrd.img-3.16.0-4-amd64
> /usr/sbin/grub-probe: error: disk `lvmid/dcqgzj-awwK-OfNY-pVPk-dJNm-pEbM-OfP6VO/xAJ9fS-1bIS-oxAI-VF82-7no4-mrLe-XmNTzC' not found.
> /usr/sbin/grub-probe: error: disk `lvmid/dcqgzj-awwK-OfNY-pVPk-dJNm-pEbM-OfP6VO/xAJ9fS-1bIS-oxAI-VF82-7no4-mrLe-XmNTzC' not found.
> /usr/sbin/grub-probe: error: disk `lvmid/dcqgzj-awwK-OfNY-pVPk-dJNm-pEbM-OfP6VO/xAJ9fS-1bIS-oxAI-VF82-7no4-mrLe-XmNTzC' not found.
> done
> 
> I have no logical volume
> lvmid/dcqgzj-awwK-OfNY-pVPk-dJNm-pEbM-OfP6VO/xAJ9fS-1bIS-oxAI-VF82-7no4-mrLe-XmNTzC
> 
> The correct logical volume is
> lvmid/dcqgzj-awwK-OfNY-pVPk-dJNm-pEbM-OfP6VO/bc49d20d-c4b8-4cfb-bd36-16e2c04062e9
> 
> I suspect update-grub and grub-mkconfig are reading the result stored in
> my gpt BIOS boot partition from before I converted the LVM to be RAID-1.
> 
> I still don't have a clue as to how to override grub's intransigence in
> guessing the incorrect LV to boot.
> 
> I am almost desperate enough to try zeroing /dev/sda1 and /dev/sda2
> (my two gpt BIOS boot partitions) in the hopes that once grub can no
> longer access the incorrect information that it wrote there, it might do
> the right thing. But zeroing a partition is something that is the very,
> very last resort. Always :)
> 
> Is there no reasonable solution?
> 
> On Wed, Aug 03, 2016 at 07:52:43PM -0400, Mike DePaulo wrote:
> > This is the answer to a question at PLUG central:
> > 
> > Edit "/etc/default/grub"
> > 
> > My Fedora 24 laptop has the contents:
> > 
> > GRUB_TIMEOUT=5
> > GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
> > GRUB_DEFAULT=saved
> > GRUB_DISABLE_SUBMENU=true
> > GRUB_TERMINAL_OUTPUT="console"
> > GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/root
> > rd.luks.uuid=luks-62c83a70-f5bf-4b20-aab7-78a2b48f3164
> > rd.lvm.lv=fedora/swap rhgb quiet"
> > GRUB_DISABLE_RECOVERY="true"
> > 
> > The option you care about is "rd.lvm.lv". "fedora/root" is the volume
> > group name / logical volume name.
> > 
> > Afterwards, run your command to generate your grub.cfg. This varies
> > based on whether you are in BIOS or UEFI mode.
> > 
> > BIOS mode:
> > grub2-mkconfig -o /boot/grub2/grub.cfg
> > 
> > UEFI mode:
> > A command like this ("fedora" string will differ for your distro):
> > grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
> > ___________________________________________________________________________
> > Philadelphia Linux Users Group         --        http://www.phillylinux.org
> > Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
> > General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
> 
> -- 
> CJ Fearnley                 |   LinuxForce Inc.
> cjf@LinuxForce.net          |   IT Projects & Systems Maintenance
> http://www.LinuxForce.net   |   http://blog.remoteresponder.net
> ___________________________________________________________________________
> Philadelphia Linux Users Group         --        http://www.phillylinux.org
> Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
> General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
> ___________________________________________________________________________
> Philadelphia Linux Users Group         --        http://www.phillylinux.org
> Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
> General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug

-- 
CJ Fearnley                 |   LinuxForce Inc.
cjf@LinuxForce.net          |   IT Projects & Systems Maintenance
http://www.LinuxForce.net   |   http://blog.remoteresponder.net
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug