Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Asus P9D WS, efi, lvm, cryptsetup, grub-legacy boot
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
kernelOfTruth
Watchman
Watchman


Joined: 20 Dec 2005
Posts: 6108
Location: Vienna, Austria; Germany; hello world :)

PostPosted: Sat May 17, 2014 6:55 pm    Post subject: Asus P9D WS, efi, lvm, cryptsetup, grub-legacy boot Reply with quote

Hi guys,


could you please give me some pointers on how to get gentoo to boot on this configuration ?

it'll be a

Asus P9D WS + Xeon E3-1245V3


migrating from this BIOS-based motherboard/box would be nice but I believe it won't be that easy


the 2 entries in the gentoo wiki don't really seem to help as far as I can see:

http://wiki.gentoo.org/wiki/UEFI_Gentoo_Quick_Install_Guide
http://wiki.gentoo.org/wiki/EFI_stub_kernel

I'm still in the process of building the rig right now but the path of putting it into service

should be as fast, easy and painless as possible (== efficient)



current partitioning (GTP layout, bios only sees 800 GB but it boots :twisted: ) - simplified is:

1) 200 MB (reserved for efi)
2) 1 GB (boot)
3) 75 GB (cryptsetup + lvm, root, swap and portae)
4) around 2.5 TB (crypsetup, data)


would it be realistic to simply set up the efi partition and roll with it and grub-legacy ?

if yes, some examples and steps would be nice to know - never had any contact with (U)EFI :oops:



Many thanks in advance :)



edit:

found the following: http://www.thinkwiki.org/wiki/Installing_Gentoo_on_a_ThinkPad_X220 , http://superuser.com/questions/587321/migrate-from-mbr-to-uefi-with-an-encrypted-system-partition?rq=1


not sure if it'll be enough with additional on booting from efi with lvm + cryptsetup (still searching) ...


edit2:

ok, luckily there's an option to disable Secure Boot: [Other OS]

http://www.manualslib.com/manual/594333/Asus-P9d-Ws.html?page=115


edit3:

interesting: http://www.schnatterente.net/software/gentoo-linux-komplett-verschluesseln

only no word about efi :?
_________________
https://github.com/kernelOfTruth/ZFS-for-SystemRescueCD/tree/ZFS-for-SysRescCD-4.9.0
https://github.com/kernelOfTruth/pulseaudio-equalizer-ladspa

Hardcore Gentoo Linux user since 2004 :D
Back to top
View user's profile Send private message
djdunn
l33t
l33t


Joined: 26 Dec 2004
Posts: 780
Location: Arrakis

PostPosted: Sat May 17, 2014 7:41 pm    Post subject: Reply with quote

well

first thing, you probably need to disable secureboot, it would be a long post ill spare you, but in my technical opinion its worthless

you dont seem to want to use grub2, i dont blame you on that,

this is what i would do if i was you, and it doesnt require any fancy booting with efi stub or booting with an already efi booting rescuedisk. some tools like grub2 require the use of the tools to edit the uefi menus to pont the menu entry to the .efi binary, the menu where you hit F8 while booting to choose which disk you want to boot

my new favorite bootloader since grub2 annoyed me is syslinux here are some quick and easy steps

step 1, using gdisk or favorite disk tool make sure your efi partition is type code EF00 for EFI system,

step 2, make sure EFI partition is formatted FAT32, this is essential for making UEFI work

step 3, booted with any rescue disk, when you are inside the chroot on the bootloader steps in the gentoo handbook, install syslinux version 6 or higher, at the time of writing this its masked so you will have to add it to your package keywords file

step 4, after compling and installing syslinux copy the contents of this directory /usr/share/syslinux/efi64 to /boot/efi/boot/

step 5, inside the directory /boot/efi/boot rename syslinux.efi to bootx64.efi, this name bootx64.efi and directory /boot/efi/boot is the uefi default boot directory and efi binary name so you dont have to be already booted in uefi mode

step 6, required changes to kernel config, EFIVAR_FS=y or EFI_VARS=y (the latter was depriciated and designed for efi not uefi but either would work i suggest EFIVAR_FS though , EFI_PARTITION (gpt disk support, keep MSDOS support too or usb disks or portable hard drives wont work), FB_EFI=y (for efi framebuffer support), RELOCATABLE=y (for relocatable kernel, might not be necessary but i kinda remember having to for some reason)

step 7, edit /boot/efi/boot/syslinux.cfg

Code:
DEFAULT gentoo
TIMEOUT 100 
UI vesamenu.c32
MENU RESOLUTION 1920 1080
MENU TITLE Welcome to IRIS

LABEL gentoo
        MENU LABEL Gentoo Linux AMD64 3.14.4
        LINUX ../../vmlinuz-3.14.4
        APPEND root=ZFS=tank/root/gentoo gpt dozfs=force keymap=dvorak iommu=pt ro
        INITRD ../../initramfs-genkernel-x86_64-3.14.4

the above is my syslinux.cfg, you can see i changed the resolution to 1080p I have my kernels installed in /boot/ so because of this i point the menu to ../../vmlinuz-3.14.4 it starts from /boot/efi/boot so ../../ to say up the file is two directories higher, you can see the append where i pass kernel settings to the kernel and initrd line where i tell it to use an initrd. simple stuff

finish up with the handbook and if you wish you can do luks or lvm or whatever, just make your initramfs like normal pass the kernel the correct settings for luks or lvm or raid or whatever advanced booting options you require,
_________________
A process cannot be understood by stopping it. Understanding must move with the flow of the process, must join it and flow with it.

-The First Law of Mentat
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Sat May 17, 2014 8:01 pm    Post subject: Reply with quote

kernelOfTruth ...

My advice would be to avoid grub (both legacy and grub2) and use rEFInd. I'd also place 'data' within the primary luks volume and make it an lv, this way only one volume needs decrypting (which can be done via the initramfs). I'd get rid of /boot and use the ESP (EFI System Partition) to store kernels, initramfs, etc ... its 200mb, more than enough. rEFInd will automatically detect any kernel so no need for any configuration (unless you need to provide kernel parameters in which case a 'refind_linux.conf' in the root of the ESP (along with the kernel) can be used.

Also, for initramfs I'd suggest better-initramfs ... it supports LVM, LUKS, suspend (using either TuxOnIce or uswsusp), dropbear (and rescueshell over ssh), rescueshell (busybox), UUID/LABEL, etc. The best thing is it doesn't need rebuilt on each kernel update ...

So ... here is how the above looks here:

Code:
# gdisk -l /dev/sda |grep "^Number" -A 2
Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640       625142414   297.9 GiB   8300  Linux filesystem
# cryptsetup isLuks /dev/sda2 ; echo $?
0
# ls /dev/mapper
control  enc_root  vg-home  vg-root  vg-swap  vg-var
# mount /boot && ls /boot
efi/  refind_linux.conf  vmlinuz-3.13.11-ck.efi
# cat /boot/refind_linux.conf
"Boot softlevel default"  "ro nopat threadirqs acpi_backlight=vendor rootfstype=ext4 luks enc_root=/dev/sda2 lvm root=/dev/mapper/vg-root swsusp resume=/dev/mapper/vg-swap"
"Boot softlevel single"   "ro nopat threadirqs acpi_backlight=vendor rootfstype=ext4 luks enc_root=/dev/sda2 lvm root=/dev/mapper/vg-root swsusp resume=/dev/mapper/vg-swap softlevel=single"
# modprobe efivars && efibootmgr -v
BootCurrent: 0000
Timeout: 5 seconds
BootOrder: 0000
Boot0000* rEFInd   HD(1,28,64000,a5d32078-64a7-4c13-a0f1-1286c2f6422b)File(\efi\refind\refind_ia32.efi)
# awk '!/#/ && /(RELOCATABLE|EFI)/' /usr/src/linux/.config
CONFIG_EFI_PARTITION=y
CONFIG_EFI=y
CONFIG_EFI_STUB=y
CONFIG_RELOCATABLE=y
CONFIG_EFI_VARS=m
# history 0 | grep 'efibootmgr --create'
  112  efibootmgr --create --part 1 --label "rEFInd" --loader "\efi\refind\refind_ia32.efi"

Finally, you will need a bootdisk that supports efivars in order to '--create' the entry in efi ... you can use sysresuecd which supports 64bit efi.

Any questions just ask ...

best ... khay

edit, if you're wondering where there initramfs.cpio.gz is, I build it into the kernel.
Back to top
View user's profile Send private message
kernelOfTruth
Watchman
Watchman


Joined: 20 Dec 2005
Posts: 6108
Location: Vienna, Austria; Germany; hello world :)

PostPosted: Sun Jun 01, 2014 9:20 am    Post subject: Reply with quote

djdunn and khayyam - thank you so much for your fast answers :D

djdunn,

I had literally tried for days to get syslinux to work,

at first there were some problems with getting it work with UEFI to display there at all,

there was an entry linking to it

but the only thing I could achieve in this regard was a black screen and nothing more.

Meanwhile I know this could have been related to not using KMS drivers compiled in (which I now do, which makes things magnitudes easier)

but I doubt it.

So I resorted to using grub2 for the moment and using the migration guides from the gentoo wiki by using the old entries

in grub.conf, menu.lst - since the initramfs-Detection doesn't seem to work (there are NO entries :( , could be related to my "exotic" naming style for the kernels

and genkernel but nevertheless - why such hassle ?)

Syslinux is still on my "to-do" or "try-out" list,

until I have more time (approx. 1 month from now) - I'll stay with grub2



khayyam,

thanks for mentioning rEFInd !

I've been intending for some time now to move away from genkernel to other options

since there have been some issues in the recent past with it irregularly.


TuxOnIce-support would been nice, UUID/Label support appears pretty attractive,

the most among these the need for NOT needing to constantly rebuild the entire initramfs with each (minor or major) kernel update

A real energy & time saver ! :)



A general question to both of you or whoever else reads this:

Once temporarily disabling the harddrives in the UEFI bios and re-enabling it (e.g. for installing Windows on other harddrives)

why does the grub2/gentoo entry always disappears ?

The consequence is that it has to be re-added (booting into sysrescuecd) in UEFI mode and grub2-install --target=x86_64-efi


Thank you very much :mrgreen:



References:
(for myself and others following on that path)

Grub2:

http://wiki.gentoo.org/wiki/GRUB2_Quick_Start

http://wiki.gentoo.org/wiki/GRUB2_Migration

http://wiki.gentoo.org/wiki/GRUB2

http://wiki.gentoo.org/wiki/GRUB2/Config_Variables


E/Lilo:

http://gentoo-en.vfose.ru/wiki/UEFI#ELILO
http://gentoo-en.vfose.ru/wiki/UEFI
http://wiki.gentoo.org/wiki/LILO
https://wiki.archlinux.org/index.php/Lilo

Syslinux:

https://wiki.archlinux.org/index.php/Syslinux

UEFI:

https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface


related commands:

mount -t efivarfs efivarfs /sys/firmware/efi/efivars

mount -t proc proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev

grub2-install --target=x86_64-efi



Quote:
parted /dev/sda
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: ATA INTEL SSD (scsi)
Disk /dev/sda: 180GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 2097kB 212MB 210MB fat32 boot
2 212MB 528MB 317MB reiserfs
3 528MB 75.2GB 74.7GB
4 75.2GB 180GB 105GB reiserfs

(parted) q




note that the first partition starts with 2 MB - so there's 2 MB of free space before (a security measure in case grub needs to embed itself there)


Quote:
gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.8

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/sda: 351651888 sectors, 167.7 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 351651854
Partitions will be aligned on 2048-sector boundaries
Total free space is 4077 sectors (2.0 MiB)

Number Start (sector) End (sector) Size Code Name
1 4096 413695 200.0 MiB EF00
2 413696 1032191 302.0 MiB 0700
3 1032192 146851839 69.5 GiB 0700
4 146851840 351651839 97.7 GiB 0700



the first partition, the EFI System Partition gets the EF00 flag by simply enabling the "boot" flag on it - the prerequisite is, that you've booted in (U)EFI mode into the live system
_________________
https://github.com/kernelOfTruth/ZFS-for-SystemRescueCD/tree/ZFS-for-SysRescCD-4.9.0
https://github.com/kernelOfTruth/pulseaudio-equalizer-ladspa

Hardcore Gentoo Linux user since 2004 :D
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Sun Jun 01, 2014 11:29 am    Post subject: Reply with quote

kernelOfTruth wrote:
A general question to both of you or whoever else reads this:

Once temporarily disabling the harddrives in the UEFI bios and re-enabling it (e.g. for installing Windows on other harddrives) why does the grub2/gentoo entry always disappears? The consequence is that it has to be re-added (booting into sysrescuecd) in UEFI mode and grub2-install --target=x86_64-efi

kernelOfTruth ... I can't say for sure but I imagine the UEFI bios is removing grub from efivars so its nolonger available, re-running grub-install then calls 'efibootmgr' which adds it back.

best ... khay
Back to top
View user's profile Send private message
kernelOfTruth
Watchman
Watchman


Joined: 20 Dec 2005
Posts: 6108
Location: Vienna, Austria; Germany; hello world :)

PostPosted: Sun Jun 01, 2014 7:01 pm    Post subject: Reply with quote

thanks khay,


the strange thing is that this doesn't happen for the windows boot manager (or what its name is) entry

so grub might do things differently than windows

UEFI might be comfy to work with - but it's buggy and stuff doesn't always work as intended :o
_________________
https://github.com/kernelOfTruth/ZFS-for-SystemRescueCD/tree/ZFS-for-SysRescCD-4.9.0
https://github.com/kernelOfTruth/pulseaudio-equalizer-ladspa

Hardcore Gentoo Linux user since 2004 :D
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Sun Jun 01, 2014 9:08 pm    Post subject: Reply with quote

kernelOfTruth wrote:
thanks khay, the strange thing is that this doesn't happen for the windows boot manager (or what its name is) entry

kernelOfTruth ... you're welcome. You should keep in mind that where the "brand" efi implimentation is concerned it probably has no other consideration than booting windows.

kernelOfTruth wrote:
UEFI might be comfy to work with - but it's buggy and stuff doesn't always work as intended :o

UEFI is just a specification, it has many implimentations (some better than others), so it really comes down to exactly which firmware the board has.

best ... khay
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