LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Boot Loader Problem on Slackware64 13.37 (UEFI & GPT disk) (https://www.linuxquestions.org/questions/slackware-14/boot-loader-problem-on-slackware64-13-37-uefi-and-gpt-disk-917864/)

ack_iix 12-09-2011 04:10 AM

Boot Loader Problem on Slackware64 13.37 (UEFI & GPT disk)
 
Hello fellow Slackers,

I just build my new PC with Intel Core i5 CPU and ASRock P67 mainboard, my problem is that the mainboard comes with UEFI and not BIOS. I proceed to create a GPT disk label on my new hard drive and create the partitions. The plan is to dual boot the Slackware64 13.37 with Windows 7 x64. The Slackware installation itself went pretty smooth, no problems found until the boot loader section (lilo won't install).

My question is how could I boot my Slackware64 on this system and specially doing dual boot between Windows and Linux on UEFI system. I've tried building ELILO from source and it failed with message:

Code:

localfs.c:30:17: fatal error: efi.h: No such file or directory
There's no efi.h inside my system and the kernel header file is installed.

Anybody here has experience with this kind of system? Please share your experience on setting up a Slackware64 inside a UEFI box.


Thanks for your reply

bonixavier 12-09-2011 05:24 AM

Use your Slack DVD and boot into the installed partition. There are instructions to do so on the boot screen. When you've logged in, run lilo and write down what kind of errors it throws. I have a UEFI system and I'm using lilo to boot so I wouldn't give up so soon.

Edit: My mainboard apparently has some backwards compatibilities so lilo might not be able to boot your system. Still, telling us exactly what lilo complained about will help.

ack_iix 12-09-2011 08:39 AM

Some More Info
 
Ok, here's some more info about my box...

Disk setup:
Code:

Model: ATA ST3250310AS (scsi)
Disk /dev/sda: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End    Size    File system    Name                          Flags
 1      1049kB  106MB  105MB  fat32          EFI system partition          boot
 2      106MB  240MB  134MB                  Microsoft reserved partition  msftres
 3      240MB  32.5GB  32.3GB  ntfs            Basic data partition
 4      32.5GB  176GB  144GB  ntfs            Basic data partition
 5      176GB  209GB  32.5GB  ext4            Basic data partition
 6      209GB  241GB  32.5GB  ext4            Basic data partition
 7      241GB  250GB  8571MB  linux-swap(v1)  Basic data partition


Model: ATA WDC WD6400AACS-0 (scsi)
Disk /dev/sdb: 640GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End    Size  File system  Name  Flags
 1      1049kB  640GB  640GB  ntfs


Model: ATA WDC WD1002FAEX-0 (scsi)
Disk /dev/sdc: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End    Size    File system  Name  Flags
 1      1049kB  1000GB  1000GB  ext4

lilo.conf configuration:
Code:

boot = /dev/sda
verbose = 1
map = /boot/map
install = menu
menu-scheme = Wb:Yr:Wb:Wb
prompt
timeout = 100
vga = ask

image = /boot/vmlinuz
        label = "Slackware64"
        initrd = /boot/initrd.gz
        root = /dev/sda5
        read-only

And here's the message when I tried to install lilo:
Code:

LILO version 23.2 (released 09-Apr-2011)
  * Copyright (C) 1992-1998 Werner Almesberger  (until v20)
  * Copyright (C) 1999-2007 John Coffman  (until v22)
  * Copyright (C) 2009-2011 Joachim Wiedorn  (since v23)
This program comes with ABSOLUTELY NO WARRANTY. This is free software
distributed under the BSD License (3-clause). Details can be found in
the file COPYING, which is distributed with this software.
Compiled at 19:24:22 on Aug 11 2011

Warning: LBA32 addressing assumed
Reading boot sector from /dev/sda
Using MENU secondary loader
Calling map_insert_data

Boot image: /boot/vmlinuz -> vmlinuz-generic-2.6.38.7
Mapping RAM disk /boot/initrd.gz
The initial RAM disk will be loaded in the high memory above 16M.
Added Slackware64  +  *

Skipping /boot/vmlinuz-2.6.32-1-generic
Skipping /mnt/testsystem/boot/vmlinuz-2.6.26-1-custom
Boot other: /dev/sda1, on /dev/sda, loader CHAIN
Warning: Device 0x0800: Inconsistent partition table, 1st entry
  CHS address in PT:  0:0:1  -->  LBA (0)
  LBA address in PT:  1  -->  CHS (0:0:2)
Fatal: Either FIX-TABLE or IGNORE-TABLE must be specified
If not sure, first try IGNORE-TABLE (-P ignore)

Lilo seems to be installed, at least with some warning - but I still cannot boot from /dev/sda (just blank screen). If lilo can't really work in UEFI box maybe I have to try building ELILO again, any suggestion?

Thanks for your reply

ponce 12-09-2011 09:23 AM

I've not tried to build it myself, but if can be useful, the header file you miss is in the kernel-sources package...

ack_iix 12-09-2011 10:49 PM

Just curious though, is the efi.h header file suppose to reside inside /usr/include/linux from the kernel-headers package? Is the kernel-headers package missing this files, or this is from the Slackware kernel configuration which is not UEFI friendly, though if I'm not mistaken Slackware 13.37 already support UEFI and GPT disks.

Daedra 12-10-2011 02:37 AM

You could try installing windows 7 first and them after that you could install Slackware 13.37, but instead of installing lilo to your MBR you could install it to your root partition. After you've finished installing slackware you could reboot back into windows 7 and use a program called easyBCD (http://neosmart.net/EasyBCD/) and edit your windows boot loadeder to chainload lilo. I use this method myself cause I prefer to keep the windows bootloader on my MBR. I can't guarantee this will work with UEFI but it might be worth a try.

P.S. Even though it says its a commercial program you have to buy, there is a free version, the link is toward the bottom.

ponce 12-10-2011 03:41 AM

Quote:

Originally Posted by ack_iix (Post 4546367)
or this is from the Slackware kernel configuration which is not UEFI friendly, though if I'm not mistaken Slackware 13.37 already support UEFI and GPT disks.

Code:

zcat /proc/config.gz | grep _EFI
CONFIG_EFI=y
# CONFIG_FB_EFI is not set
CONFIG_EFI_VARS=m
CONFIG_EFI_PARTITION=y

I add two links just for reference
http://www.rodsbooks.com/gdisk/booting.html
http://www.rodsbooks.com/efi-bootloaders/index.html

ack_iix 12-10-2011 04:55 AM

easyBCD does not support UEFI
 
Quote:

Originally Posted by Daedra (Post 4546419)
You could try installing windows 7 first and them after that you could install Slackware 13.37, but instead of installing lilo to your MBR you could install it to your root partition. After you've finished installing slackware you could reboot back into windows 7 and use a program called easyBCD (http://neosmart.net/EasyBCD/) and edit your windows boot loadeder to chainload lilo. I use this method myself cause I prefer to keep the windows bootloader on my MBR. I can't guarantee this will work with UEFI but it might be worth a try.

P.S. Even though it says its a commercial program you have to buy, there is a free version, the link is toward the bottom.

This seems a very nice tools indeed, but their FAQ at http://neosmart.net/wiki/display/EBCD/FAQ states that they don't have support for UEFI yet. So I guess my best bet is to compile a new boot loader which support UEFI, I prefer ELILO though - given the configuration is similar to those of LILO. Anybody has experience building ELILO on Slackware64 box?

Thanks for your reply

ack_iix 12-12-2011 11:27 PM

Build ELILO dependency on Slackware64-current
 
I've tried to build ELILO for my desktop box, the build environment is on my notebook with Slackware64-current with Eric's multilib packages installed. It turns out that my journey to build ELILO is more bumpy I had expected.

First, it depends on gnu-efi and I can't build it. I got this when running 'make'
Code:

dwi@lenovo-g470:gnu-efi-3.0 $ make
mkdir -p lib
make -C lib -f ./../lib/Makefile SRCDIR=./../lib ARCH=x86_64
make[1]: Entering directory `/home/dwi/Downloads/pkg/gnu-efi-3.0/lib'
for sdir in ia32 x86_64 ia64 runtime; do mkdir -p $sdir; done
make[1]: *** No rule to make target `boxdraw.o)', needed by `libefi.a'.  Stop.
make[1]: Leaving directory `/home/dwi/Downloads/pkg/gnu-efi-3.0/lib'
make: *** [lib] Error 2

Even trying to build this problematic boxdraw.o (which seems to be the source of problem) results in this:
Code:

dwi@lenovo-g470:lib $ cc boxdraw.c -o boxdraw.o -I ../inc/ -I ../inc/x86_64 -I ../inc/protocol/
/usr/lib64/gcc/x86_64-slackware-linux/4.5.3/../../../../lib64/crt1.o: In function `_start':
/glibc-tmp-63c7c4501b6fab9cd13b90a52f325f14/glibc-2.14.1/csu/../sysdeps/x86_64/elf/start.S:109: undefined reference to `main'
collect2: ld returned 1 exit status

Is that the error message originating from the GLIBC library? I heard the new GLIBC has some bugs, is this a problem with the new GLIBC I'm seeing here? I'll try to build this again on a stock Slackware64-current GLIBC and GCC (non-multilib) when I got home.

Secondly, ELILO needs the binutils which supports efi format binary, the one that comes with Slackware64-current doesn't support this, I'll try to rebuild my binutils later (after I can build gnu-efi)
Code:

objcopy: supported targets: elf64-x86-64 elf32-i386 elf32-x86-64 a.out-i386-linux pei-i386 pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex
Please share your thoughts or experience regarding this.


Thanks

Uzuki 12-13-2011 12:56 AM

Try GRUB instead LILO

ack_iix 12-13-2011 01:37 AM

GRUB doesn't support booting from UEFI system either, and what I'm trying to build is ELILO not LILO - those two are different.

rwebber 01-31-2012 07:13 PM

A way to get UEFI working
 
I have just successfully installed a slightly modified version of Slackware64 13.37 onto an EFI system (actually, on VirtualBox with EFI turned on). I had been following this thread while trying to figure this out, so I am posting here in case anyone else needs this information.

1) I got ELILO by downloading the source, which also contains the compiled .EFI program for X64. I didn't bother recompiling the source, but just used the already compiled program. (I figured that this needs to run BEFORE Slackware gets run, so it doesn't need to be a version that is compiled under Slackware.)

2) Using an existing non-EFI installation of Slackware 64-bit 13.37, I recompiled the HUGE kernel with the EFI Framebuffer support turned on. I made a copy of the Slackware 64-bit install DVD, with a new folder "efi/boot" with the elilo.efi program and a copy of the recompiled huge.s kernel image and the initrd and an elilo.conf to link it all together.

3) The above allowed me to boot the virtual system in EFI mode from the DVD and I got to the normal installation screen. I used gdisk (supplied on the installation DVD) to partition the new virtual hard drive with a 40 Meg partition 1 for EFI, 8 Gig for root linux, 2 Gig for swap. I manually formatted the EFI partition to FAT32, manually created a "efi/boot" folder on the EFI partition, manually copied over elilo, the recompiled huge.s kernel, and the elilo.conf (modified to set root to /dev/sda2).

4) After the manual work, I ran setup and did the normal install. I skipped the LILO installation, since I didn't need it.

5) When installation was done, I rebooted the virtual system and it came up properly in text mode.

The tricky parts of all this was recognizing that I didn't need to recompile the elilo.efi program, but that I did need to recompile the kernel to turn on the EFI Framebuffer support. For a while I was able to boot the system but couldn't see anything. If I typed commands blind, they would work just fine.

It seems that an EFI system does not have normal VGA, or text mode or VESA framebuffer support, but requires the new EFI frame buffer support. It's even worse on VirtualBox because its video mode is not supported by Linux until you load the guest additions from a virtual CD. I suppose that someone with a real EFI system with a real video card that is supported in the kernel might have an easier time of it, though your screen may be black until the kernel finished loading.

I hope this helps someone. It would be nice if the next version of Slackware has the EFI frame buffer turned on, and comes with elilo properly configured.

ack_iix 02-01-2012 08:17 AM

Hello rwebber, thanks for your reply. I've been very busy lately so I haven't got any time to hack my Slackware installation again. I'll try your method this weekend. I also hope the next release of Slackware will be easier to boot in UEFI box :)

ack_iix 04-16-2012 02:17 AM

Slackware64 Install on UEFI System Finally Works!
 
Hello Everyone,

Sorry for bringing up this old thread again, just want to share some info in case somebody wants to install Slackware64 on an UEFI system.

Finally I've successfully configured dual booting Slackware64-current with Windows 7 on my new rig using rEFInd boot manager, the guide is found here: http://www.rodsbooks.com/refind/index.html

Here is my current boot drive setup as a reference:
Code:

Model: ATA ST3250310AS (scsi)
Disk /dev/sda: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End    Size    File system  Name  Flags
 1      1049kB  106MB  105MB  fat32        EFI  boot
 2      106MB  240MB  134MB                Micr  msftres
 3      240MB  54.0GB  53.8GB  ntfs
 4      54.0GB  183GB  129GB  ntfs
 5      183GB  217GB  33.3GB  ext4
 6      217GB  250GB  33.3GB  hfs+

Here's the things necessary for the installation:
I've installed Windows on /dev/sda3 and my UEFI setup already has the 'Windows Boot Loader' entry on my UEFI setup boot selection, and this is how I do it all:
  • I download and compile the Linux 3.3.1 kernel. Linux 3.3 kernel is a MUST as we need the EFI stub loader capability, more explanation can be found here: http://www.rodsbooks.com/efi-bootloaders/efistub.html;
  • Configure the kernel with options CONFIG_EFI_STUB=y, CONFIG_FB_EFI=y, and CONFIG_EFI_VARS=m. Compile it and make Slackware package for the kernel, modules, and firmware. I already had a script that I use to automate building kernel, but the SlackBuild script on Slackware64 source directory will also do fine.
  • I create an USB disk installer for using the uxb-and-pxe installer tools and copy the kernel packages I build above to the USB disk.
  • Restart the PC, boot from the USB pen drive using AHCI mode and run the Slackware64 installer. Booting the Slackware64 installer using UEFI mode will do nothing (the screen just hang on the boot menu).
  • Install Slackware64 as usual, in my setup I use /dev/sda5 for root partition.
  • Do not reboot the system after installation.
  • Copy the self built kernel packages to somewhere in Slackware64 root partition.
  • Do chroot to the Slackware64 root partition and install all the kernel packages.
  • Create a mountpoint for the EFI partition, I created it as /boot/efi and mount the EFI partition (/dev/sda1) there. You can create a fstab entry for this if you wish.
  • Now, here comes the tricky part, to be able to add entry to the system's UEFI NVRAM we must use the efibootmgr tool which can only works if the system is boot from UEFI mode not 'normal' BIOS mode. For me I install rEFInd by renaming Windows EFI boot loader and replace them with rEFInd, please refer to rEFInd installation manual on the "Alternative Naming Options" section. And don't forget to configure the refind.conf too, the html installation guide has the detailed instructions.
  • Reboot the system and you will be greeted with rEFInd boot menu. Boot the Slackware64 (this will boot it in UEFI mode), compile the efibootmgr tool and put the binary in /usr/sbin (it's just one binary).
  • Load the efivars kernel module, proceed to install the rEFInd using the normal method, configure the rEFInd as desired and create entry in UEFI NVRAM using efibootmgr tool.
  • Restore the Windows boot loader to it's default and finally reboot the system. We are now able to launch rEFInd without 'hijacking' Windows EFI loader.

The steps above has a few shortcomings, the first is I cannot boot Slackware64 installer in UEFI mode so to use the efibootmgr tool I have to 'hijack' the Windows EFI loader first, this of course needs a Windows 7 x64 installation which may not present in your environment. If anybody have any idea on booting Slackware64 installer on UEFI mode please share your opinion, I sure hope next Slackware64 release will be able to boot from UEFI :)

The second shortcoming is that you must upgrade the kernel that come with Slackware64, although I guess this might not be a great deal.


That's it, I hope this post will help anybody who's looking to install Slackware64 on UEFI machine.

ruario 06-24-2012 12:26 AM

Quote:

Originally Posted by ack_iix (Post 4548521)
GRUB doesn't support booting from UEFI system either, and what I'm trying to build is ELILO not LILO - those two are different.

This isn't 100% true. Grub legacy (included in Slackware extra) does not support UEFI by default but some distros such as Fedora have a patched version that will work with UEFI. Also Grub2 does support UEFI booting. The Arch Linux wiki has a section on Grub2 with UEFI.

Two other useful reads from their wiki are the UEFI_Bootloaders and Unified Extensible Firmware Interface pages.


All times are GMT -5. The time now is 12:04 PM.