Ubuntu DDE 20.04 更新5.8内核报错解决方案

https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.8/下载如下内核文件:

linux-headers-5.8.0-050800_5.8.0-050800.202008022230_all.deb
linux-headers-5.8.0-050800-generic_5.8.0-050800.202008022230_amd64.deb
linux-image-unsigned-5.8.0-050800-generic_5.8.0-050800.202008022230_amd64.deb
linux-modules-5.8.0-050800-generic_5.8.0-050800.202008022230_amd64.deb

打开终端,输入sudo dpkg -i *.deb 进行安装,发现报错:

Building module:
cleaning build area...
make -j2 KERNELRELEASE=5.8.0-050800-generic -C /lib/modules/5.8.0-050800-generic/build KBUILD_EXTMOD=/var/lib/dkms/deepin-anything/0.0/build modules...(bad exit status: 2)
ERROR (dkms apport): kernel package linux-headers-5.8.0-050800-generic is not supported
Error! Bad return status for module build on kernel: 5.8.0-050800-generic (x86_64)
Consult /var/lib/dkms/deepin-anything/0.0/build/make.log for more information.
   ...done.

查看对应log文件,内容如下:

DKMS make.log for deepin-anything-0.0 for kernel 5.8.0-050800-generic (x86_64)
2020年 08月 11日 星期二 01:05:14 CST
make: Entering directory '/usr/src/linux-headers-5.8.0-050800-generic'
  CC [M]  /var/lib/dkms/deepin-anything/0.0/build/vfs_utils.o
  CC [M]  /var/lib/dkms/deepin-anything/0.0/build/arg_extractor.o
  CC [M]  /var/lib/dkms/deepin-anything/0.0/build/vfs_change.o
  CC [M]  /var/lib/dkms/deepin-anything/0.0/build/vfs_kretprobes.o
/var/lib/dkms/deepin-anything/0.0/build/vfs_change.c: In function ‘copy_vfs_changes’:
/var/lib/dkms/deepin-anything/0.0/build/vfs_change.c:128:3: error: unknown type name ‘time_t’; did you mean ‘ktime_t’?
  128 |   time_t shifted_secs = vc->ts.tv_sec + hour_shift*3600;
      |   ^~~~~~
      |   ktime_t
/var/lib/dkms/deepin-anything/0.0/build/vfs_change.c: In function ‘init_vfs_changes’:
/var/lib/dkms/deepin-anything/0.0/build/vfs_change.c:348:74: error: passing argument 4 of ‘proc_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  348 |  struct proc_dir_entry* procfs_entry = proc_create(PROCFS_NAME, 0666, 0, &procfs_ops);
      |                                                                          ^~~~~~~~~~~
      |                                                                          |
      |                                                                          struct file_operations *
In file included from /var/lib/dkms/deepin-anything/0.0/build/vfs_change.c:5:
./include/linux/proc_fs.h:107:24: note: expected ‘const struct proc_ops *’ but argument is of type ‘struct file_operations *’
  107 | struct proc_dir_entry *proc_create(const char *name, umode_t mode, struct proc_dir_entry *parent, const struct proc_ops *proc_ops);
      |                        ^~~~~~~~~~~
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:281: /var/lib/dkms/deepin-anything/0.0/build/vfs_change.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1756: /var/lib/dkms/deepin-anything/0.0/build] Error 2
make: Leaving directory '/usr/src/linux-headers-5.8.0-050800-generic'

经过查询,应该是deeping-anything(https://github.com/linuxdeepin/deepin-anything)这个内核模块出现了问题,新版本内核更改了结构体,导致编译不成功,直接修改其源码

sudo gedit /var/lib/dkms/deepin-anything/0.0/source/vfs_change.c

第128行time_t修改为ktime_t

第336-343行进行如下修改:

static struct proc_ops procfs_ops = {
	.proc_open = open_vfs_changes,
	.proc_read = read_vfs_changes,
	.proc_ioctl = ioctl_vfs_changes,
	.proc_lseek = no_llseek,
	//.llseek = generic_file_llseek,
	.proc_release = release_vfs_changes,
};

即可成功通过编译安装上5.8内核。

自己保存备用,也可能有些人需要。

参考内容:https://lore.kernel.org/netdev/20191225172546.GB13378@avx2/

留下评论