当我运行 apt upgrade 时,出现了错误。这是 nvidia 510 驱动程序的错误。在我看来,它似乎是用与内核不同的 gcc 构建的,但这有点超出我的能力,无法调试正在发生的事情。有人能帮忙吗?我在下面放了一些相关的调试信息。如果还有其他有用的信息,请告诉我。
apt update 的输出:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
#
# News about significant security updates, features and services will
# appear here to raise awareness and perhaps tease /r/Linux ;)
# Use 'pro config set apt_news=false' to hide this and future APT news.
#
The following packages have been kept back:
fonts-opensymbol grub-efi-amd64-bin grub-efi-amd64-signed
The following packages will be upgraded:
tzdata
1 to upgrade, 0 to newly install, 0 to remove and 3 not to upgrade.
1 not fully installed or removed.
Need to get 333 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://gb.archive.ubuntu.com/ubuntu jammy-updates/main amd64 tzdata all 2022f-0ubuntu0.22.04.1 [333 kB]
Fetched 333 kB in 0s (2,044 kB/s)
Preconfiguring packages ...
(Reading database ... 225092 files and directories currently installed.)
Preparing to unpack .../tzdata_2022f-0ubuntu0.22.04.1_all.deb ...
Unpacking tzdata (2022f-0ubuntu0.22.04.1) over (2022f-0ubuntu0.22.04.0) ...
Setting up nvidia-dkms-510 (510.85.02-0ubuntu0.22.04.2) ...
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
Removing old nvidia-510.85.02 DKMS files...
Deleting module nvidia-510.85.02 completely from the DKMS tree.
Loading new nvidia-510.85.02 DKMS files...
Building for 5.15.0-53-generic
Building for architecture x86_64
Building initial module for 5.15.0-53-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/nvidia-dkms-510.0.crash'
Error! Bad return status for module build on kernel: 5.15.0-53-generic (x86_64)
Consult /var/lib/dkms/nvidia/510.85.02/build/make.log for more information.
dpkg: error processing package nvidia-dkms-510 (--configure):
installed nvidia-dkms-510 package post-installation script subprocess returned error exit status 10
Setting up tzdata (2022f-0ubuntu0.22.04.1) ...
Current default time zone: 'Europe/London'
Local time is now: Tue Nov 15 16:38:06 GMT 2022.
Universal Time is now: Tue Nov 15 16:38:06 UTC 2022.
Run 'dpkg-reconfigure tzdata' if you wish to change it.
Processing triggers for initramfs-tools (0.140ubuntu13) ...
update-initramfs: Generating /boot/initrd.img-5.15.0-53-generic
I: The initramfs will attempt to resume from /dev/dm-1
I: (/dev/mapper/vgubuntu-swap_1)
I: Set the RESUME variable to override this.
Errors were encountered while processing:
nvidia-dkms-510
E: Sub-process /usr/bin/dpkg returned an error code (1)
查看提到的 make.log,有一个无法识别的命令行选项 cc:错误:无法识别的命令行选项“-mharden-sls = all”;您的意思是“-mhard-float”吗?
生成日志
DKMS make.log for nvidia-510.85.02 for kernel 5.15.0-53-generic (x86_64)
Tue 15 Nov 16:37:57 GMT 2022
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-53-generic'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo >&2; \
echo >&2 " ERROR: Kernel configuration is invalid."; \
echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo >&2 ; \
/bin/false)
warning: the compiler differs from the one used to build the kernel
The kernel was built by: gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
You are using: cc (Ubuntu 8.5.0-0ubuntu4) 8.5.0
make -f ./scripts/Makefile.build obj=/var/lib/dkms/nvidia/510.85.02/build \
single-build= \
need-builtin=1 need-modorder=1
ln -sf /var/lib/dkms/nvidia/510.85.02/build/nvidia/nv-kernel.o_binary /var/lib/dkms/nvidia/510.85.02/build/nvidia/nv-kernel.o
ln -sf /var/lib/dkms/nvidia/510.85.02/build/nvidia-modeset/nv-modeset-kernel.o_binary /var/lib/dkms/nvidia/510.85.02/build/nvidia-modeset/nv-modeset-kernel.o
CONFTEST: hash__remap_4k_pfn
CONFTEST: set_pages_uc
CONFTEST: list_is_first
CONFTEST: set_memory_uc
CONFTEST: set_memory_array_uc
CONFTEST: set_pages_array_uc
CONFTEST: console_lock
CONFTEST: acquire_console_sem
CONFTEST: ioremap_cache
CONFTEST: ioremap_wc
CONFTEST: acpi_walk_namespace
CONFTEST: sg_alloc_table
CONFTEST: pci_get_domain_bus_and_slot
CONFTEST: get_num_physpages
CONFTEST: efi_enabled
CONFTEST: pde_data
CONFTEST: PDE_DATA
CONFTEST: proc_remove
CONFTEST: pm_vt_switch_required
CONFTEST: xen_ioemu_inject_msi
CONFTEST: phys_to_dma
CONFTEST: get_dma_ops
CONFTEST: dma_attr_macros
CONFTEST: dma_map_page_attrs
CONFTEST: write_cr4
CONFTEST: of_get_property
CONFTEST: of_find_node_by_phandle
CONFTEST: of_node_to_nid
CONFTEST: pnv_pci_get_npu_dev
CONFTEST: of_get_ibm_chip_id
CONFTEST: node_end_pfn
CONFTEST: pci_bus_address
CONFTEST: pci_stop_and_remove_bus_device
CONFTEST: pci_remove_bus_device
CONFTEST: register_cpu_notifier
CONFTEST: cpuhp_setup_state
CONFTEST: dma_map_resource
CONFTEST: backlight_device_register
CONFTEST: get_backlight_device_by_name
CONFTEST: timer_setup
CONFTEST: pci_enable_msix_range
CONFTEST: kernel_read_has_pointer_pos_arg
CONFTEST: kernel_write
CONFTEST: kthread_create_on_node
CONFTEST: of_find_matching_node
CONFTEST: dma_direct_map_resource
CONFTEST: dev_is_pci
CONFTEST: tegra_get_platform
CONFTEST: tegra_bpmp_send_receive
CONFTEST: flush_cache_all
CONFTEST: vmf_insert_pfn
CONFTEST: jiffies_to_timespec
CONFTEST: ktime_get_raw_ts64
CONFTEST: ktime_get_real_ts64
CONFTEST: full_name_hash
CONFTEST: hlist_for_each_entry
CONFTEST: pci_enable_atomic_ops_to_root
CONFTEST: vga_tryget
CONFTEST: pgprot_decrypted
CONFTEST: cc_mkdec
CONFTEST: iterate_fd
CONFTEST: seq_read_iter
CONFTEST: sg_page_iter_page
CONFTEST: unsafe_follow_pfn
CONFTEST: drm_gem_object_get
CONFTEST: drm_gem_object_put_unlocked
CONFTEST: set_close_on_exec
CONFTEST: add_memory_driver_managed
CONFTEST: device_property_read_u64
CONFTEST: devm_of_platform_populate
CONFTEST: of_dma_configure
CONFTEST: of_property_count_elems_of_size
CONFTEST: of_property_read_variable_u8_array
CONFTEST: i2c_new_client_device
CONFTEST: i2c_unregister_device
CONFTEST: of_get_named_gpio
CONFTEST: devm_gpio_request_one
CONFTEST: gpio_direction_input
CONFTEST: gpio_direction_output
CONFTEST: gpio_get_value
CONFTEST: gpio_set_value
CONFTEST: gpio_to_irq
CONFTEST: icc_get
CONFTEST: icc_put
CONFTEST: icc_set_bw
CONFTEST: dma_set_coherent_mask
CONFTEST: acpi_bus_get_device
CONFTEST: get_task_ioprio
CONFTEST: address_space_init_once
CONFTEST: kbasename
CONFTEST: vzalloc
CONFTEST: wait_on_bit_lock_argument_count
CONFTEST: bitmap_clear
CONFTEST: usleep_range
CONFTEST: radix_tree_empty
CONFTEST: radix_tree_replace_slot
CONFTEST: pnv_npu2_init_context
CONFTEST: cpumask_of_node
CONFTEST: ioasid_get
CONFTEST: migrate_vma_setup
CONFTEST: drm_dev_unref
CONFTEST: drm_reinit_primary_mode_group
CONFTEST: get_user_pages_remote
CONFTEST: get_user_pages
CONFTEST: drm_gem_object_lookup
CONFTEST: drm_atomic_state_ref_counting
CONFTEST: drm_driver_has_gem_prime_res_obj
CONFTEST: drm_atomic_helper_connector_dpms
CONFTEST: drm_connector_funcs_have_mode_in_name
CONFTEST: drm_framebuffer_get
CONFTEST: drm_dev_put
CONFTEST: drm_format_num_planes
CONFTEST: drm_connector_for_each_possible_encoder
CONFTEST: drm_rotation_available
CONFTEST: drm_vma_offset_exact_lookup_locked
CONFTEST: nvhost_dma_fence_unpack
CONFTEST: is_export_symbol_gpl_of_node_to_nid
CONFTEST: is_export_symbol_gpl_sme_active
CONFTEST: is_export_symbol_present_swiotlb_map_sg_attrs
CONFTEST: is_export_symbol_present_swiotlb_dma_ops
CONFTEST: is_export_symbol_present___close_fd
CONFTEST: is_export_symbol_present_close_fd
CONFTEST: is_export_symbol_present_get_unused_fd
CONFTEST: is_export_symbol_present_get_unused_fd_flags
CONFTEST: is_export_symbol_present_nvhost_get_default_device
CONFTEST: is_export_symbol_present_nvhost_syncpt_unit_interface_get_byte_offset
CONFTEST: is_export_symbol_present_nvhost_syncpt_unit_interface_get_aperture
CONFTEST: is_export_symbol_present_tegra_dce_register_ipc_client
CONFTEST: is_export_symbol_present_tegra_dce_unregister_ipc_client
CONFTEST: is_export_symbol_present_tegra_dce_client_ipc_send_recv
CONFTEST: is_export_symbol_present_dram_clk_to_mc_clk
CONFTEST: is_export_symbol_present_get_dram_num_channels
CONFTEST: is_export_symbol_present_tegra_dram_types
CONFTEST: is_export_symbol_present_kthread_create_on_node
CONFTEST: file_operations
CONFTEST: file_inode
CONFTEST: kuid_t
CONFTEST: dma_ops
CONFTEST: swiotlb_dma_ops
CONFTEST: noncoherent_swiotlb_dma_ops
CONFTEST: vm_fault_has_address
CONFTEST: backlight_properties_type
CONFTEST: vm_insert_pfn_prot
CONFTEST: vmf_insert_pfn_prot
CONFTEST: vm_ops_fault_removed_vma_arg
CONFTEST: vmbus_channel_has_ringbuffer_page
CONFTEST: device_driver_of_match_table
CONFTEST: device_of_node
CONFTEST: node_states_n_memory
CONFTEST: kmem_cache_has_kobj_remove_work
CONFTEST: sysfs_slab_unlink
CONFTEST: proc_ops
CONFTEST: timespec64
CONFTEST: vmalloc_has_pgprot_t_arg
CONFTEST: acpi_fadt_low_power_s0
CONFTEST: mm_has_mmap_lock
CONFTEST: pci_channel_state
CONFTEST: pci_dev_has_ats_enabled
CONFTEST: mt_device_gre
CONFTEST: remove_memory_has_nid_arg
CONFTEST: address_space
CONFTEST: backing_dev_info
CONFTEST: mm_context_t
CONFTEST: vm_fault_t
CONFTEST: mmu_notifier_ops_invalidate_range
CONFTEST: migrate_vma_added_flags
CONFTEST: make_device_exclusive_range
CONFTEST: drm_bus_present
CONFTEST: drm_bus_has_bus_type
CONFTEST: drm_bus_has_get_irq
CONFTEST: drm_bus_has_get_name
CONFTEST: drm_driver_has_device_list
CONFTEST: drm_driver_has_legacy_dev_list
CONFTEST: drm_driver_has_set_busid
CONFTEST: drm_crtc_state_has_connectors_changed
CONFTEST: drm_init_function_args
CONFTEST: drm_helper_mode_fill_fb_struct
CONFTEST: drm_master_drop_has_from_release_arg
CONFTEST: drm_driver_unload_has_int_return_type
CONFTEST: drm_atomic_helper_crtc_destroy_state_has_crtc_arg
CONFTEST: drm_atomic_helper_plane_destroy_state_has_plane_arg
CONFTEST: drm_mode_object_find_has_file_priv_arg
CONFTEST: dma_buf_owner
CONFTEST: drm_connector_list_iter
CONFTEST: drm_atomic_helper_swap_state_has_stall_arg
CONFTEST: drm_driver_prime_flag_present
CONFTEST: drm_gem_object_has_resv
CONFTEST: drm_crtc_state_has_async_flip
CONFTEST: drm_crtc_state_has_pageflip_flags
CONFTEST: drm_format_modifiers_present
CONFTEST: drm_vma_node_is_allowed_has_tag_arg
CONFTEST: drm_vma_offset_node_has_readonly
CONFTEST: drm_display_mode_has_vrefresh
CONFTEST: drm_driver_master_set_has_int_return_type
CONFTEST: drm_driver_has_gem_free_object
CONFTEST: drm_prime_pages_to_sg_has_drm_device_arg
CONFTEST: drm_driver_has_gem_prime_callbacks
CONFTEST: drm_crtc_atomic_check_has_atomic_state_arg
CONFTEST: drm_gem_object_vmap_has_map_arg
CONFTEST: drm_plane_atomic_check_has_atomic_state_arg
CONFTEST: drm_device_has_pdev
CONFTEST: drm_crtc_state_has_no_vblank
CONFTEST: drm_mode_config_has_allow_fb_modifiers
CONFTEST: dma_resv_add_fence
CONFTEST: dma_resv_reserve_fences
CONFTEST: reservation_object_reserve_shared_has_num_fences_arg
CONFTEST: dom0_kernel_present
CONFTEST: nvidia_vgpu_kvm_build
CONFTEST: nvidia_grid_build
CONFTEST: nvidia_grid_csp_build
CONFTEST: pm_runtime_available
CONFTEST: pci_class_multimedia_hd_audio
CONFTEST: drm_available
CONFTEST: drm_atomic_available
CONFTEST: is_export_symbol_gpl_refcount_inc
CONFTEST: is_export_symbol_gpl_refcount_dec_and_test
CONFTEST: drm_alpha_blending_available
CONFTEST: ib_peer_memory_symbols
cc -Wp,-MMD,/var/lib/dkms/nvidia/510.85.02/build/nvidia/.nv.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/8/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -I./ubuntu/include -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -mfunction-return=thunk-extern -fno-jump-tables -mharden-sls=all -fno-delete-null-pointer-checks -O2 -Wframe-larger-than=1024 -fstack-protector-strong -Wno-main -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -gdwarf-5 -pg -mrecord-mcount -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -Wno-maybe-uninitialized -Wno-alloc-size-larger-than -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -I/var/lib/dkms/nvidia/510.85.02/build/common/inc -I/var/lib/dkms/nvidia/510.85.02/build -Wall -MD -Wno-cast-qual -Wno-error -Wno-format-extra-args -D__KERNEL__ -DMODULE -DNVRM -DNV_VERSION_STRING=\"510.85.02\" -Wno-unused-function -Wuninitialized -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -DNV_UVM_ENABLE -DNV_SPECTRE_V2=0 -DNV_KERNEL_INTERFACE_LAYER -I/var/lib/dkms/nvidia/510.85.02/build/nvidia -DNVIDIA_UNDEF_LEGACY_BIT_MACROS -UDEBUG -U_DEBUG -DNDEBUG -fsanitize=bounds -fsanitize=shift -fsanitize=bool -fsanitize=enum -DMODULE -DKBUILD_BASENAME='"nv"' -DKBUILD_MODNAME='"nvidia"' -D__KBUILD_MODNAME=kmod_nvidia -c -o /var/lib/dkms/nvidia/510.85.02/build/nvidia/nv.o /var/lib/dkms/nvidia/510.85.02/build/nvidia/nv.c
cc -Wp,-MMD,/var/lib/dkms/nvidia/510.85.02/build/nvidia/.nv-pci.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/8/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -I./ubuntu/include -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -mfunction-return=thunk-extern -fno-jump-tables -mharden-sls=all -fno-delete-null-pointer-checks -O2 -Wframe-larger-than=1024 -fstack-protector-strong -Wno-main -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -gdwarf-5 -pg -mrecord-mcount -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -Wno-maybe-uninitialized -Wno-alloc-size-larger-than -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -I/var/lib/dkms/nvidia/510.85.02/build/common/inc -I/var/lib/dkms/nvidia/510.85.02/build -Wall -MD -Wno-cast-qual -Wno-error -Wno-format-extra-args -D__KERNEL__ -DMODULE -DNVRM -DNV_VERSION_STRING=\"510.85.02\" -Wno-unused-function -Wuninitialized -fno-strict-aliasing -mno-red-zone -mcmodel=kernel -DNV_UVM_ENABLE -DNV_SPECTRE_V2=0 -DNV_KERNEL_INTERFACE_LAYER -I/var/lib/dkms/nvidia/510.85.02/build/nvidia -DNVIDIA_UNDEF_LEGACY_BIT_MACROS -UDEBUG -U_DEBUG -DNDEBUG -fsanitize=bounds -fsanitize=shift -fsanitize=bool -fsanitize=enum -DMODULE -DKBUILD_BASENAME='"nv_pci"' -DKBUILD_MODNAME='"nvidia"' -D__KBUILD_MODNAME=kmod_nvidia -c -o /var/lib/dkms/nvidia/510.85.02/build/nvidia/nv-pci.o /var/lib/dkms/nvidia/510.85.02/build/nvidia/nv-pci.c
cc: error: unrecognized command line option ‘-mharden-sls=all’; did you mean ‘-mhard-float’?
make[2]: *** [scripts/Makefile.build:297: /var/lib/dkms/nvidia/510.85.02/build/nvidia/nv.o] Error 1
make[2]: *** Waiting for unfinished jobs....
cc: error: unrecognized command line option ‘-mharden-sls=all’; did you mean ‘-mhard-float’?
make[2]: *** [scripts/Makefile.build:297: /var/lib/dkms/nvidia/510.85.02/build/nvidia/nv-pci.o] Error 1
make[1]: *** [Makefile:1903: /var/lib/dkms/nvidia/510.85.02/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-53-generic'
make: *** [Makefile:82: modules] Error 2
ubuntu-drivers 设备上的输出
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd000013C2sv00001043sd00008508bc03sc00i00
vendor : NVIDIA Corporation
model : GM204 [GeForce GTX 970]
driver : nvidia-driver-418-server - distro non-free
driver : nvidia-driver-470-server - distro non-free
driver : nvidia-driver-450-server - distro non-free
driver : nvidia-driver-520 - distro non-free
driver : nvidia-driver-515-server - distro non-free
driver : nvidia-driver-510 - distro non-free
driver : nvidia-driver-390 - distro non-free
driver : nvidia-driver-515 - distro non-free recommended
driver : nvidia-driver-470 - distro non-free
driver : nvidia-driver-510-server - distro non-free
driver : xserver-xorg-video-nouveau - distro free builtin
uname -a
Linux docker2 5.15.0-53-generic #59-Ubuntu SMP Mon Oct 17 18:53:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
uname-rspo
Linux 5.15.0-53-generic x86_64 GNU/Linux
cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"
我从附加驱动程序对话框安装了 nvidia 驱动程序。515 似乎可用。我应该切换到那个吗?
答案1
Make 日志报告:
warning: the compiler differs from the one used to build the kernel
The kernel was built by: gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
You are using: cc (Ubuntu 8.5.0-0ubuntu4) 8.5.0
您应该确保已安装 gcc 11:
sudo apt install gcc-11
当您的用户运行时,它是默认设置gcc
:
gcc --version