# [SOLVED] Unable to boot new Ryzen system with UEFI and NVME

## Stolz

Hey everyone!

After 8 years with my i5-2500K I just upgraded my system (X570 motherboard, PCIe4 NVME and Ryzen 9 CPU), which brought with it several changes of technologies new to me:

- From Bios to UEFI.

- From MBR partitions to GPT.

- From SATA SSD to M2 NVME.

- From Grub to Grub2.

- From Intel to AMD.

Using the Gentoo minimal live USB, which detected all the hardware flawlessly, I've successfully managed to:

- Partition the new NVME disk in GPT mode, with the fist partition being of type UEFI ESP and the second partition being of Linux type.

- Format ESP with fat32 and the linux partition with ext4.

- Copy the content of my old SSD to the new NVME ext4 partition.

- Update my make.conf for Ryzen and rebuld the whole system with emerge -e @world.

- Update my kernel config with make oldconfig but using all the recommendations for Ryzen, NVME, GPT, UEFI, ESP, EFI Stub Kernel, GRUB2, AMD ucode, etc.. from the handbook and wiki.

- Install GRUB2 using the --removable option.

- Rebuild the kernel and initrd using Genkernel.

- Copy the Kernel+Initrd+Modules from the Live USB to my new NVME partition, to be used as fallback in case my own kernel fails to boot.

Now I can get into Grub2 without problems. It reads my config and it shows two menu entries: one for my own kernel and another for the kernel I copied from the Live USB. I can successfully boot from my NVME using the kernel from the Live USB and see all my old stuff there as expected but I'm not able to boot using my own kernel.

The problem I have is Grub2 does not show any error message whatsoever. It just shows ...

```
    Loading Linux 5.3.8-gentoo-ryzen-javi ...

    Loading initial ramdisk ...
```

... and then the screen hangs and stays like that forever.

When I was using Grub legacy at least I could see some sort of Grub error or kernel panic that could lead me to the solution but Grub2 is just silent. I've tried adding the options 'nosplash debug --verbose' to the kernel command line but Grub does not show any extra information.

So right now I'm completely unsure how to proceed. Since the kernel from the Live USB works but not my own one I assume my Grub2 config is fine but I probably messed up some kernel configuration. Secure boot is disabled. I would appreciate any information regarding:- increasing verbosity of Grub2.

- suggestions of which kernel configs to check.

- a working .config file for similar hardware in a recent (5.3.x) kernel version.

Here is some extra info about my system:

Confirmation of booting in EFI mode

```
# ls /sys/firmware/efi

config_table  efivars  esrt  fw_platform_size  fw_vendor  runtime  systab  vars

# mount | grep efivars

efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
```

My Partitions

```
# parted /dev/nvme0n1 print

Disk /dev/nvme0n1: 2000GB

Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags

 1      1049kB  274MB   273MB   fat32        uefi     boot, esp

 2      274MB   667GB   666GB   ext4         linux
```

Labels and IDs

```
# blkid

/dev/nvme0n1p1: LABEL_FATBOOT="ESP" LABEL="ESP" UUID="7B42-A08F" TYPE="vfat" PARTLABEL="uefi" PARTUUID="11559a53-d0c5-4e99-aa71-0a6052a80981"

/dev/nvme0n1p2: LABEL="gentoo" UUID="f5579525-bfc3-4abb-8da8-2d8fec7c5ca0" TYPE="ext4" PARTLABEL="linux" PARTUUID="7b493716-b63d-4419-be80-384eb094b910"

```

Mount options

```
# mount | egrep 'vfat|ext4'

/dev/nvme0n1p2 on / type ext4 (rw,noatime,commit=300)

/dev/nvme0n1p1 on /boot/efi type vfat (rw,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)

```

Grub2 config

```
# egrep 'menuentry|linux|initrd' /boot/grub/grub.cfg

menuentry 'Gentoo 4.19.72 (It works)'

linux   /boot/kernel-4.19.72-gentoo root=UUID=f5579525-bfc3-4abb-8da8-2d8fec7c5ca0 ro

initrd  /boot/initramfs-4.19.72-gentoo.img

menuentry 'Gentoo 5.3.8 (It does not work)'

linux   /boot/kernel-5.3.8-gentoo-ryzen-javi root=UUID=f5579525-bfc3-4abb-8da8-2d8fec7c5ca0 ro

initrd  /boot/initramfs-5.3.8-gentoo-ryzen-javi.img

menuentry 'Gentoo 5.3.8 (Same than above but with extra kernel parameteres. It does not work)'

linux   /boot/kernel-5.3.8-gentoo-ryzen-javi root=UUID=f5579525-bfc3-4abb-8da8-2d8fec7c5ca0 ro init=/linuxrc ramdisk=8192 real_root=LABEL=gentoo rootfstype=ext4 console=tty1 video=vesa:ywrap,mtrr:3 vga=0x31A quiet

initrd  /boot/initramfs-5.3.8-gentoo-ryzen-javi.img
```

/boot content (I don't use boot partition)

```
# find /boot/ -type f

/boot/efi/EFI/BOOT/BOOTX64.EFI

/boot/grub/fonts/unicode.pf2

/boot/grub/grub.cfg

/boot/grub/grubenv

/boot/grub/x86_64-efi/...

/boot/initramfs-4.19.72-gentoo.img

/boot/initramfs-5.3.8-gentoo-ryzen-javi.img

/boot/kernel-4.19.72-gentoo

/boot/kernel-5.3.8-gentoo-ryzen-javi

/boot/System.map-5.3.8-gentoo-ryzen-javi
```

Kernel .config: http://dpaste.com/1ZTHGGZLast edited by Stolz on Mon Nov 11, 2019 5:22 am; edited 1 time in total

----------

## NeddySeagoon

Stolz,

Grub2 has done its thing. The last messages it prints are

```
    Loading Linux 5.3.8-gentoo-ryzen-javi ...

    Loading initial ramdisk ...
```

so that's OK.

The next messages come from the kernel.

Your steps 

 *Stolz wrote:*   

> - Copy the content of my old SSD to the new NVME ext4 partition.
> 
> - Update my make.conf for Ryzen and rebuld the whole system with emerge -e @world. 

 

bother me.

If the SSD filesytem was in use during the copy, the copy will be corrupt unless you can make a snapshot and copy that.

Some of your Intel code will not run on your new AMD CPU as the instruction set extensions differ.

When you try to execute an Intel only instruction, you get an Illegal Instruction exception. 

What the kernel does in response depends on where it is in its initialisation sequence. 

Explain how you did the copy and rebuild.

----------

## Stolz

 *NeddySeagoon wrote:*   

> Explain how you did the copy and rebuild.

 

Thanks for your reply, NeddySeagoon.

I didn't copy the full contents of my old disk to the new one. I was trying to keep the steps description brief but actually the data transfer process involved several steps, similarly to what you would do in a new Gentoo install. First I extracted the latest AMD64 stage3 in the empty disk and then I rsynced from an offline backup (not a live system) a set of cherry picked locations such:

- $DISTDIR (/usr/portage/distfiles => /var/cache/distfiles)

- /etc

- /home

- /usr/src/linux/.config (only the config file, not the whole kernel sources)

- /var/lib/portage/world

- some other folders containing only personal data such documents, media and stuff.

Then, after updating make.conf I rebuild my whole system from my world file. So my new system is not using packages built from or for my old system.

The thing is everything works fine with the live USB kernel (well, at least everything that does not require special kernel options not available in the live USB kernel such Docker or Xorg+Nvidia) so my bet is the problem is the kernel. I'm currently in the process of re configuring my kernel from scratch instead of from my old config to ensure I have only the critical options enabled. Hopefully someone can pin point my errors from my previously published kernel config.

----------

## kzeiler

Hi Stolz,

Have you by any chance checked to see if you can ping or better yet use SSH or something to connect to your upgraded machine? I went through a very similar upgrade process (from HDD to M2 NVME including changes from BIOS to UEFI and from MBR to GPT), and I only receive the 2 corresponding kernel initialization messages on the connected monitor. I had assumed it just wasn't booting. On a (frustrated) whim I tried pinging the machine from another box and was surprised when I got a response. It turns out that for some still unknown reason with the M2 NVME with GPT partition tables booting from UEFI that AMDGPU just doesn't get loaded. But I can connect to it through SSH and do whatever else I really need to do with it (it's a MythTV and local Portage server). So I guess really I'm still going through the upgrade process....

I still have the HDD with corresponding kernel setup other than what I think was needed for NVME, UEFI, etc., and booting from it still loads AMDGPU and everything works for graphics - albeit much more slowly (going from an old HDD to M2 NVME SSD is frankly shocking in a good way).  :Very Happy:   Since the upgraded machine when booting from NVME with GPT and UEFI still works other than graphics and can connect to it from SSH, do normal Portage administration, MythTV, etc. - it's not been a huge priority to get this figured out. But I still feel like I've been through the AMDGPU Gentoo wiki page forwards and backwards, and that there's just some stupid little thing I'm missing.

Anyway, I'm hoping it's also the case for you that it's just a lack of graphics rather than not booting. And of course I'll also report back if I figure out anything. 

kz

----------

## leandrolnh

Hello,

Maybe my kernel config can at least give some light at your problem.

My CPU is Ryzen 7 1700x, should work with newer generations.

The CPU firmware is configured to be incorporated directly into the kernel.

My GPU is AMD Radeon Vega 56 and the firmware and drivers are configured as modules.

Config: https://pastebin.com/58bfnyhD

----------

## charles17

 *Stolz wrote:*   

> - Partition the new NVME disk in GPT mode, with the fist partition being of type UEFI ESP and the second partition being of Linux type.
> 
> - Format ESP with fat32 and the linux partition with ext4.
> 
> - Copy the content of my old SSD to the new NVME ext4 partition.
> ...

 

EFI Stub Kernel, this is meant for direct booting from the EFI boot item.

What are your boot items?

 *Stolz wrote:*   

> /boot content (I don't use boot partition)
> 
> ```
> # find /boot/ -type f
> 
> ...

 

The EFI stub only works when it's correctly placed in the EFI System Partition.  Isn't this from your /boot/ partition?

----------

## Tony0945

 *charles17 wrote:*   

> The EFI stub only works when it's correctly placed in the EFI System Partition.  Isn't this from your /boot/ partition?

 

YES! Stolz, please post your /etc/fstab

----------

## Stolz

Problem solved!

Thanks to all of you that helped me. Turns out I was missing one single kernel config: CONFIG_FB_SIMPLE=y

Once enabled I can boot my own kernel without problems  :Smile: . The option can be found at:

```
Device Drivers  --->

  Graphics support  --->

    Frame buffer Devices  --->

    <*> Support for frame buffer devices  --->

      [*]   Simple framebuffer support (CONFIG_FB_SIMPLE)
```

I managed to pin point the problem by manually comparing the live USB kernel config with my own one, enabling/disabling blocks of configurations in menuconfig and rebooting until I found the block that made the system unable to boot. Once the block was identified, just took me a few seconds to narrow down the culprit. Thankfully recompiling the kernel with 24 threads is a breeze.

In case it helps anyone coming from Google, to transfer the kernel config from the live USB kernel (4.19.72) to my own kernel  (5.3.8 ) I just did

```
cd /usr/src/linux

modprobe configs

zcat /proc/config.gz > .config

make oldconfig
```

----------

## NeddySeagoon

Stolz,

Its not over yet. 

CONFIG_FB_SIMPLE=y gets you an early console.

It does not make the difference between booting and not booting.

Eventually, the kernel should have started your real framebuffer console. It didn't.

That suggests that your graphics card driver is missing or incomplete.

If you always use SimpleFB, your GPU isn't doing anything at all. Your graphics card is just a chunk of RAM that the CPU draws in, just like the original Hercules card or the original IBM PC.

----------

## toralf

 *Stolz wrote:*   

> 
> 
> ...
> 
> I managed to pin point the problem by manually comparing the live USB kernel config with my own one, enabling/disabling blocks of configurations in menuconfig and rebooting until I found the block that made the system unable to boot. Once the block was identified, just took me a few seconds to narrow down the culprit. Thankfully recompiling the kernel with 24 threads is a breeze.
> ...

 

Hint: boot into a kernel made with make defconfig, strip down the kernel .config using make localmodconfig and /usr/src/linux/scripts/kconfig/streamline_config.pl

----------

## kzeiler

Hi Stolz,

Thanks for the tip on simple framebuffer - at least I get some sort of graphics now. But NeddySeagoon is very much correct that the real graphics card driver isn't kicking in. 

I did the upgrade to my new mobo & CPU (Ryzen 5 3400g) a few weeks ago with my old HDD before installing and migrating to the NVME SSD with GPT and booting from UEFI. The kernel I initially had on my old HDD had AMDGPU built-in rather than as a module. Now that I've booted into the HDD, switched to AMDGPU as a module in the kernel on that install and rebooted...I'm finding that apparently that was likely working without AMDGPU in kernel and using VESA frame buffer instead (?).  :Embarassed:  Which also probably explains why I was beating my head on getting sound out through HDMI.   :Rolling Eyes: 

I'll report back if I figure out anything.

Thanks,

Kurt

----------

## Stolz

 *NeddySeagoon wrote:*   

> If you always use SimpleFB, your GPU isn't doing anything at all. Your graphics card is just a chunk of RAM that the CPU draws in, just like the original Hercules card or the original IBM PC.

 

Well then, what should be my next step considering I'm using an Nvidia card with the proprietary drivers?. 

v86d is long gone. According to the wiki efifb (CONFIG_FB_EFI) causes intermittent problems with the proprietary drivers. vesafb (CONFIG_FB_VESA) was part of my initial config but my kernel won't boot with it unless I also enable simplefb (CONFIG_FB_SIMPLE). Since my kernel boots with only simplefb I've now removed vesafb.

Is there a better alternative than simplefb for Nvidia users with the proprietary drivers?.

----------

## NeddySeagoon

Stolz,

The evil nvidia binary blob will not let you have an accelerated framebuffer console.

If any other driver configures the hardware, the binary blob won't start for Xorg.

If you don't want to use nvidia-drivers, nouveau provides a free framebuffer.

With nvidia-drivers, your console driver choice is simplefb, efifb (on EFI systems) or the the old original VGA text console.

I'm not sure if vesafb is supported in the video BIOS on modern graphics cards any longer.

It may not matter, if you don't want to use the console much.

----------

## NeddySeagoon

kzeiler,

I have amdgpu built in. WFM.

You also need to build in the firmware. For me, that's over 20 firmware files.

----------

## Stolz

Thanks for clarifying it. 

I need the proprietary drivers for Davinci Resolve and most of the time I'm using a terminal I'm in Xorg. I just want FB so when things get ugly I can have a bit more 'real state' in my screen than the one provided by the VGA console. So I'll stay with simplefb.

----------

## OldTango

 *Stolz wrote:*   

> Thanks for clarifying it. 
> 
> I need the proprietary drivers for Davinci Resolve and most of the time I'm using a terminal I'm in Xorg. I just want FB so when things get ugly I can have a bit more 'real state' in my screen than the one provided by the VGA console. So I'll stay with simplefb.

 Glad to see you solved your issue.  It would be nice if you marked this thread as SOLVED.....  :Wink:   :Wink: 

----------

