银河麒麟 关闭 X 服务器的情况下成功安装 NVIDIA 驱动

bash 复制代码
nvidia-installer log file '/var/log/nvidia-installer.log'
creation time: Thu Sep 19 21:23:01 2024
installer version: 560.35.03

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 20 CPUs online; setting concurrency level to 20.
-> Scanning the initramfs with lsinitramfs...
-> Executing: /usr/bin/lsinitramfs   -l /boot/initrd.img-5.10.0-9-generic
-> The file '/tmp/.X0-lock' exists and appears to contain the process ID '33536' of a running X server.
-> You appear to be running an X server.  Installing the NVIDIA driver while X is running is not recommended, as doing so may prevent the installer from detecting some potential installation problems, and it may not be possible to start new graphics applications after a new driver is installed.  If you choose to continue installation, it is highly recommended that you reboot your computer after installation to use the newly installed driver. (Answer: Abort installation)
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. 

日志表明,NVIDIA 驱动安装失败的原因是 X 服务器正在运行,而 NVIDIA 驱动安装程序不推荐在 X 服务器运行时进行安装。这可能会导致潜在的安装问题,并且在安装完成后,可能无法正常启动新的图形应用程序。

问题分析:

正在运行的 X 服务器:X 服务器是 Linux 系统中的图形界面处理组件,当你在使用桌面时,它通常在后台运行。安装 NVIDIA 驱动时,必须关闭 X 服务器,否则安装可能失败。

推荐的操作:安装程序建议你关闭 X 服务器再继续安装,并在安装完成后重启系统来使新的驱动生效。

解决方案:

1. 关闭 X 服务器再安装:

切换到纯文本模式,按 Ctrl + Alt + F2(或 F3、F4 等)进入命令行界面。

登录你的系统,然后关闭 X 服务器:

bash 复制代码
sudo systemctl stop lightdm  # 对于 Ubuntu 或 Kylin 等桌面环境

或者:

bash 复制代码
sudo systemctl stop gdm  # 如果你使用的是 GNOME

在关闭 X 服务器之后,重新运行 NVIDIA 安装程序:

bash 复制代码
sudo ./cuda**--no-cc-version-check --install-libglvnd

安装完成后,重新启动系统:

bash 复制代码
sudo reboot

2. 切换到恢复模式安装

如果你不想在 X 服务器运行时手动停止它,你可以选择在系统启动时进入恢复模式(Recovery Mode),以命令行方式安装驱动。在 GRUB 菜单上,选择 "Advanced options" 然后选择 "Recovery mode",此时系统将以命令行模式启动,不会启动 X 服务器。然后运行安装程序。

3. 禁用 Nouveau 驱动: 确保 Nouveau(开源的 NVIDIA 驱动)已被禁用:

编辑 /etc/modprobe.d/blacklist.conf 文件:

bash 复制代码
sudo vim /etc/modprobe.d/blacklist.conf

添加以下内容:

bash 复制代码
blacklist nouveau
options nouveau modeset=0

生成新的 initramfs:

bash 复制代码
sudo update-initramfs -u

检查依赖项: 安装必要的依赖项,确保驱动安装过程中不会出现缺少软件包的问题:

bash 复制代码
sudo apt-get update
sudo apt-get install build-essential linux-headers-$(uname -r)

银河麒麟 后面还是遇到了 权限问题

相关推荐
虎头金猫3 天前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
AI职业加油站3 天前
AI智能体应用工程师证书:政策红利下的职业新风口
大数据·运维·人工智能·学习·职场发展
此冬歌咏3 天前
K8s 节点故障实战:优雅驱逐 31 秒,硬故障 331 秒,以及那个永远 Pending 的 Pod
运维·k8s
-梅3 天前
linux(8) 软硬链接
linux·运维·服务器
Wang's Blog3 天前
Java 项目实战: 外卖平台-文件下载与ServletOutputStream回写浏览器
服务器·项目开发
张洛闻Eren3 天前
k8s云原生【第十课】:水平 Pod 自动扩缩容
运维·数据库·云原生·kubernetes·github
琥珀色糖3 天前
SimlpeHttp
linux·服务器
其实防守也摸鱼3 天前
内网穿透与反向代理:原理、工具与实战指南
android·大数据·运维·安全·网络安全·自动化·渗透
第十人i3 天前
Linux 日志管理系统:journald 配置与优化
linux·服务器
布裘3 天前
【银河麒麟】V4桌面图标消失,右击鼠标没反应排查
运维·银河麒麟·桌面环境