Startx crashes on Asus ROG G14 on linux kernel 5.9

startx reliably crashes upon startup when booting from the 5.9.8 kernel. Loading into an older version (5.3.0 in my case) works fine, although I don’t think any nvidia drivers are loaded, which is why it works. I followed https://www.reddit.com/r/ZephyrusG14/comments/id4e2d/asus_g14_ubuntu_2004_setup/ to set it up, and everything works fine until the updated nvidia drivers come in to play. I also have had no luck downgrading to 455, or 450.

On startup, after selecting kernel in GRUB, the boot continues for a bit until right about when the login screen is supposed to show up. At that point, the screen is black with the white ticker frozen in the top left of the screen. Switching to another tty works, and so I have been able to gather logs using nvidia-bug-report.sh after running startx – -logverbose 6. Sometimes it freezes, and sometimes it crashes. The logs are attached below. I also included the relevant /var/log/X11 logfile in case it is not included in the tar.

Oh, and the first time I ran startx – -logverbose 6, it said it could not find xterm, after which I ran sudo apt install xterm. Now that error has disappeared, but the overall error remains. Thought it might be interesting.

Keen on getting this to work, happy to provide more information if I can. Unsure what is relevant; please instruct me. Thank you.

nvidia-bug-report.log.gz (351.9 KB) Xorg.2.log (54.4 KB)

You have a amd/nvidia hybrid graphics system with a ryzen 5000, this needs kernel 5.10 minimum and firmware files. Furthermore, Ubuntu 20.04 is recommended since it has support for amd, please see this:
https://forums.developer.nvidia.com/t/ubuntu-mate-20-04-with-rtx-3070-on-ryzen-5900-black-screen-after-boot/167681/30?u=generix

Thank you kindly. That was a great post, I followed the instructions. 5.10.14 kernel works great now, although I am not sure that the nvidia GPU is working as intended:

$ nvidia-smi
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

Unsure how to check if it is running, but it is selected.

$ prime-select query 
nvidia

What else can I check to make sure it is working?

New post, new logs.
nvidia-bug-report.log.gz (121.0 KB)

Looks like you incorrectly applied the fix to the kernel headers:
/usr/bin/ld.bfd:scripts/module.lds:23: ignoring invalid character `#’ in expression

Unsure if I did it correctly. I booted onto 5.3, removed all things nvidia, built the correct linux kernel again, downloaded the fix in step 3, ran the sed line on the file, and updated the initramfs. After booting, I install the nvidia drivers via Software&Updates. The problem persists, nvidia-smi does not find the driver. Am i still doing it incorrectly? I would appreciate clarification if so.

Thanks again. New logs below.
nvidia-bug-report.log.gz (121.0 KB)

Also, the broken file in question.
module.lds (1.1 KB)

Edit: Also, the system reports that AMD Renoir is in use for graphics.

Looking at the corresponding ubuntu bug report, for kernels released after march, 3rd, the missing file should be there now. Please try installing the 5.11.12 kernel without applying the module.lds patch.
The kernel showing ‘Renoir’ instead of ‘Cezanne’ is normal, the display name wasn’t changed.

Fantastic mate, thanks. Installing 5.11.12, then prime-selecting intel into prime-selecting nvidia, then rebooting, I can finally use nvidia-smi to see my hardware working. I very much appreciate your time.