Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
grub2 w/ gpt: Failed to get canonical path of `none' SOLVED
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Sat Apr 16, 2016 2:54 pm    Post subject: grub2 w/ gpt: Failed to get canonical path of `none' SOLVED Reply with quote

After some harddisk crash, I am trying to install with GPT (previously it was msdos label).

Can I somehow arrange this with grub2 without a complicated EFI setup? My motherboard is Gigabyte GA-H81MD2V

What I did so far is to use parted to create the label and setup my partitions and formatted some of them with ext4 (not all are formatted yet; all are empty).

I booted from rescueCD, and in order to check whether I can install grub2, I issued the command
Code:
grub2-install /dev/sda
(I checked that the device name sda is correct for the harddisk).
Unfortunately, all I receive is the message
grub2-install /dev/sda wrote:
Installing for i386-pc platform.
grub2-install: error: failed to get canonical path of `none'


Last edited by mv on Wed Apr 20, 2016 4:09 pm; edited 1 time in total
Back to top
View user's profile Send private message
324874
Apprentice
Apprentice


Joined: 26 Jul 2014
Posts: 168

PostPosted: Sun Apr 17, 2016 2:36 pm    Post subject: Reply with quote

Hi mv,

you are at least an advanced user, so, why didn't solve your problem yourself ? :P :wink:

Best regards,

neoptslap
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Sun Apr 17, 2016 3:49 pm    Post subject: Reply with quote

neoptslap wrote:
you are at least an advanced user, so, why didn't solve your problem yourself ? :P :wink:

I suppose that there are people here who already installed a gpt disk (for booting) - I never did, and the only obvious (to me) attempt didn't work as my question shows.
I wanted to know whether my labeling/partitioning makes sense (and can be arranged to boot) before spending many hours/days reinstalling and restoring data from backups (and hopefully still some from the broken disk).

Since nobody replied and I need my computer, I gave up gpt and use my old scheme for using msdos labels although the harddisk is 3TB, and "officially" my method is therefore not documented to work and might break with some future kernel.
Back to top
View user's profile Send private message
324874
Apprentice
Apprentice


Joined: 26 Jul 2014
Posts: 168

PostPosted: Sun Apr 17, 2016 5:40 pm    Post subject: Reply with quote

I warn you that I haven't enough knowledge about the disk partitioning scheme so I advise you to check the information.
mv wrote:
I gave up gpt and use my old scheme for using msdos labels ...

Gentoo Handbook wrote:
To have the disk with MBR layout, use mklabel msdos.

Gentoo Handbook wrote:
When a system's software interface between the operating system and firmware is UEFI (instead of BIOS), GPT is almost mandatory as compatibility issues will arise with MBR here.

Gentoo Handbook wrote:
Some buggy BIOSes or EFIs configured to boot in BIOS/CSM/legacy mode might also have problems with booting from GPT labeled disks. If that is the case, it might be possible to work around the problem by adding the boot/active flag on the protective MBR partition which has to be done through fdisk with the -t dos option to force it to read the partition table using the MBR format.

Gentoo Handbook wrote:
Each partition is limited to 2 TB in size (due to the 32-bit identifiers). Also, the MBR setup does not provide any backup-MBR, so if an application or user overwrites the MBR, all partition information is lost.

So, I conclude your partition scheme isn't correct if you want to use UEFI (cf. handbook). It is possible to use MBR on very large disks but require that the partitions have a size less than 2TB.

Best regards,

neoptslap
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Mon Apr 18, 2016 8:00 am    Post subject: Reply with quote

neoptslap wrote:
I warn you that I haven't enough knowledge about the disk partitioning scheme so I advise you to check the information.

That's why I had asked. However, all information I found says that it is possible to boot gpt with BIOS (using grub2), but no source said how: As mentioned, my straightforward attempt to install grub2 failed.
Quote:
So, I conclude your partition scheme isn't correct if you want to use UEFI

I want to use BIOS since UEFI appeared too complicated for me to setup. Moreover, I know that everything works fine on my machine with BIOS, since the only thing replaced is the harddisk.
Quote:
It is possible to use MBR on very large disks but require that the partitions have a size less than 2TB.

... and if each partition starts below the 2TB boundary, i.e. 4TB is the absolute limit. That's the trick I used previously, although I heard that this is not officially supported: In theory, the next kernel version could calculate modulo 2TB, and who knows what windows does should I ever need it. This was the reason why I considered switching to gpt when I had to reinstall anyway.
Back to top
View user's profile Send private message
324874
Apprentice
Apprentice


Joined: 26 Jul 2014
Posts: 168

PostPosted: Mon Apr 18, 2016 10:02 am    Post subject: Reply with quote

Hi mv,

mv wrote:
I want to use BIOS since UEFI appeared too complicated for me to setup. Moreover, I know that everything works fine on my machine with BIOS, since the only thing replaced is the harddisk.


UEFI and BIOS are both firmwares ! Your machine has UEFI or BIOS ? Most new computers have UEFI software.
If you wanted to replace the BIOS firmware with UEFI firmware I can't help you.

If you want to use UEFI firmware without legacy compatibility mode I might be able to help you.
----- Indeed, approximately, you have to make an EFI partition, create some directories, place some files as the Linux kernel,
----- and do some configurations, that's all ! It isn't complicated and may be easier than using a boot loader.

neoptslap wrote:

mv wrote:
... However, all information I found says that it is possible to boot gpt with BIOS (using grub2), but no source said how ...

Gentoo Handbook wrote:
Using GPT on a BIOS-based computer works, but then one cannot dual-boot with a Microsoft Windows operating system. The reason is that Microsoft Windows will boot in EFI mode if it detects a GPT partition label.

Gentoo Handbook wrote:
... it might be possible to work around the problem by adding the boot/active flag on the protective MBR partition ... to force it to read the partition table using the MBR format.



So, use a system partition software for GPT and add the boot/active flag on the protective MBR partition.
Otherwise, take another drive whose size is less than 2TB (approximately) because of BIOS limitations that will stop you, no choice ! :(
I've read this in a book : "Sometimes, partition's size is restricted to 128 GiB due to BIOS limitations !"

neoptslap wrote:
It is possible to use MBR on very large disks but require that the partitions have a size less than 2TB.

So, I think I was wrong !

Best regards,

neoptslap
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Mon Apr 18, 2016 3:55 pm    Post subject: Reply with quote

neoptslap wrote:
Your machine has UEFI or BIOS?

I am not sure, but I suppose it could already have UEFI.
Quote:
If you want to use UEFI firmware without legacy compatibility mode I might be able to help you.

I would prefer a boot loader which allows me to change and combine kernels, ramdisks, and kernel parameters at boot time.
Quote:
you have to make an EFI partition, create some directories, place some files as the Linux kernel

So my first mistake was to just create the partitions which I wanted. Apparently, I need at least one EFI partition (one for each kernel?).
Quote:
So, use a system partition software for GPT and add the boot/active flag on the protective MBR partition

Does this mean that I will need a hybrid MBR/GPT setup to use grub2? (BTW, the only partition software for GPT which I know is parted.)

None of these 2 options (hybrid GPT or no bootloader at all) are very attractive to me. I think I will stay with my old MBR-only "hack".
Quote:
Otherwise, take another drive whose size is less than 2TB (approximately) because of BIOS limitations that will stop you, no choice !

The hack with starting an extended partition before 2TB and making it 2TB large worked so far (even on several systems). As far as I understand, it is essentially just a question of the linux kernel (and perhaps the grub2 loader in case the kernel lies beyond 2TB), because the kernel has its own driver for the harddisk controller and need not fall back to BIOS.
Back to top
View user's profile Send private message
324874
Apprentice
Apprentice


Joined: 26 Jul 2014
Posts: 168

PostPosted: Mon Apr 18, 2016 4:56 pm    Post subject: Reply with quote

mv,

mv wrote:
I am not sure, but I suppose it could already have UEFI.

Be sure because it's the most important thing to solve this case !

--- topic 1042820 ---
The Doctor wrote:
UEFFI has some really cool toys that come with it. A bootloader for example.
...
Just remember to turn off secure boot.

I believe that if your machine has a firmware based on UEFI you may boot with a GPT partition scheme without problem. :wink:
You have to disable secure boot in the UEFI firmware 's interface and boot with a media that boot "in UEFI mode".

I don't know if it is useful using GPT on a BIOS-based computer ?

Gentoo Handbook wrote:
Using GPT on a BIOS-based computer works, but then one cannot dual-boot with a Microsoft Windows operating system. The reason is that Microsoft Windows will boot in EFI mode if it detects a GPT partition label.

Your main problem is the disk 's size if the machine has a firmware based on BIOS due to BIOS limitations (and maybe because of operating system 's limitations in some cases).

mv wrote:
The hack with starting an extended partition before 2TB and making it 2TB large worked so far (even on several systems). As far as I understand, it is essentially just a question of the linux kernel (and perhaps the grub2 loader in case the kernel lies beyond 2TB), because the kernel has its own driver for the harddisk controller and need not fall back to BIOS.

If it works it could be good !
mv wrote:
I would prefer a boot loader which allows me to change and combine kernels, ramdisks, and kernel parameters at boot time.
...
None of these 2 options (hybrid GPT or no bootloader at all) are very attractive to me. I think I will stay with my old MBR-only "hack".

A firmware based on UEFI may load a bootloader like GRUB so you may keep same functionnalities as previous (see Bootloader / Gentoo Handbook).
mv wrote:

So my first mistake was to just create the partitions which I wanted. Apparently, I need at least one EFI partition (one for each kernel?).
...
Does this mean that I will need a hybrid MBR/GPT setup to use grub2?

You have to adapt your partition scheme to the firmware, not GRUB2 (see Preparing the disks / Gentoo Handbook).

mv wrote:
... Apparently, I need at least one EFI partition (one for each kernel?).

No, there is only one EFI System Partition (ESP) for all kernels. Indeed, the "UEFI" firmware stores some of its data
on this specific partition to increase flexibility and improve management (cf. Unified Extended Firmware Interface specification).

mv wrote:
... who knows what windows does should I ever need it. This was the reason why I considered switching to gpt when I had to reinstall anyway.

I'm not sure I understand because I'm not a native english speaker but if you want to use Windows operating system so
you have to use a GPT partition scheme for recent releases.

Best regards,

neoptslap
Back to top
View user's profile Send private message
324874
Apprentice
Apprentice


Joined: 26 Jul 2014
Posts: 168

PostPosted: Tue Apr 19, 2016 5:42 am    Post subject: Reply with quote

-- edition of my previous post (2016-04-19) --
--------------neoptslap-----------------
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Tue Apr 19, 2016 6:19 am    Post subject: Reply with quote

Thanks a lot for your help; I think that I can figure out the rest.

Just one final (unrelated) question: For external USB hard drives (from which I do not want to boot), can I expect that a recent kernel will be able to read GPT even beyond the 4TB limit on an older machine?
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Tue Apr 19, 2016 10:14 am    Post subject: Reply with quote

I did not read everything.

I used the gentoo handbook, did the stuff as suggested.

I used grub2. and the ubuntu livecd (dvd) disc for installation with sysrescuecd in september.

The uefi thing needs something disabled so you can utilize grub, (secure booting i think)
the initramfs from gentoo needed some tweaking to be bootable for my box, but that depends on your scenario ...

The only drawback for uefi is, everytime you remove the disc, the boot entry is gone for uefi and has to be redone
when you do a mistake in the uefi thing it may forget the boot entry and has to be redone
replug a disc which worked on teh same box wont work, everytime the bootloader has to be redone (uefi limitation which is a bit annoying)

Therefore i have now sysrescue cd next ot me always with the one command to write back the grub2 bootloader to uefi

(grub2-install --efi-directory=/boot/EFI) in my case
Back to top
View user's profile Send private message
324874
Apprentice
Apprentice


Joined: 26 Jul 2014
Posts: 168

PostPosted: Tue Apr 19, 2016 10:22 am    Post subject: Reply with quote

:D

Hi mv,

I know some things I have said may be incomplete and the final result may be very different (see below).

Indeed, I would have liked to have more knowledge about BIOS firmware and UEFI firmware but
I haven't found time yet (cf. the last two posts / topic 1037574).

You may search NeddySeagoon 's posts using author and keywords boxes with the Gentoo forums search utility
about BIOS and UEFI, etc... (because NeddySeagoon 's posts are concise and informative) :!:

mv wrote:
Just one final (unrelated) question: For external USB hard drives (from which I do not want to boot), can I expect that a recent kernel will be able to read GPT even beyond the 4TB limit on an older machine?

wikipedia (english) wrote:
...
The fundamental purposes of the BIOS in modern PCs are to initialize and test the system hardware components, and to load a boot loader or an operating system from a mass memory device.
...
MS Windows NT, Linux, and other protected mode operating systems in general ignore the abstraction layer provided by the BIOS and do not use it after loading, instead accessing the hardware components directly.
...


I just remembered I have experienced an interresting case a few months ago. I was able to boot with
a bootloader located on a usb key detected by the firmware.
Indeed, the internal hard disk drive (hdd) I've used one wasn't suited to the firmware and it hadn't detected.
However, the Linux kernel was able to detect the hdd and I was able to use Gentoo on this computer.

So, I believe you may use an external hdd with GPT to store data (filesystems other the boot filesystem) with a recent Linux kernel.

Best regards,

neoptslap


Last edited by 324874 on Tue Apr 19, 2016 1:01 pm; edited 1 time in total
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Tue Apr 19, 2016 12:50 pm    Post subject: Reply with quote

neoptslap and tw04l124, thank you very much for your help!
Back to top
View user's profile Send private message
kurisu
Tux's lil' helper
Tux's lil' helper


Joined: 19 Jan 2011
Posts: 147
Location: Munich, Germany

PostPosted: Tue Apr 19, 2016 5:29 pm    Post subject: Reply with quote

Appears like you have simply missed to create a small BIOS boot partition with type EF02. Mandatory in that case.

https://wiki.gentoo.org/wiki/GRUB2#BIOS_with_GPT

However, as long as you are not going for secure boot it is not that much of a hassle to switch to EFI. I have been using EFI stub kernels on various boxes for years now without encountering significant issues at all.
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 537
Location: Romania

PostPosted: Tue Apr 19, 2016 9:16 pm    Post subject: Reply with quote

i dont think you need a partition ef02. you would need that if you would have a gpt drive that you want to boot in legacy mode. as in not uefi mode.

in order to boot uefi mode, you need the following.

an efi enabled bios. and efi enabled boot media (gentoo suggests something i am not familiar with - i used an ubuntu image that i dd-ed onto an usb stick). actually booting in efi mode. and finally a gpt drive with an efi partition EF00.

Code:
[root@ana:~]# gdisk /dev/nvme0n1
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.

Command (? for help): p
Disk /dev/nvme0n1: 781422768 sectors, 372.6 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 9EF90B95-7D73-4CF4-9A6A-46D95ABA9DA4
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 781422734
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          206847   100.0 MiB   EF00  efi
   2          206848       105064447   50.0 GiB    8300  gentoo
   3       105064448       209922047   50.0 GiB    AF00  osx
   4       209922048       781422734   272.5 GiB   0700  ten

Command (? for help):


IF you booted in EFI mode of the install media, then command efivar -l should show some results. if it doesn't... then you are not booted in efi mode. but if the command does get you some results, then you are in efi mode.

from that point forward you can use handbooks method to write kernel directly to efi partition (which i dont like) or use grub to load kernel. as you are trying.

this is the background of the story as i understand it. now, in the case of the original poster, i am not clear if he is booted in efi mode or not. nor am i clear if his grub is compiled with x86_64-efi support. so compile grub with x86_64-efi support and try again. if that doesn't work, try grub2-install --target=x86_64-efi. in this scenario, the efi partition should be mounted on /boot/efi. and should be like the one posted by me. if that doesn't work play with grub2-install --target=x86_64-efi --efi-directory=/boot. but in this scenario, you already made something wrong.

will pay close attention to your reply.

EDIT: when system is properly setup, you can call grub2-install sda and everything _IS_ done automatically. if the conditions explained before are met.

[root@ana:~]# grub2-install /dev/nvme0n1
Installing for x86_64-efi platform.
Installation finished. No error reported.
Wed Apr 20 - 00:21:17


PS i mean without arguments. grub2-install /dev/sda should have worked if everything else was in order.
Back to top
View user's profile Send private message
324874
Apprentice
Apprentice


Joined: 26 Jul 2014
Posts: 168

PostPosted: Wed Apr 20, 2016 8:02 am    Post subject: Reply with quote

Hi,

Quote:

kurisu wrote:
Appears like you have simply missed to create a small BIOS boot partition with type EF02. Mandatory in that case.
...
... is not that much of a hassle to switch to EFI. I have been using EFI stub kernels on various boxes for years now without encountering significant issues at all.

axl wrote:
i dont think you need a partition ef02. you would need that if you would have a gpt drive that you want to boot in legacy mode. as in not uefi mode.
...
... now, in the case of the original poster, i am not clear if he is booted in efi mode or not ...


( ... ) ("answer" below)
Quote:

mv wrote:
...
I suppose that there are people here who already installed a gpt disk (for booting) - I never did, and the only obvious (to me) attempt didn't work as my question shows.
I wanted to know whether my labeling/partitioning makes sense (and can be arranged to boot) before spending many hours/days reinstalling and restoring data from backups (and hopefully still some from the broken disk).
...

The Doctor (in his signature) wrote:
First things first, but not necessarily in that order.


The first thing, here, is to know how to proceed. mv has said something and we have to know how to proceed.
Otherwise, we may take a wrong path.

Quote:

kurisu wrote:
https://wiki.gentoo.org/wiki/GRUB2#BIOS_with_GPT

Gentoo wiki / Grub2 (bios with gpt)
Gentoo wiki / Hybrid partition table

Thank you very much, kurisu ! It's a good reference. axl, your work is good too but I think mv will be able to follow the handbook.

N.B : I did some mistakes. I need more trainings !

Best regards,

neoptslap
Back to top
View user's profile Send private message
324874
Apprentice
Apprentice


Joined: 26 Jul 2014
Posts: 168

PostPosted: Wed Apr 20, 2016 2:42 pm    Post subject: Reply with quote

My mistakes were ...

1. ...
neoptslap wrote:
...
So, use a system partition software for GPT and add the boot/active flag on the protective MBR partition.
...

neoptslap wrote:
mv wrote:
... although the harddisk is 3TB ...

neoptslap wrote:
I've read this in a book : "Sometimes, partition's size is restricted to 128 GiB due to BIOS limitations !"

neoptslap wrote:
5 x 128 < 2TB ([5 partitions]

... take another drive whose size is less than 2TB (approximately) because of BIOS limitations...

1. My mistakes, here, was to make a generalization.
Gentoo Handbook wrote:
... Some buggy BIOSes or EFIs configured to boot in BIOS/CSM/legacy mode ...

neoptslap wrote:

... partition <128GiB (some BIOS)
...
mv wrote:
neoptslap wrote:
... It is possible to use MBR on very large disks but require that the partitions have a size less than 2TB.

... and if each partition starts below the 2TB boundary, i.e. 4TB is the absolute limit ... although I heard that this is not officially supported ...
... This was the reason why I considered switching to gpt when I had to reinstall anyway.

neoptslap wrote:
3TB < 4TB (maybe, it could be work with the hard disk if there aren't another limitations)

neoptslap wrote:
If the BIOS isn't buggy so we can use GPT without adding the boot/active flag on the protective MBR partition and maybe there aren't limitations (OS, bootloader).
... no hybrid partition table (MBR/GPT)



2. ...
neoptslap wrote:
You have to adapt your partition scheme to the firmware, not GRUB2

2. My mistake, here, was to think that if the first element (the firmware) of the association (firmware + boot loader) was incorrect [1]
then the association was incorrect and therefore I could say that the second element (the bootloader) was unimportant
(= correct or incorrect, regardless). However, there are other combination and the "value" [1] of the second element (bootloader) may be of importance.


[1] ... in a comparison to the partitioning scheme.

The next time I will do better because correct errors may be hell. :roll:

Best regards,

neoptslap
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Wed Apr 20, 2016 4:17 pm    Post subject: Reply with quote

Again thanks a lot. I can really figure out the rest.

In the moment I hope that I can save huge parts of my original data (which was not all backed up) by cloning sectorwise (although it will take about 30 days...), and for this reason I must currently keep my original hack anyway until this is finished. Probably, I will be afraid to repartition later on when everything is full of data, but it is good that I understood now how to do it correctly next time...
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 537
Location: Romania

PostPosted: Wed Apr 20, 2016 7:01 pm    Post subject: Reply with quote

mv wrote:
but it is good that I understood now how to do it correctly next time...


had to be done. i'm pretty sure bios will become obsolete in the years that follow.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum