LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Fresh install 64 14.1 with GPT without EFI in a BIOS motherboard (http://www.linuxquestions.org/questions/slackware-14/fresh-install-64-14-1-with-gpt-without-efi-in-a-bios-motherboard-4175484184/)

lupe 11-11-2013 04:31 AM

Fresh install 64 14.1 with GPT without EFI in a BIOS motherboard
 
I partitioned my disk with GPT to be able to play with some alternative operating systems in my spare time, or just if I want to check something in the web with the fastest distro I can find. This way I'm not confined to three OSes.

The problem now resides in the booting process. Lilo (my favorite) doesn't work with GPT, GRUB legacy doesn't either.
Tried elilo, but it complains that there isn't an /efi partition at the beginning of the disk. GRUB 2 also returns an error. I couldn't also install syslinux, although it would be a first one for me with this boot manager.

So, my question: Do I need to create a /efi partition somehow (what size? 2MB?) or can I use elilo or grub to boot from the GPT partitions? If so, how to do it?

ruario 11-11-2013 05:22 AM

You do not need /efi if you are using GPT with BIOS, rather than UEFI. However, if you are using Grub2 with BIOS and GPT you need a "BIOS boot partition" (partition type EF02 in gdisk). In theory this it can be as small as 30 KiB but the general advice on most websites I looked at seems to be that you should make it 1 MiB because future boot loaders might require more space and many modern disk partitioning tools have 1 MiB partition alignment policies. It doesn't matter where on disk this partition is though.

My understanding with regards to the need for "BIOS boot partition" is that Grub2 has a slight size problem when installing on GPT systems under BIOS, due to the lack of post-MBR embed gap on GPT disks. Grub2 sets the first stage of its bootloader to look for a "BIOS boot partition" where it stores a second, bigger file. This second stage file includes support for a large set of filesystems.

An alternative is to use Extlinux (part of the Syslinux package included with Slackware). It is capable of booting ext2/ext3/ext4/btrfs GPT partitions and doesn't need a "BIOS boot partition". Since it supports fewer filesystems, its first stage is still small enough to include ext2+/btrfs support. Of course it still needs to know which partition is the /boot partition and this is done by marking that partition with a special attribute.

For example, presuming that /boot was on /dev/sda you could issue the following from the shell in the install environment:

Code:

# sgdisk /dev/sda --attributes=1:set:2
You can also use sgdisk to confirm it was indeed set correctly:

Code:

# sgdisk /dev/sda --attributes=1:show
1:2:1 (legacy BIOS bootable)

Once done, boot your into local Slackware install via the live media (since you haven't setup the bootloader yet). Slackware's live media boot prompt explains how to boot the installed Slackware system, rather than the install environment.

You can then install extlinux as your bootloader as follows:

Code:

# mkdir -p /boot/extlinux
# extlinux --install /boot/extlinux
# cat /usr/share/syslinux/gptmbr.bin > /dev/sda

(Note: Adjust /dev/sda as is appropriate for your system)

Then all you need is to make a config file. Assuming you wanted a simple boot menu, copy menu.c32 over into the extlinux boot directory as well:

Code:

# cp /usr/share/syslinux/menu.c32 /boot/extlinux/
Finally create a /boot/extlinux/extlinux.conf file along the following lines:

Code:

UI menu.c32
PROMPT 0
MENU TITLE Boot options
TIMEOUT 50
DEFAULT huge

LABEL huge
      MENU LABEL Slackware (Huge)
      KERNEL /boot/vmlinuz-huge-smp-3.10.17-smp
      APPEND root=/dev/sda1 ro

LABEL generic
      MENU LABEL Slackware (Generic)
      KERNEL /boot/vmlinuz-generic-smp-3.10.17-smp
      APPEND root=/dev/sda1 ro
      INITRD /boot/initrd.gz

(Note: Adjust /dev/sda1 and the kernel entries to whatever you use on your system)

Didier Spaier 11-11-2013 05:29 AM

I saw ruario's answer right after posting. The way he proposes is better so just follow it.

ruario 11-11-2013 05:42 AM

If you want to use Grub2, make sure you have a "BIOS boot partition" (partition type EF02 in gdisk) somewhere on disk, of at least 1MiB. Boot your into you Slackware install (use the live media to achieve this) and then issue the following:

Code:

# grub-install --modules=part_gpt /dev/sda
# grub-mkconfig -o /boot/grub/grub.cfg

(Note: Adjust /dev/sda to reflect the partition /boot is actually found)

Be aware however, I have not tested Slackware 14.1 yet, so there might be some reason this does not work.

ruario 11-11-2013 06:04 AM

Just one more thing. I, like you, never got LILO to work with GPT (though I have successfully used Extlinux and Grub2). Nonetheless I have seen volkerdi say the following:

Quote:

Originally Posted by volkerdi (Post 4953488)
I don't think vanilla GRUB1 supports GPT. LILO does, though.

So presumably it is possible. I'm not sure what you and I are doing wrong though.

EDIT: The following is also interesting

Quote:

Originally Posted by Rod Smith
Information on the old Linux Loader (LILO) and GPT is contradictory. Most sources say the two won't get along, but I've read others who opine that the combination does (or at least should) work fine, since LILO uses sector maps to point to the kernel file. My one attempt at this combination proved inconclusive. LILO was able to load and run the kernel, but the boot then failed with the kernel message mount: could not find filesystem '/dev/root'. This message followed messages that indicated that the computer's LVM configuration was working fine, but somehow handing off to the LVM-based root filesystem was a problem. A GRUB boot of this system worked fine.

Taken from: http://www.rodsbooks.com/gdisk/booting.html

jtsn 11-11-2013 06:09 AM

LILO works just fine with GPT. I have a installation with GPT/ESP and a LILO in the PMBR to allow booting on legacy systems as a fallback. What's the issue? Error messages?

ruario 11-11-2013 06:27 AM

I note that the Salix Wiki has a page called, "How to install Salix on a GPT hard drive", where the notes (after a description of how to make GPT partitions with parted) states:

Quote:

11. You'll need to install LILO to the boot partition of your hard drive, not the MBR. So you need to format your /boot partition (or the partition that will include /boot) with a filesystem that is compatible with LILO booting from it (don't use XFS)
12. When prompted to install LILO towards the end of the installation process, select the "Expert" installation mode
13. Select "Begin". Provide any additional options for your system if needed. You don't need any specifically for GPT. Select the screen size. When selecting the target for LILO, select the "Root" option instead of the default "MBR" option. Select the default LILO timeout and boot screen in the following dialogs
14. From the main LILO installation menu, select "Linux". The program will not find any partitions, but you can just type in the one that you want to use (for example: /dev/sda1). Select a name for the partition (for example "Salix" or "Linux")
15. From the main LILO installation menu, add any other Linux or Windows partitions in a similar manner (select the "Windows" option for adding a Windows partition). When done, select the "Install" option
16. Finish the installation and reboot
Perhaps this was my problem. Though it was so long ago since I last tried this, I honestly cannot recall. Some other interesting quotes I found whilst searching include:

wiki.archlinux.org/index.php/GUID_Partition_Table#BIOS_systems

Quote:

GRUB Legacy and LILO do not support GPT.
www.ibm.com/developerworks/linux/library/l-gpt/

Quote:

The still-older Linux Loader (LILO) doesn't explicitly support GPT, but its disk-addressing methods are based on sector locations, so it often does work (in practice).

jtsn 11-11-2013 06:40 AM

Arch Wiki is wrong in that respect. LILO does support GPT as much as it does support LVM or every other partitioning scheme compatible with the FIBMAP ioctl. That's one of the advantages of the KISS approach.

But I found the issue the OP had: LILO works, but liloconfig doesn't detect any GPT partitions, at least on 14.0. Therefore it's Slackware's fault, not LILO's fault. ;)

Salix Wiki's instructions seem to be plain wrong, they don't work.

Solution: Just customize the example lilo.conf, put LILO into the PMBR (it won't boot from anywhere else, because there is no active partition). It will boot Slackware just fine and even chainload other OSes from other partitions, if they are on a different disk using the MBR partition scheme.

This is also the only option, if you must boot a 32 bit kernel from a GPT disk.

ruario 11-11-2013 07:04 AM

Quote:

Originally Posted by jtsn (Post 5062475)
But I found the issue the OP had: LILO works, but liloconfig doesn't detect any GPT partitions, at least on 14.0. Therefore it's Slackware's fault, not LILO's fault. ;)

Cool, thanks for getting to the bottom of that. I'll have to give it a go some time. Though to be honest I very happy with Extlinux as a bootloader for GPT on BIOS devices (or even just plain old MBR and BIOS).

In fact you can set one of the KERNEL lines in the Syslinux config file to point to the /boot/vmlinuz symlink (e.g. the one for huge, since it does not need an initrd). This means that after a kernel upgrade there is no need to issue the equivalent of "lilo", the system can boot straight to the new kernel. This was supposedly the advantage of Grub legacy but Syslinux/Extlinux doesn't have a horrible config file format. The only minor downside is that /boot must reside on an ext2, 3, 4 or btrfs.

jtsn 11-11-2013 07:15 AM

GRUB Legacy can't support GPT, because it requires the no man's land between the MBR and the first partition. This is exactly there the GPT resides (so that "smart" staging concept fired back).

I will look into SYSLINUX/EXTLINUX, it sounds like a great solution. Maybe it's even able to read the kernel normally used by ELILO from the ESP in legacy mode.

That would open an option to streamline the BIOS/UEFI boot process in future Slackware64 releases (As in: Always create a GPT with an ESP, install ELILO and SYSLINUX and then boot Linux with whatever method works on the current system.)

ruario 11-11-2013 07:44 AM

Quote:

Originally Posted by jtsn (Post 5062498)
GRUB Legacy can't support GPT

I was talking thinking about BIOS/MBR setups when doing this comparison. As a side note Fedora made a patch to Grub legacy that added GPT support IIRC.

Quote:

Originally Posted by jtsn (Post 5062498)
I will look into SYSLINUX/EXTLINUX, it sounds like a great solution. Maybe it's even able to read the kernel normally used by ELILO from the ESP in legacy mode.

Extlinux expects an ext2,3,4 (or btrfs) file system (hence the name) but the ESP is fat. Perhaps you could do something with one of the other Syslinux components since they use the same config file format but you would have to have a play around to work this out for yourself.

By the way last time I looked Syslinux were working on adding UEFI support (but had not yet). Perhaps in the future, you could use Syslinux as a single bootloader for all combinations. Granted Grub2 can kinda do this already but it is a Goliath with a horrible config file format.

Didier Spaier 11-11-2013 07:58 AM

Quote:

Originally Posted by ruario (Post 5062514)
By the way last time I looked Syslinux were working on adding UEFI support (but had not yet).

They have. But I didn't try it yet.

Quote:

Perhaps in the future, you could use Syslinux as a single bootloader for all combinations.
That sure will make things simpler, but as far as I can see following what is said on their ML (though I hardly understand 10% of it) we're not quite there.

jtsn 11-11-2013 08:46 AM

Quote:

Originally Posted by ruario (Post 5062514)
Extlinux expects an ext2,3,4 (or btrfs) file system (hence the name) but the ESP is fat.

Indeed, that's there SYSLINUX comes into play. We already have a FAT partition (the ESP), so why don't use it?

Quote:

By the way last time I looked Syslinux were working on adding UEFI support (but had not yet). Perhaps in the future, you could use Syslinux as a single bootloader for all combinations. Granted Grub2 can kinda do this already but it is a Goliath with a horrible config file format.
I currently have a GRUB2 setup, because it's able to chainload .efi boot loaders and saves the default boot selection. Not only the configuration is horrible, the menu looks ugly too. If could replace that with EXTLINUX/SYSLINUX, that would be great. But stable UEFI support and saving the default selection is a requirement.

lupe 11-12-2013 06:45 AM

Quote:

Originally Posted by ruario (Post 5062450)
If you want to use Grub2, make sure you have a "BIOS boot partition" (partition type EF02 in gdisk) somewhere on disk, of at least 1MiB. Boot your into you Slackware install (use the live media to achieve this) and then issue the following:

Code:

# grub-install --modules=part_gpt /dev/sda
# grub-mkconfig -o /boot/grub/grub.cfg

(Note: Adjust /dev/sda to reflect the partition /boot is actually found)

Be aware however, I have not tested Slackware 14.1 yet, so there might be some reason this does not work.

I created a small BIOS boot partition and proceeded as you suggested. It's working fine now. Thank you very much!

ruario 11-12-2013 07:56 AM

Quote:

Originally Posted by lupe (Post 5063116)
I created a small BIOS boot partition and proceeded as you suggested. It's working fine now. Thank you very much!

Cool, glad it worked out! ;)


All times are GMT -5. The time now is 11:02 PM.