Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
UEFI - boot freezes before initrd [SOLVED]
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Mon Sep 10, 2018 3:34 pm    Post subject: UEFI - boot freezes before initrd [SOLVED] Reply with quote

I'm out of ammunition here.
I've given so many tries and hours to this. I bet it's something simple, but I'm blind to the solution in front of my eyes right now.

  • rEFInd and grub can load the kernel
  • ... but may not be able to load initrd
  • ... because after printing text where initrd is being loaded the process freezes
  • None of the keyboard leds flash in indication of kernel panic
  • at least my USB keyboard seems to shut down; backlit shuts off and I cannot do anything with it
  • The way "out" is cold reset
  • No error messages

It's the last bit what makes this so frustrating.
I'm guessing the process freezes at initrd loading, becuase when linuxrc is being run from initrd normally you see some boot output on screen.

grep -Ei '^(# )?CONFIG.*_u?efi_' .config; # Click for full output:
CONFIG_EFI_PARTITION=y
CONFIG_EFI_STUB=y
CONFIG_EFI_MIXED=y
CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y
CONFIG_EFI_VARS=y
CONFIG_EFI_ESRT=y
CONFIG_EFI_VARS_PSTORE=m
CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE=y
CONFIG_EFI_RUNTIME_MAP=y
# CONFIG_EFI_FAKE_MEMMAP is not set
CONFIG_EFI_RUNTIME_WRAPPERS=y
CONFIG_EFI_BOOTLOADER_CONTROL=y
# CONFIG_EFI_CAPSULE_LOADER is not set
# CONFIG_EFI_TEST is not set
# CONFIG_EFI_DEV_PATH_PARSER is not set
# CONFIG_EFI_PGT_DUMP is not set


System is amd64 (stable) and kernel is linux-4.14.65-gentoo.

I'll pastebin more info if requested.

Thanks in advance!
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!


Last edited by Zucca on Tue Sep 18, 2018 5:57 pm; edited 1 time in total
Back to top
View user's profile Send private message
Marlo
Veteran
Veteran


Joined: 26 Jul 2003
Posts: 1591

PostPosted: Mon Sep 10, 2018 4:21 pm    Post subject: Reply with quote

I am not a specialist Zucca,

But have you already tried?
Comment out
# Copy all kernel modules to the ramdisk
# ALLRAMDISKMODULES = "1"

# Build the generated initramfs into the kernel instead of
# keeping it as a separate file
# INTEGRATED_INITRAMFS = "1"

Clean up:
CONFIG_INITRAMFS_SOURCE = "/ tmp / genkernel / initramfs-4.14.65-gentoo-wren.cpio"
CONFIG_INITRAMFS_ROOT_UID = 0
CONFIG_INITRAMFS_ROOT_GID = 0

greetings
Ma.
_________________
------------------------------------------------------------------
http://radio.garden/
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Mon Sep 10, 2018 4:44 pm    Post subject: Reply with quote

Thanks for the reply.

Yes. I have tried with seperate initrd. The result is same as I mentioned in the first post. With built-in initrd the message telling initrd is being loaded don't show, as expected, but the freeze symptons are exactly the same: after short period of time keyboard backlight shuts off and that's it.
Gentoo install media boots just fine. So I think I just have something wrong in my configs.

I'm quite certain nothing inside initrd gets run because I'm getting no additional text on the screen.

I checked my server .config and it's the same with all the EFI settings, except for few extra ones (that aren't available on the server kenel) are unset on this PC I'm trying to boot.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Marlo
Veteran
Veteran


Joined: 26 Jul 2003
Posts: 1591

PostPosted: Mon Sep 10, 2018 5:05 pm    Post subject: Reply with quote

For me the refind configuration is without initrd. Refind boots only the kernel.
Are you sure the grub.cfg contains the initrd line?

Do you have an older .config for your system? To compare with the current one.

Ma
_________________
------------------------------------------------------------------
http://radio.garden/
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Mon Sep 10, 2018 5:51 pm    Post subject: Reply with quote

The earlier .config was from BIOS booting kernel.

I've quadruple checked: initrd file at least starts to load into ram. At which point it freezes, I cannot say. I've gotten no error messages ever while this issue has been going.

I also can have both, grub and refind installed at the same time. To change the loader I just need to select one from the UEFI boot menu.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Marlo
Veteran
Veteran


Joined: 26 Jul 2003
Posts: 1591

PostPosted: Mon Sep 10, 2018 6:46 pm    Post subject: Reply with quote

Zucca wrote:
To change the loader I just need to select one from the UEFI boot menu.


Yes I know, I have the same setting.

I quickly installed the kernel Linux 4.14.65-gentoo-wren with your .config.

I have made small changes. And from the grubmenue he boots fine. :D

Code:
Generic Driver Options
[ ] Support for uevent helper 
 -*- Maintain a devtmpfs filesystem to mount at /dev                                                                                                                                                         │ │ 
[ ]   Automount devtmpfs at /dev, after the kernel mounted the rootfs                                                                                                                                       │ │ 
[*] Select only drivers that don't need compile-time external firmware                                                                                                                                      │ │ 
[*] Prevent firmware from being built                                                                                                                                                                       │ │ 
-*- Userspace firmware loading support                                                                                                                                                                      │ │ 
[*]   Include in-kernel firmware blobs in kernel binary                                                                                                                                                     │ │ 
(amd-ucode/microcode_amd_fam17h.bin amd-ucode/microcode_amd_fam17h.bin.asc amdgpu/polaris11_ce.bin amdgpu/polaris11_k_smc.bin amdgpu/polaris11_mc.bin amdgpu/polaris11_me.bin amdgpu/polaris11_mec2.bin     │ │ 
(/lib/firmware/) Firmware blobs root directory                                                                                                                                                              │ │ 
[ ] Fallback user-helper invocation for firmware loading                                                                                                                                                    │ │ 
[*] Allow device coredump                                                                                                                                                                                   │ │ 
[ ] Driver Core verbose debug messages                                                                                                                                                                      │ │ 
[ ] Managed device resources verbose debug messages                                                                                                                                                         │ │ 
[ ] Test driver remove calls during probe (UNSTABLE)                                                                                                                                                        │ │ 
< > Build kernel module to test asynchronous driver probing                                                                                                                                                 │ │ 
[ ] Enable verbose DMA_FENCE_TRACE messages



Code:

<*> /dev/agpgart (AGP Support)  --->                                                                                                                                                                        │ │ 
[*] VGA Arbitration                                                                                                                                                                                         │ │ 
(3)   Maximum number of GPUs                                                                                                                                                                                │ │ 
[ ] Laptop Hybrid Graphics - GPU switching support                                                                                                                                                          │ │ 
<*> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)  --->                                                                                                                                   │ │ 
[*] Allow to specify an EDID data set instead of probing for it                                                                                                                                             │ │ 
I2C encoder or helper chips  --->                                                                                                                                                                       │ │ 
< > ATI Radeon                                                                                                                                                                                              │ │ 
<M> AMD GPU                                                                                                                                                                                                 │ │ 
[ ]   Enable amdgpu support for SI parts                                                                                                                                                                    │ │ 
[ ]   Enable amdgpu support for CIK parts                                                                                                                                                                   │ │ 
[*]   Always enable userptr write support                                                                                                                                                                   │ │ 
[*]   Allow GART access through debugfs                                                                                                                                                                     │ │ 
ACP (Audio CoProcessor) Configuration  --->                                                                                                                                                             │ │ 
< > Nouveau (NVIDIA) cards                                                                                                                                                                                  │ │ 
< > Intel 8xx/9xx/G3x/G4x/HD Graphics                                                                                                                                                                       │ │ 
< > Virtual GEM provider                                                                                                                                                                                    │ │ 
< > DRM driver for VMware Virtual GPU                                                                                                                                                                       │ │ 
< > Intel GMA5/600 KMS Framebuffer                                                                                                                                                                          │ │ 
< > DisplayLink                                                                                                                                                                                             │ │ 
< > AST server chips                                                                                                                                                                                        │ │ 
< > Kernel modesetting driver for MGA G200 server engines                                                                                                                                                   │ │ 
<M> Cirrus driver for QEMU emulated device                                                                                                                                                                  │ │ 
< > QXL virtual GPU                                                                                                                                                                                         │ │ 
< > DRM Support for bochs dispi vga interface (qemu stdvga)                                                                                                                                                 │ │ 
<M> Virtio GPU driver                                                                                                                                                                                       │ │ 
Display Panels  ----                                                                                                                                                                                    │ │ 
 Display Interface Bridges  --->                                                                                                                                                                         │ │ 
< > HSA kernel driver for AMD GPU devices                                                                                                                                                                   │ │ 
<M> DRM Support for Hisilicon Hibmc                                                                                                                                                                         │ │ 
< > Support for simple displays  ----                                                                                                                                                                       │ │ 
[ ] Enable legacy drivers (DANGEROUS)  ----                                                                                                                                                                 │ │ 
Frame buffer Devices  --->                                                                                                                                                                              │ │ 
-*- Backlight & LCD device support  --->                                                                                                                                                                    │ │ 
Console display driver support  --->                                                                                                                                                                    │ │ 
[*] Bootup logo  --->


These changes were necessary for my machine.
But a boot brought exactly the problems described by you.

So I adjusted these two points:
Code:

[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support                                                                                                                                          │ │ 
()    Initramfs source file(s)

Code:

   [ ] Built-in kernel command line


And the kernel boots perfectly.

Ma.

EDIT: The kernel boots from refind and grub.
_________________
------------------------------------------------------------------
http://radio.garden/
Back to top
View user's profile Send private message
Marlo
Veteran
Veteran


Joined: 26 Jul 2003
Posts: 1591

PostPosted: Mon Sep 10, 2018 7:10 pm    Post subject: Reply with quote

josef.95 showed me this little helper tool to check the kernel config.
Some ebuild developers write in the ebuilds what requirement they need to the kernel. This tool checks that.
Download it, change the name e.g. kernel-config-check.py. Make it executable.
Start with "./kernel-config-check.py" or with "python kernel-config-check.py".

Thanks again to josef.95
_________________
------------------------------------------------------------------
http://radio.garden/
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Mon Sep 10, 2018 7:40 pm    Post subject: Reply with quote

Big thanks. :)
I'll test your adjustments probably tomorrow. This bad flu is is now pulling me into bed.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
skellr
l33t
l33t


Joined: 18 Jun 2005
Posts: 975
Location: The Village, Portmeirion

PostPosted: Mon Sep 10, 2018 8:46 pm    Post subject: Reply with quote

I would decompress the initrd, try to chroot into it, and run the init script to see what happens.
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Wed Sep 12, 2018 7:18 pm    Post subject: Reply with quote

Marlo wrote:
So I adjusted these two points:
Code:

[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support                                                                                                                                          │ │ 
()    Initramfs source file(s)

Code:

   [ ] Built-in kernel command line


And the kernel boots perfectly.

Ma.

EDIT: The kernel boots from refind and grub.
On my setup both fail. :( Same no-error as before.
It's Strange that his machine booted just fine from BIOS. But as Gentoo Live can boot just fine, then it must be something on my configs.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
jonathan183
Guru
Guru


Joined: 13 Dec 2011
Posts: 318

PostPosted: Wed Sep 12, 2018 8:20 pm    Post subject: Reply with quote

What do you need initrd for ? have you tried setting up the kernel to build your own custom initrd something alone these lines ?
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2007

PostPosted: Thu Sep 13, 2018 10:08 am    Post subject: Reply with quote

Zucca, do you know if your screen driver is working correctly? On my first meeting with UEFI I had problems with the screen going black and the keyboard dying. I turned out to be the transition from whichever framebuffer was in use during the initial boot and the AMDGPU driver. AFAIR The second one was missing its firmware, but I couldn't see because the messages didn't get to the screen, and logging hadn't started yet. I think I found the messages lurking in pstore (which I think all UEFI setups have, but you need the appropriate configuration in the kernel), but that might have been my problems with hibernate.
_________________
Greybeard
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Thu Sep 13, 2018 7:25 pm    Post subject: Reply with quote

Goverp wrote:
Zucca, do you know if your screen driver is working correctly? On my first meeting with UEFI I had problems with the screen going black and the keyboard dying. I turned out to be the transition from whichever framebuffer was in use during the initial boot and the AMDGPU driver. AFAIR The second one was missing its firmware, but I couldn't see because the messages didn't get to the screen, and logging hadn't started yet.
Well. I moved the AMDGPU firmware to (was on initrd when BIOS booting) kernel. Crossing my fingers now...
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Fri Sep 14, 2018 1:39 am    Post subject: Reply with quote

Unfortunately the situation is the same.

Absolutely nothing happens on screen after grub tells it's loading initrd.

However my keyboard gets power back now when I use genkernel-next instead of genkernel. Otherwise it's the same.
I'm looking at initrd here. I think I could create my own linuxrc for gengernel.
By grepping 'btrfs' the default linuxrc from genkernel-next I get nothing. Somehow, my server still manages to boot up just fine. It too has rootfs on multi-device btrfs.

Again the worst thing is that I haven't seen any error messages. :evil:
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
jonathan183
Guru
Guru


Joined: 13 Dec 2011
Posts: 318

PostPosted: Fri Sep 14, 2018 7:45 am    Post subject: Reply with quote

You did not answer my question about why you need initrd ... assuming you do not need to enter a password to decrypt the filesystem then try setup of ssh and see if the server boots but does not display anything on screen. For me I only require cryptsetup so ended up with a very simple initramfs built into the kernel and boot direct with kernel parameters set using efibootmgr - which seems to be more reliable than using grub and a genkernel generated initramfs ... ymmv ;)
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2007

PostPosted: Fri Sep 14, 2018 8:56 am    Post subject: Reply with quote

Have you looked in /sys/fs/pstore? It may be worth temporarily enabling the "Log kernel console messages" option. It's all under File Systems-->MIscellaneous-->Persistent Store Support
_________________
Greybeard
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Fri Sep 14, 2018 9:17 am    Post subject: Reply with quote

Oops missed your post.
jonathan183 wrote:
What do you need initrd for ? have you tried setting up the kernel to build your own custom initrd something alone these lines ?
I would only need to assemble the btrfs array/pool/stack, that is run "btrfs device scan".
And because of that I'm now thinking of creating my own linuxrc for genkernel.

Also I'll look into that pstore.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Fri Sep 14, 2018 10:05 am    Post subject: Reply with quote

I started to look if I could automate building of my own initrd...
I'd hook my own script to genkernel.
Code:
ldd /sbin/btrfs | awk '{if ($2 == "=>") { if (!x[$3]++) print $3 } else if (!x[$1]++) print $1}'
... may be a start.

Oh well. Now I need to take a break.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


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

PostPosted: Fri Sep 14, 2018 3:12 pm    Post subject: Reply with quote

Zucca wrote:
I started to look if I could automate building of my own initrd... I'd hook my own script to genkernel.

Zucca ... "you're doing it wrong" ;) ... if you want to build an initramfs, then built it, don't follow genkernel and simply cp the binaries (and the libs those binaries link to) from the host system. There are vavious advantages to doing it independently of the host system, you don't need to use the same libc (and so the initramfs can be reduced in size ... mine is 2.8mb uncompressed), you can build the binaries statically (and don't need to USE="static" on the host system), you don't need to rebuild on every kernel update (the initramfs can be independent of any kernel, distribution, etc), you can include/exclude only those things you need, etc, etc.

The idea of "hook[ing into] genkernel" is "throwing good money after bad", genkernel is not a platform, it's a solution (the problem being: how to deal with users with perhaps no familarity with building the linux kernel, and/or initramfs ... now it's "the new root"), and for that reason it has limited scope for doing things outside of its perview.

I'd suggest you look at better-initramfs, it not only builds everything within it's own (uClibc, or musl) root-filesystem, it's easily extended. In fact, I would give the re-built initramfs a go, as if it doesn't boot with this you will know it's either something missing from your kernel (because better-inittramfs is independent of kernel/modules) or it's a bug with the kernel itself.

HTH & best ... khay
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Fri Sep 14, 2018 10:25 pm    Post subject: Reply with quote

khayyam,
I'd like to try out the prebuilt, but I don't see one under the link you gave.

Since the system I'm having problems with boots from USB flash drive, it would be very easy just to copy the prebuilt initramfs there, reconfigure rEFInd and try to boot.

Also you're very much right about the thing I'm doing wrong. I just want to see this system boot up so that I could then start solving the actual problem.
It's very tiring to boot again, again, and again to Gentoo Live and run all the same commands to properly set up the chroot. :|

EDIT: https://bitbucket.org/piotrkarbowski/better-initramfs/downloads/release-x86_64-v0.9.1.tar.bz2 Seems like a right file.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


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

PostPosted: Fri Sep 14, 2018 11:06 pm    Post subject: Reply with quote

Zucca wrote:
I'd like to try out the prebuilt, but I don't see one under the link you gave.

Zucca ... asuming this a 64bit architecture, it would be release-x86_64-v0.9.2.tar.bz2.

Zucca wrote:
Since the system I'm having problems with boots from USB flash drive, it would be very easy just to copy the prebuilt initramfs there, reconfigure rEFInd and try to boot.

In my experience rEFInd will automatically detect if the USB flash is bootable (either via bios, or efi), and offer it as a boot option in the menu, so you don't need to do anything to configure, but that raises a question are you installing rEFInd to the USB flash (so a ESP on the USB flash), or using the ESP on disk? Something else that comes to mind, how are you getting rEFInd, are you using sys-boot/refind (and so building it on the host against gnu-efi) or via the prebuilt .zip from the rEFInd website?

best ... khay
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Sat Sep 15, 2018 12:19 am    Post subject: Reply with quote

/boot and /boot/efi on the flash stick.
rEFInd (and grub) compiled natively (while chrooted via Gentoo Live).
Both loaders run fine.

better-initramfs went about as far as genkernel-next initrd.
A strong indication of faulty .config.

I'll continue scratching my head again tomorrow. :)


_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


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

PostPosted: Sat Sep 15, 2018 8:56 am    Post subject: Reply with quote

Zucca wrote:
better-initramfs went about as far as genkernel-next initrd. A strong indication of faulty .config.

Zucca ... or a bug in rEFInd, or the kernel (have you tried another). In terms of the former rEFInd has had a bug in the past, when built with gnu-efi, which caused the initramfs to either fail to load, or not be found/detected. That's why I asked which rEFInd, and where it came from.

best ... khay
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Sat Sep 15, 2018 10:18 am    Post subject: Reply with quote

khayyam wrote:
Zucca wrote:
better-initramfs went about as far as genkernel-next initrd. A strong indication of faulty .config.

Zucca ... or a bug in rEFInd, or the kernel (have you tried another).
I have grub installed too. In fact I can load grub via rEFInd. And yes, grub fails the same way.

I'll try out a different kernel version today.

1337th post
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
jonathan183
Guru
Guru


Joined: 13 Dec 2011
Posts: 318

PostPosted: Sat Sep 15, 2018 10:53 am    Post subject: Reply with quote

Have you already tried ssh into the system to check if it is booting but just not displaying anything sensible on the local console?

If that fails, given your position I'd start with genkernel with the build everything approach so you can get your system to boot. After that configure your own kernel manually and setup initramfs. I use genkernel as a fallback for when the manually configured kernel does not boot, which saves booting from systemrescuecd and chroot.

There are many options for initramfs, I started with one from genkernel but ended up with a custom one which was based on the link I posted to the Old Fashioned Gentoo Install, using a static cryptsetup and a very simple init.sh which just puts a message on screen so I know it got to that point and runs cryptsetup and mounts the root filesystem.

I have an /usr_manual_modified/local/my_initramfs/initramfs_list containing
Code:
# This is a list of files for inclusion in the initramfs used by the kernel build process

### directory structure
dir   /proc      755   0   0
dir   /usr      755   0   0
dir   /bin      755   0   0
dir   /sys      755   0   0
dir   /sys      755   0   0
dir   /lib64      755   0   0
dir   /sbin      755   0   0
dir   /mnt      755   0   0
dir   /mnt/root   755   0   0
dir   /etc      755   0   0
dir   /root      755   0   0
dir   /dev      755   0   0
dir   /dev/mapper   755   0   0
dir   /proc      755   0   0

# link lib to lib64
slink   /lib   /lib64   777   0   0

# other directories for files/links
dir   /usr/lib64   755   0   0

### nodes
nod   /dev/console   0600   0   0   c   5   1
nod   /dev/null   0666   0   0   c   1   3
nod   /dev/random   0666   0   0   c   1   8
nod   /dev/urandom   0666   0   0   c   1   9

### static nodes added for root partition sda1..15 to sdd1..15
nod   /dev/sda1   0660   0   0   b   8   1

nod   /dev/sdb1   0660   0   0   b   8   17

nod   /dev/sdc1   0660   0   0   b   8   33

nod   /dev/sdd1   0660   0   0   b   8   49
nod   /dev/sdd2   0660   0   0   b   8   50
nod   /dev/sdd3   0660   0   0   b   8   51
nod   /dev/sdd4   0660   0   0   b   8   52
nod   /dev/sdd5   0660   0   0   b   8   53
nod   /dev/sdd6   0660   0   0   b   8   54
nod   /dev/sdd7   0660   0   0   b   8   55
nod   /dev/sdd8   0660   0   0   b   8   56

# linux-vdso.so.1 is provided by the kernel
# files and links
file   /bin/busybox   /bin/busybox   0755   0   0
slink   /sbin/mdev   /bin/bb      0777   0   0
slink   /bin/bb      /bin/busybox   0777   0   0

# cryptsetup
file   /sbin/cryptsetup         /sbin/cryptsetup         755   0   0

# init script
file   /init               /usr_manual_modified/local/my_initramfs/init.sh   755   0   0


and /usr_manual_modified/local/my_initramfs/init.sh containing
Code:
#!/bin/busybox sh
   /bin/busybox --install -s

# if all else failes drop to root shell to fix
rescue_shell() {
   echo "Something f****d up - dropping to shell"
   exec sh
}

# pull command line parameter
cmdline() {
   local value
   value=" $(cat /proc/cmdline) "
   value="${value##* $1=}"
   value="${value%% *}"
   [ "$value" != "" ] && echo "$value"
}

# mount the proc and sys file systems
mount -t proc none /proc 2> /dev/null
mount -t sysfs none /sys 2> /dev/null

# message on screen
echo ""
echo "Running custom startup script in custom initramfs ... "
echo ""
echo "Root partition will be $(cmdline Gentoo_crypt_root) enter root partition password when prompted below ;-)"
echo ""

/sbin/cryptsetup luksOpen $(cmdline Gentoo_crypt_root) Gentoo_luks_root
mount -o ro /dev/mapper/Gentoo_luks_root /mnt/root 2> /dev/null || rescue_shell

# tidy up before switch to new root by unmount of proc and sys
umount /proc 2> /dev/null
umount /sys 2> /dev/null

# switch to new root
exec switch_root /mnt/root /sbin/init 2> /dev/null || rescue_shell


The script I use to recreate boot entries includes
Code:
efibootmgr -c -L "Gentoo direct boot kernel (/dev/sdd1)" -p 1 -d /dev/sdd -l "\\EFI\\Custom_boot\\sdd2_bootx64.efi.signed" -u "Gentoo_crypt_root=/dev/sdd2 ro iommu=soft pti=on quiet" 1> /dev/null 2> /dev/null


With
Code:
CONFIG_INITRAMFS_SOURCE="/usr_manual_modified/local/my_initramfs/initramfs_list"
in my .config the initramfs is automatically built into the kernel. I have secure boot enabled so I have a script to sign the kernel which is not relevant for this topic but is relevant for the efibootmgr code.

My approach relies on genkernel for the initial install but then only requires tools provided with the kernel to build the initramfs, it does not require grub to be installed and keeping a backup version of the kernel means I can boot the system without having to resort to systemrescuecd and chroot in for a bad kernel config. There are lots of other options available - I don't claim to have the best - but it works for me ... ymmv ;)
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
Goto page 1, 2  Next
Page 1 of 2

 
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