Errors were encountered while processing kernel files

Hey everyone!

I had a working machine in which Nvidia worked perfectly. Now, I issued the update & upgrade command to perform those action on the system wide installed packages. This introduced some unexpected issues, altough I’ve done the same many times before without any conflicts.

capracop@Legion-5:~$ sudo dpkg --configure -a
Setting up initramfs-tools (0.130ubuntu3.13) …
update-initramfs: deferring update (trigger activated)
Setting up linux-image-5.4.0-124-generic (5.4.0-124.140~18.04.1) …
I: /initrd.img is now a symlink to boot/initrd.img-5.4.0-124-generic
Setting up nvidia-kernel-common-510 (510.85.02-0ubuntu0.18.04.1) …
update-initramfs: deferring update (trigger activated)
/usr/sbin/update-initramfs: 207: /usr/sbin/update-initramfs: awk: not found
dpkg: error processing package nvidia-kernel-common-510 (–configure):
installed nvidia-kernel-common-510 package post-installation script subprocess returned error exit status 127
dpkg: dependency problems prevent configuration of nvidia-driver-510:
nvidia-driver-510 depends on nvidia-kernel-common-510 (<= 510.85.02-1); however:
Package nvidia-kernel-common-510 is not configured yet.
nvidia-driver-510 depends on nvidia-kernel-common-510 (>= 510.85.02); however:
Package nvidia-kernel-common-510 is not configured yet.

dpkg: error processing package nvidia-driver-510 (–configure):
dependency problems - leaving unconfigured
Setting up linux-image-5.19.0-1.1-liquorix-amd64 (5.19-1ubuntu1~bionic) …
I: /initrd.img.old is now a symlink to boot/initrd.img-5.19.0-1.1-liquorix-amd64
/etc/kernel/postinst.d/apt-auto-removal:
/etc/kernel/postinst.d/apt-auto-removal: 21: /etc/kernel/postinst.d/apt-auto-removal: awk: not found
/etc/kernel/postinst.d/apt-auto-removal: 26: /etc/kernel/postinst.d/apt-auto-removal: awk: not found
run-parts: /etc/kernel/postinst.d/apt-auto-removal exited with return code 127
dpkg: error processing package linux-image-5.19.0-1.1-liquorix-amd64 (–configure):
installed linux-image-5.19.0-1.1-liquorix-amd64 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of nvidia-dkms-510:
nvidia-dkms-510 depends on nvidia-kernel-common-510 (<= 510.85.02-1); however:
Package nvidia-kernel-common-510 is not configured yet.
nvidia-dkms-510 depends on nvidia-kernel-common-510 (>= 510.85.02); however:
Package nvidia-kernel-common-510 is not configured yet.

dpkg: error processing package nvidia-dkms-510 (–configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image-liquorix-amd64:
linux-image-liquorix-amd64 depends on linux-image-5.19.0-1.1-liquorix-amd64 (= 5.19-1ubuntu1~bionic); however:
Package linux-image-5.19.0-1.1-liquorix-amd64 is not configured yet.

dpkg: error processing package linux-image-liquorix-amd64 (–configure):
dependency problems - leaving unconfigured
Processing triggers for initramfs-tools (0.130ubuntu3.13) …
/usr/sbin/update-initramfs: 207: /usr/sbin/update-initramfs: awk: not found
dpkg: error processing package initramfs-tools (–configure):
installed initramfs-tools package post-installation script subprocess returned error exit status 127
Processing triggers for linux-image-5.4.0-124-generic (5.4.0-124.140~18.04.1) …
/etc/kernel/postinst.d/apt-auto-removal:
/etc/kernel/postinst.d/apt-auto-removal: 21: /etc/kernel/postinst.d/apt-auto-removal: awk: not found
/etc/kernel/postinst.d/apt-auto-removal: 26: /etc/kernel/postinst.d/apt-auto-removal: awk: not found
run-parts: /etc/kernel/postinst.d/apt-auto-removal exited with return code 127
dpkg: error processing package linux-image-5.4.0-124-generic (–configure):
installed linux-image-5.4.0-124-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
nvidia-kernel-common-510
nvidia-driver-510
linux-image-5.19.0-1.1-liquorix-amd64
nvidia-dkms-510
linux-image-liquorix-amd64
initramfs-tools
linux-image-5.4.0-124-generic

I googled and tried the recommended suggestions to tackle those broken packages with the following commands. However, without any success.

1. sudo dpkg --configre -a  
2. sudo apt -f install

Does anyone have any ideas what to do?

System: Ubuntu 18.04 LTS
Laptop: Lenovo Legion 5
GPU: Geforce RTX 3070
Processor: AMD Ryzen 5000

Please try
sudo apt --fix-broken install

Outcome is the same as above.

It’s a question why awk is not installed. Furthermore, IIRC kernel 5.19 needs nvidia driver 515.

So, I was able to install the nvidia driver 515. Which seems to have resolved all the dpkg related error messages. But now nvidia-smi complaints that it’s not able to communicate with the driver.

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


Please run nvidia-bug-report.sh as root and attach the resulting nvidia-bug-report.log.gz file to your post.

nvidia-bug-report.log.gz (146.3 KB)

There’s no compiler installed
gcc gone
awk gone
You should really fix your system first.

I’ve actually multiple compiler installed on my system, as can be seen in the attached file. And I’m pretty sure that the system wouldn’t even boot if there wasn’t any.

But gcc is not found when triggered with the gcc --version command. The error even remains after reinstalling build-essential.

I really can’t explain how an update could mess up my system to this extend. Anyways, is that something that can be easily resolved or those it make more sense to reinstall the entire system at this point?

Thanks for all the help so far!

locate_gcc.txt (153.7 KB)

Sounds like the alternatives system (update-alternatives) is broken then, i.e. awk and gcc are installed but not symlinked anymore. Maybe (re-)install update-alternatives.