每次使用 apt 安装时都会出现错误

每次使用 apt 安装时都会出现错误

我在 ubuntu cinnamon 23.04 上使用了这个命令

sudo apt install gcc

它给了我这个输出

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
gcc is already the newest version (4:12.2.0-3ubuntu1).
gcc set to manually installed.
The following packages were automatically installed and are no longer required:
  fortune-mod fortunes-min gir1.2-gexiv2-0.10 librecode0 python3-configobj
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up xtrx-dkms (0.0.1+git20190320.5ae3a3e-3.2) ...
Removing old xtrx-0.0.1+git20190320.5ae3a3e-3.2 DKMS files...
Module xtrx-0.0.1+git20190320.5ae3a3e-3.2 for kernel 6.2.0-20-generic (x86_64).
Before uninstall, this module version was ACTIVE on this kernel.

xtrx.ko:
 - Uninstallation
   - Deleting from: /lib/modules/6.2.0-20-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.
depmod...
Deleting module xtrx-0.0.1+git20190320.5ae3a3e-3.2 completely from the DKMS tree
.
Loading new xtrx-0.0.1+git20190320.5ae3a3e-3.2 DKMS files...
Building for 6.2.0-20-generic 6.3.2-060302-generic
Building initial module for 6.2.0-20-generic
Done.

xtrx.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.2.0-20-generic/updates/dkms/
depmod...
Building initial module for 6.3.2-060302-generic
ERROR (dkms apport): kernel package linux-headers-6.3.2-060302-generic is not su
pported
Error! Bad return status for module build on kernel: 6.3.2-060302-generic (x86_6
4)
Consult /var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3.2/build/make.log for more
 information.
dpkg: error processing package xtrx-dkms (--configure):
 installed xtrx-dkms package post-installation script subprocess returned error 
exit status 10
Errors were encountered while processing:
 xtrx-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)

/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3.2/build/make.log 的内容

DKMS make.log for xtrx-0.0.1+git20190320.5ae3a3e-3.2 for kernel 6.3.2-060302-generic (x86_64)
Mo 29 Mai 2023 12:56:35 CEST
make: Entering directory '/usr/src/linux-headers-6.3.2-060302-generic'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.2.0-17ubuntu1) 12.2.0
  You are using:           gcc-12 (Ubuntu 12.2.0-17ubuntu1) 12.2.0
  CC [M]  /var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3.2/build/xtrx.o
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3.2/build/xtrx.c: In function ‘xtrxfd_mmap’:
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3.2/build/xtrx.c:1075:31: error: assignment of read-only member ‘vm_flags’
 1075 |                 vma->vm_flags |= VM_LOCKED;
      |                               ^~
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3.2/build/xtrx.c:1090:31: error: assignment of read-only member ‘vm_flags’
 1090 |                 vma->vm_flags |= VM_IO;
      |                               ^~
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3.2/build/xtrx.c:1115:31: error: assignment of read-only member ‘vm_flags’
 1115 |                 vma->vm_flags |= VM_LOCKED;
      |                               ^~
make[1]: *** [scripts/Makefile.build:252: /var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3.2/build/xtrx.o] Error 1
make: *** [Makefile:2031: /var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3.2/build] Error 2
make: Leaving directory '/usr/src/linux-headers-6.3.2-060302-generic'

答案1

您是否需要 xtrx-dkms 软件包?您需要为您安装的所有内核构建 xtrx 内核模块。如果您不需要它,请使用 将其删除apt remove xtrx-dkms。然后您应该能够使用 apt。

根据输出,软件包 xtrx 已成功为内核 6.2.0-20 构建,但为内核 6.3.2-060302 构建失败。您可以仅针对 6.3.2-060302 删除模块,但我不确定下一步该怎么做apt upgrade。您可以尝试类似 的操作dkms remove -m xtrx -k 6.3.2-060302-generic。我可能遗漏了命令中的一些细节。尝试dkms status查看模块的详细信息。

相关内容