You have a broken and unusupported DKMS modules installed that breaks the kernel headers installation. Try:
$ dkms remove amdgpu/6.2.4-1666569.22.04 ** Changed in: linux-hwe-6.5 (Ubuntu) Status: New => Invalid -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux-hwe-6.5 in Ubuntu. https://bugs.launchpad.net/bugs/2053603 Title: package linux-headers-6.5.0-18-generic 6.5.0-18.18~22.04.1 failed to install/upgrade: installed linux-headers-6.5.0-18-generic package post-installation script subprocess returned error exit status 1 Status in linux-hwe-6.5 package in Ubuntu: Invalid Bug description: Performed simple update & upgrade - issue encountered when processing: linux-headers-6.5.0-18-generic linux-headers-generic-hwe-22.04 linux-generic-hwe-22.04 linux-image-6.5.0-18-generic E: Sub-process /usr/bin/dpkg returned an error code (1) ProblemType: Package DistroRelease: Ubuntu 22.04 Package: linux-headers-6.5.0-18-generic 6.5.0-18.18~22.04.1 ProcVersionSignature: Ubuntu 6.5.0-17.17~22.04.1-generic 6.5.8 Uname: Linux 6.5.0-17-generic x86_64 ApportVersion: 2.20.11-0ubuntu82.5 Architecture: amd64 CasperMD5CheckResult: pass Date: Thu Feb 15 23:34:42 2024 ErrorMessage: installed linux-headers-6.5.0-18-generic package post-installation script subprocess returned error exit status 1 InstallationDate: Installed on 2024-02-11 (4 days ago) InstallationMedia: Ubuntu 22.04.3 LTS "Jammy Jellyfish" - Release amd64 (20230807.2) Python3Details: /usr/bin/python3.10, Python 3.10.12, python3-minimal, 3.10.6-1~22.04 PythonDetails: N/A RelatedPackageVersions: dpkg 1.21.1ubuntu2.2 apt 2.4.11 SourcePackage: linux-hwe-6.5 Title: package linux-headers-6.5.0-18-generic 6.5.0-18.18~22.04.1 failed to install/upgrade: installed linux-headers-6.5.0-18-generic package post-installation script subprocess returned error exit status 1 UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux-hwe-6.5/+bug/2053603/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp