Cuda installation problem for NVIDIA A40, Linux x86_64 Ubuntu 20.04

My Linux is x86_64 Ubuntu 20.04, and I tried to install cuda using runfile(local). So I followed the instruction as the website says.

wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux.run
sudo sh cuda_11.7.0_515.43.04_linux.run

I successfully downloaded cuda using the 1st line, and when I push enter with sudo sh cuda_11.7.0_515.43.04_linux.run , there was error message.

Installation failed. See log at /var/log/cuda-installer.log for details.

var/log/cuda-installer.log is like this.

[INFO]: Driver not installed.
[INFO]: Checking compiler version...
[INFO]: gcc location: /usr/bin/gcc

[INFO]: gcc version: gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)

[INFO]: Initializing menu
[INFO]: Setup complete
[INFO]: Components to install:
[INFO]: Driver
[INFO]: 515.43.04
[INFO]: Executing NVIDIA-Linux-x86_64-515.43.04.run --ui=none --no-questions --accept-license --disable-nouveau --no-cc-version-check --install-libglvnd  2>&1
[INFO]: Finished with code: 256
[ERROR]: Install of driver component failed.
[ERROR]: Install of 515.43.04 failed, quitting

Someone told me to see nvidia-installer.log not cuda-installer.log , so I opened nvidia-installer.log below, and the error was like this.

nvidia-installer log file '/var/log/nvidia-installer.log'
creation time: Tue Jun 28 05:46:45 2022
installer version: 515.43.04

PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

nvidia-installer command line:
    ./nvidia-installer
    --ui=none
    --no-questions
    --accept-license
    --disable-nouveau
    --no-cc-version-check
    --install-libglvnd

Using built-in stream user interface
-> Detected 128 CPUs online; setting concurrency level to 32.
-> Installing NVIDIA driver version 515.43.04.
-> There appears to already be a driver installed on your system (version: 510.73.08).  As part of installing this driver (version: 515.43.04), the existing driver will be uninstalled.  Are you sure you want to continue? (Answer: Continue installation)
WARNING: One or more modprobe configuration files to disable Nouveau are already present at: /usr/lib/modprobe.d/nvidia-installer-disable-nouveau.conf, /etc/modprobe.d/nvidia-installer-disable-nouveau.conf.  Please be sure you have rebooted your system since these files were written.  If you have rebooted, then Nouveau may be enabled for other reasons, such as being included in the system initial ramdisk or in your X configuration file.  Please consult the NVIDIA driver README and your Linux distribution's documentation for details on how to correctly disable the Nouveau kernel driver.
-> For some distributions, Nouveau can be disabled by adding a file in the modprobe configuration directory.  Would you like nvidia-installer to attempt to create this modprobe file for you? (Answer: Yes)
-> One or more modprobe configuration files to disable Nouveau have been written.  For some distributions, this may be sufficient to disable Nouveau; other distributions may require modification of the initial ramdisk.  Please reboot your system and attempt NVIDIA driver installation again.  Note if you later wish to re-enable Nouveau, you will need to delete these files: /usr/lib/modprobe.d/nvidia-installer-disable-nouveau.conf, /etc/modprobe.d/nvidia-installer-disable-nouveau.conf
-> Performing CC sanity check with CC="/usr/bin/cc".
-> Performing CC check.
-> Kernel source path: '/lib/modules/5.4.0-121-generic/build'
-> Kernel output path: '/lib/modules/5.4.0-121-generic/build'
-> Performing Compiler check.
-> Performing Dom0 check.
-> Performing Xen check.
-> Performing PREEMPT_RT check.
-> Performing vgpu_kvm check.
-> Cleaning kernel module build directory.
   executing: 'cd ./kernel; /usr/bin/make -k -j32 clean NV_EXCLUDE_KERNEL_MODULES="" SYSSRC="/lib/modules/5.4.0-121-generic/build" SYSOUT="/lib/modules/5.4.0-121-generic/build"'...
   rm -f -r conftest
   make[1]: Entering directory '/usr/src/linux-headers-5.4.0-121-generic'
   make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-121-generic'
-> Building kernel modules
   executing: 'cd ./kernel; /usr/bin/make -k -j32  NV_EXCLUDE_KERNEL_MODULES="" SYSSRC="/lib/modules/5.4.0-121-generic/build" SYSOUT="/lib/modules/5.4.0-121-generic/build"'...
   make[1]: Entering directory '/usr/src/linux-headers-5.4.0-121-generic'
     SYMLINK /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-kernel.o
     SYMLINK /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/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: ioremap_cache
    CONFTEST: ioremap_wc
    CONFTEST: sg_alloc_table
    CONFTEST: pci_get_domain_bus_and_slot
    CONFTEST: get_num_physpages
    CONFTEST: efi_enabled
    CONFTEST: pde_data
    CONFTEST: proc_remove
    CONFTEST: pm_vt_switch_required
    CONFTEST: xen_ioemu_inject_msi
    CONFTEST: phys_to_dma
    CONFTEST: dma_attr_macros
    CONFTEST: get_dma_ops
    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: pci_bus_address
    CONFTEST: pci_stop_and_remove_bus_device
    CONFTEST: register_cpu_notifier
    CONFTEST: pci_remove_bus_device
    CONFTEST: cpuhp_setup_state
    CONFTEST: dma_map_resource
    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: dev_is_pci
    CONFTEST: dma_direct_map_resource
    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_buf_export_args
    CONFTEST: dma_buf_ops_has_kmap
    CONFTEST: dma_buf_ops_has_kmap_atomic
    CONFTEST: dma_buf_ops_has_map
    CONFTEST: dma_buf_ops_has_map_atomic
    CONFTEST: dma_buf_has_dynamic_attachment
    CONFTEST: dma_buf_attachment_has_peer2peer
    CONFTEST: dma_set_mask_and_coherent
    CONFTEST: acpi_bus_get_device
    CONFTEST: address_space_init_once
    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_pxm_to_node
    CONFTEST: is_export_symbol_present_int_active_memcg
    CONFTEST: file_operations
    CONFTEST: is_export_symbol_present_kthread_create_on_node
    CONFTEST: kuid_t
    CONFTEST: dma_ops
    CONFTEST: swiotlb_dma_ops
    CONFTEST: noncoherent_swiotlb_dma_ops
    CONFTEST: vm_fault_has_address
    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: 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: add_memory_driver_managed_has_mhp_flags_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_name
    CONFTEST: drm_bus_has_get_irq
    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_atomic_helper_crtc_destroy_state_has_crtc_arg
    CONFTEST: drm_driver_unload_has_int_return_type
    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: 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 [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-pci.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-dmabuf.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-acpi.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-cray.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-dma.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nvlink_linux.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nvlink_caps.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/linux_nvswitch.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/procfs_nvswitch.o
   In file included from ./include/linux/list.h:9,
                    from ./include/linux/preempt.h:11,
                    from ./include/linux/spinlock.h:51,
                    from /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/common/inc/nv-lock.h:29,
                    from /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/common/inc/nv-linux.h:32,
                    from /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-vm.c:26:
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-vm.c: In function 'nv_get_max_sysmem_address':
   ./include/linux/kernel.h:842:29: warning: comparison of distinct pointer types lacks a cast
     842 |   (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
         |                             ^~
   ./include/linux/kernel.h:856:4: note: in expansion of macro '__typecheck'
     856 |   (__typecheck(x, y) && __no_side_effects(x, y))
         |    ^~~~~~~~~~~
   ./include/linux/kernel.h:866:24: note: in expansion of macro '__safe_cmp'
     866 |  __builtin_choose_expr(__safe_cmp(x, y), \
         |                        ^~~~~~~~~~
   ./include/linux/kernel.h:882:19: note: in expansion of macro '__careful_cmp'
     882 | #define max(x, y) __careful_cmp(x, y, >)
         |                   ^~~~~~~~~~~~~
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-vm.c:225:26: note: in expansion of macro 'max'
     225 |         global_max_pfn = max(global_max_pfn, node_end_pfn(node_id));
         |                          ^~~
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/i2c_nvswitch.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-uvm/uvm_common.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-uvm/uvm_linux.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-uvm/nvstatus.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-uvm/uvm_push_test.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-uvm/uvm_channel_test.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-uvm/uvm_ce_test.o
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-uvm/uvm_pmm_gpu.c: In function 'uvm_pmm_gpu_alloc_kernel':
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-uvm/uvm_pmm_gpu.c:645:16: warning: unused variable 'gpu' [-Wunused-variable]
     645 |     uvm_gpu_t *gpu = uvm_pmm_to_gpu(pmm);
         |                ^~~
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-uvm/uvm_host_test.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-uvm/uvm_lock_test.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-uvm/uvm_perf_utils_test.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-uvm/uvm_kvmalloc_test.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-uvm/uvm_pmm_test.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-modeset/nv-kthread-q.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-drv.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-utils.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-crtc.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-encoder.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nv-pci-table.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-gem-user-memory.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-gem-dma-buf.o
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-crtc.c: In function 'cursor_plane_req_config_update':
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-crtc.c:88:32: warning: unused variable 'nv_drm_plane_state' [-Wunused-variable]
      88 |     struct nv_drm_plane_state *nv_drm_plane_state =
         |                                ^~~~~~~~~~~~~~~~~~
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-crtc.c:87:27: warning: unused variable 'nv_dev' [-Wunused-variable]
      87 |     struct nv_drm_device *nv_dev = to_nv_device(plane->dev);
         |                           ^~~~~~
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-format.o
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-crtc.c: In function 'plane_req_config_update':
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-crtc.c:189:9: warning: unused variable 'ret' [-Wunused-variable]
     189 |     int ret = 0;
         |         ^~~
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-crtc.c: In function 'nv_drm_plane_atomic_set_property':
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-crtc.c:504:32: warning: unused variable 'nv_drm_plane_state' [-Wunused-variable]
     504 |     struct nv_drm_plane_state *nv_drm_plane_state =
         |                                ^~~~~~~~~~~~~~~~~~
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-peermem/nvidia-peermem.o
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-crtc.c: In function 'nv_drm_enumerate_crtcs_and_planes':
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-crtc.c:1148:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    1148 |             struct drm_plane *overlay_plane =
         |             ^~~~~~
     LD [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia.o
   ld -r -o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-interface.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-pci.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-dmabuf.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-acpi.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-cray.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-dma.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-i2c.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-mmap.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-p2p.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-pat.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-procfs.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-procfs-utils.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-usermap.o /tmp/
   selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-vm.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-vtophys.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/os-interface.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/os-mlock.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/os-pci.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/os-registry.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/os-usermap.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-modeset-interface.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-pci-table.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-kthread-q.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-memdbg.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-ibmnpu.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-report-err.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia
   /nv-rsync.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-msi.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-caps.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv-frontend.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nv_uvm_interface.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nvlink_linux.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/nvlink_caps.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/linux_nvswitch.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/procfs_nvswitch.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia/i2c_nvswitch.o
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-modeset.c: In function '__will_generate_flip_event':
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-modeset.c:98:10: warning: unused variable 'overlay_event' [-Wunused-variable]
      98 |     bool overlay_event = false;
         |          ^~~~~~~~~~~~~
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-modeset.c:97:10: warning: unused variable 'primary_event' [-Wunused-variable]
      97 |     bool primary_event = false;
         |          ^~~~~~~~~~~~~
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm/nvidia-drm-modeset.c:96:23: warning: unused variable 'primary_plane' [-Wunused-variable]
      96 |     struct drm_plane *primary_plane = crtc->primary;
         |                       ^~~~~~~~~~~~~
   ld -r -o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-modeset/nv-modeset-interface.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-modeset/nvidia-modeset-linux.o /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-modeset/nv-kthread-q.o
     LD [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-modeset.o
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-peermem/nvidia-peermem.c: In function 'nv_mem_client_init':
   /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-peermem/nvidia-peermem.c:445:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     445 |     int status = 0;
         |     ^~~
     LD [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-peermem.o
     LD [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm.o
     LD [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-uvm.o
     Building modules, stage 2.
     MODPOST 5 modules
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm.mod.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-modeset.mod.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-peermem.mod.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-uvm.mod.o
     CC [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia.mod.o
     LD [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-modeset.ko
     LD [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-peermem.ko
     LD [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-uvm.ko
     LD [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia-drm.ko
     LD [M]  /tmp/selfgz37400/NVIDIA-Linux-x86_64-515.43.04/kernel/nvidia.ko
   make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-121-generic'
-> done.
-> Kernel module compilation complete.
-> Unable to determine if Secure Boot is enabled: No such file or directory
ERROR: Unable to load the kernel module 'nvidia.ko'.  This happens most frequently when this kernel module was built against the wrong or improperly configured kernel sources, with a version of gcc that differs from the one used to build the target kernel, or if another driver, such as nouveau, is present and prevents the NVIDIA kernel module from obtaining ownership of the NVIDIA device(s), or no NVIDIA device installed in this system is supported by this NVIDIA Linux graphics driver release.

Please see the log entries 'Kernel module load error' and 'Kernel messages' at the end of the file '/var/log/nvidia-installer.log' for more information.
-> Kernel module load error: No such device
-> Kernel messages:
[37531.841570] NVRM: GPU 0000:02:00.0: Failed to enable MSI-X.
[37536.301524] NVRM: GPU 0000:02:00.0: RmInitAdapter failed! (0x11:0x45:2543)
[37536.302678] NVRM: GPU 0000:02:00.0: rm_init_adapter failed, device minor number 0
[37536.303191] NVRM: GPU 0000:02:00.0: Failed to enable MSI-X.
[37540.780796] NVRM: GPU 0000:02:00.0: RmInitAdapter failed! (0x11:0x45:2543)
[37540.781799] NVRM: GPU 0000:02:00.0: rm_init_adapter failed, device minor number 0
[37582.335316] NVRM: GPU 0000:02:00.0: Failed to enable MSI-X.
[37586.815011] NVRM: GPU 0000:02:00.0: RmInitAdapter failed! (0x11:0x45:2543)
[37586.815848] NVRM: GPU 0000:02:00.0: rm_init_adapter failed, device minor number 0
[37586.816347] NVRM: GPU 0000:02:00.0: Failed to enable MSI-X.
[37591.304067] NVRM: GPU 0000:02:00.0: RmInitAdapter failed! (0x11:0x45:2543)
[37591.305176] NVRM: GPU 0000:02:00.0: rm_init_adapter failed, device minor number 0
[37619.249379] nvidia-nvlink: Unregistered the Nvlink Core, major device number 240
[37629.624069] nvidia-nvlink: Nvlink Core is being initialized, major device number 240
[37629.625964] nvidia 0000:02:00.0: vgaarb: changed VGA decodes: olddecodes=none,decodes=none:owns=none
[37629.626030] NVRM: The NVIDIA GPU 0000:02:00.0 (PCI ID: 10de:2235)
               NVRM: installed in this system is not supported by the
               NVRM: NVIDIA 515.43.04 driver release.
               NVRM: Please see 'Appendix A - Supported NVIDIA GPU Products'
               NVRM: in this release's README, available on the operating system
               NVRM: specific graphics driver download page at www.nvidia.com.
[37629.626210] nvidia: probe of 0000:02:00.0 failed with error -1
[37629.626232] NVRM: The NVIDIA probe routine failed for 1 device(s).
[37629.626232] NVRM: None of the NVIDIA devices were initialized.
[37629.626434] nvidia-nvlink: Unregistered the Nvlink Core, major device number 240
ERROR: Installation has failed.  Please see the file '/var/log/nvidia-installer.log' for details.  You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.

It says the version was not matched with my gpu, so I tried to install cuda toolkit 11.7.0, 11.6.2 and 11.6.0, but every try has failed and the error messages are same. What should I do?
My gpu is nvidia A40, and the environment is Linux x86_64 Ubuntu 20.04.

Please skip driver install during cuda runfile install. Install the driver using Software&Updates instead, possibly also enabling the graphics driver ppa.

1 Like

Thanks! It worked.