升级到 Ubuntu 23.04 后卸载 amdgpu-dkms 时出现问题

升级到 Ubuntu 23.04 后卸载 amdgpu-dkms 时出现问题

升级到 Ubuntu 23.04(从 22.10)后,我遇到了一些问题。我为我的显卡安装了专有的 AMD 驱动程序,升级后,amdgpu-dkms 包导致我出现 apt 错误:

$ sudo amdgpu-uninstall
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gcc-11-base libasan6 libdrm-dev libelf-dev libgcc-11-dev libncurses-dev libomxil-bellagio-bin libomxil-bellagio0 libpciaccess-dev libstdc++-11-dev libtinfo-dev
  libtsan0 zlib1g-dev
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  amdgpu-core* amdgpu-dkms* amdgpu-dkms-firmware* amdgpu-lib* amdgpu-lib32* comgr* gst-omx-amdgpu* hip-runtime-amd* hsa-rocr* hsa-rocr-dev* hsakmt-roct-dev*
  libdrm-amdgpu-amdgpu1* libdrm-amdgpu-amdgpu1:i386* libdrm-amdgpu-common* libdrm-amdgpu-radeon1* libdrm-amdgpu-radeon1:i386* libdrm2-amdgpu* libdrm2-amdgpu:i386*
  libegl1-amdgpu-mesa* libegl1-amdgpu-mesa:i386* libegl1-amdgpu-mesa-drivers* libegl1-amdgpu-mesa-drivers:i386* libgbm1-amdgpu* libgbm1-amdgpu:i386*
  libgl1-amdgpu-mesa-dri* libgl1-amdgpu-mesa-dri:i386* libgl1-amdgpu-mesa-glx* libgl1-amdgpu-mesa-glx:i386* libglapi-amdgpu-mesa* libglapi-amdgpu-mesa:i386*
  libllvm15.0.50403-amdgpu* libllvm15.0.50403-amdgpu:i386* libxatracker2-amdgpu* libxatracker2-amdgpu:i386* mesa-amdgpu-omx-drivers* mesa-amdgpu-va-drivers*
  mesa-amdgpu-va-drivers:i386* mesa-amdgpu-vdpau-drivers* mesa-amdgpu-vdpau-drivers:i386* openmp-extras-runtime* rocm-core* rocm-hip-runtime* rocm-language-runtime*
  rocm-llvm* rocm-ocl-icd* rocm-opencl* rocm-opencl-runtime* rocminfo* xserver-xorg-amdgpu-video-amdgpu*
0 upgraded, 0 newly installed, 49 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 1,382 MB disk space will be freed.
Do you want to continue? [Y/n] 
dpkg: warning: files list file for package 'amdgpu-dkms-firmware' missing; assuming package has no files currently installed
(Reading database ... 345517 files and directories currently installed.)
Removing amdgpu-dkms (1:5.18.13.50403-1538762.22.04) ...
Deleting module amdgpu-5.18.13-1538762.22.04 completely from the DKMS tree.
update-initramfs: Generating /boot/initrd.img-5.19.0-38-generic
grep: /boot/config-5.19.0-38-generic: No such file or directory
W: zstd compression (CONFIG_RD_ZSTD) not supported by kernel, using gzip
grep: /boot/config-5.19.0-38-generic: No such file or directory
E: gzip compression (CONFIG_RD_GZIP) not supported by kernel
update-initramfs: failed for /boot/initrd.img-5.19.0-38-generic with 1.
dpkg: error processing package amdgpu-dkms (--remove):
 installed amdgpu-dkms package post-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 amdgpu-dkms
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

我正在尝试卸载所有专有的 AMD GPU 驱动程序,但似乎无法做到。卸载脚本抱怨缺少一些标头(grep:/boot/config-5.19.0-38-generic:没有这样的文件或目录),我认为这些标头是在升级过程中卸载的,并且在 23.04 存储库中不可用。我设法手动安装它们,但仍然看到相同的错误。

目前,我的目标是完全卸载驱动程序,但我不知道如何强制删除软件包。我可能也看错了,而且还有更好的解决方案。有人能建议什么可以帮到我吗?

当前内核:

$ uname -r
6.2.0-20-generic

Apt 缓存:

$ apt-cache policy amdgpu amdgpu-dkms
amdgpu:
  Installed: (none)
  Candidate: 1:5.4.50403-1538762.22.04
  Version table:
     1:5.4.50403-1538762.22.04 600
        600 https://repo.radeon.com/amdgpu/5.4.3/ubuntu jammy/main amd64 Packages
amdgpu-dkms:
  Installed: 1:5.18.13.50403-1538762.22.04
  Candidate: 1:5.18.13.50403-1538762.22.04
  Version table:
 *** 1:5.18.13.50403-1538762.22.04 600
        600 https://repo.radeon.com/amdgpu/5.4.3/ubuntu jammy/main amd64 Packages
        600 https://repo.radeon.com/amdgpu/5.4.3/ubuntu jammy/main i386 Packages
        100 /var/lib/dpkg/status

DKMS 状态:

$ dkms status
openrazer-driver/3.5.1, 5.19.0-38-generic, x86_64: installed
openrazer-driver/3.5.1, 5.19.0-41-generic, x86_64: installed
openrazer-driver/3.5.1, 6.2.0-20-generic, x86_64: installed

答案1

一位朋友提供了一些建议,我们设法让它工作了!就我而言,这是解决办法:

sudo dpkg --remove --force-remove-reinstreq amdgpu-dkms
cd /var/lib/dpkg/info
sudo rm amdgpu-dkms.*
sudo apt -f install

从那里我可以运行sudo amdgpu-uninstall来卸载其余的软件包。谢谢大家!

相关内容