Skip to content

g4dn kernel source issue

0

So I am trying to update the nvidia drivers according to this: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-nvidia-driver.html

After I run the kernel-devel install I do not seem to get the kernel source and the nvidia driver complains when I look where the source should be it is not there e.g. [ec2-user@ip-##]$ ls -la /lib/modules/6.1.131-143.221.amzn2023.x86_64/source lrwxrwxrwx. 1 root root 5 Mar 24 15:38 /lib/modules/6.1.131-143.221.amzn2023.x86_64/source -> build [ec2-user@ip-##]$ ls -la /lib/modules/6.1.131-143.221.amzn2023.x86_64/build lrwxrwxrwx. 1 root root 48 Mar 24 15:39 /lib/modules/6.1.131-143.221.amzn2023.x86_64/build -> /usr/src/kernels/6.1.131-143.221.amzn2023.x86_64 [ec2-user@ip-## ~]$ ls -la /usr/src/kernels/6.1.131-143.221.amzn2023.x86_64 ls: cannot access '/usr/src/kernels/6.1.131-143.221.amzn2023.x86_64': No such file or directory

uname -a Linux ip-#.ap-southeast-2.compute.internal 6.1.131-143.221.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Mar 24 15:35:21 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Any thoughts on how I can fix this?

asked 7 months ago101 views
2 Answers
1
Accepted Answer
answered 7 months ago
AWS
EXPERT
reviewed 7 months ago
0

Based on the information you've provided, it appears you're encountering an issue with missing kernel source files after installing the kernel-devel package on an Amazon Linux 2023 instance. This is likely because the kernel-devel package doesn't automatically install the full kernel source.

To resolve this issue, you should try the following steps:

  1. Ensure you have the latest updates: sudo yum update -y

  2. Install both the kernel-devel and kernel-headers packages for your specific kernel version: sudo yum install -y kernel-devel-$(uname -r) kernel-headers-$(uname -r)

  3. If the above doesn't work, you may need to install the full kernel source: sudo yum install -y kernel-src-$(uname -r)

  4. After installation, verify that the kernel source files are present: ls -la /usr/src/kernels/$(uname -r)

If you still don't see the kernel source files after these steps, you may need to reboot your instance to ensure you're using the correct kernel version: sudo reboot

After rebooting, check again for the kernel source files. If the issue persists, you may want to consider using a different Amazon Linux 2023 AMI or contacting AWS support for further assistance.

Remember that the exact kernel version (6.1.131-143.221.amzn2023.x86_64) you mentioned is specific to your instance and may change with updates. Always use the $(uname -r) command to ensure you're installing packages for your current kernel version.
Sources
Amazon Linux 2023 RPM packages as of the 2023.7.20250331 release - Amazon Linux 2023
Amazon Linux 2023 version 2023.4.20240416 release notes - Amazon Linux 2023

answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.