Ubuntu20.04或者Ubuntu24.04 TypeC-连接屏幕不显示问题
一、环境
设备:机械革命苍龙16 Ultra
显卡:NVIDA GeForce RTX 5080
系统:windows11+Ubuntu24.04的双系统
显示器:笔记本显示器+redmi 显示器A27Q(使用的type-c接口)+ HKC OVERSEAS LIMITED27
驱动:nvidia-driver-580
二、存在问题。
HKC显示器用HDMI连接,可以直接显示,而redmi显示器用typec连接笔记本但是不显示,而在windows系统下是可以显示。只有在Ubuntu下不显示。
三、解决方案
使用命令:prime-select query,查询得到当前的结果为on-demand。
使用命令:sudo prime-select nvidia,强行修改使用nvidia进行显示器的驱动。
文件:sudo gedit /usr/share/X11/xorg.conf.d/10-nvidia.conf的内容如下:
# This xorg.conf.d configuration snippet configures the X server to
# automatically load the nvidia X driver when it detects a device driven by the
# nvidia-drm.ko kernel module. Please note that this only works on Linux kernels
# version 3.9 or higher with CONFIG_DRM enabled, and only if the nvidia-drm.ko
# kernel module is loaded before the X server is started.Section "OutputClass"Identifier "nvidia"MatchDriver "nvidia-drm"Driver "nvidia"Option "AllowEmptyInitialConfiguration"ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg"
EndSection
文件:sudo gedit /etc/default/grub的内容如下:
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`( . /etc/os-release; echo ${NAME:-Ubuntu} ) 2>/dev/null || echo Ubuntu`GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nvidia.NVreg_RegistryDwords=EnableBrightnessControl=1"
GRUB_CMDLINE_LINUX=""# If your computer has multiple operating systems installed, then you
# probably want to run os-prober. However, if your computer is a host
# for guest OSes installed via LVM or raw disk devices, running
# os-prober can cause damage to those guest OSes as it mounts
# filesystems to look for things.
#GRUB_DISABLE_OS_PROBER=false# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"# Uncomment to disable graphical terminal
GRUB_TERMINAL=console# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=640x480# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
将grub文件中GRUB_CMDLINE_LINUX_DEFAULT行的nomodeset关键字删除。
此文件修改之后,需要使用命令:sudo update-grub,更新以使其生效。