Ubuntu 17.10安装CUDA 9遇阻,求助解决NVIDIA驱动更新问题
Hey there, let’s walk through some practical steps to fix the CUDA installation errors you’re hitting—especially since you’ve had success with the 384.111 driver before, there’s a good chance we can resolve this with targeted cleanup and adjusted installation steps.
1. First, Verify Your Current Driver State
Before diving into fixes, let’s confirm what’s actually running on your system. Run these commands to get clarity:
nvidia-smi: This will show your active NVIDIA driver version and GPU status. If the driver isn’t loaded properly, it’ll throw an error.dpkg -l | grep nvidia: Lists all NVIDIA-related packages installed on your system. Look for old, conflicting versions or partial installs that might be blocking things.
2. Fully Clean Up Old Driver Residues (Critical!)
Most CUDA installation failures stem from leftover driver files conflicting with the new setup. Let’s wipe all NVIDIA-related packages completely:
sudo apt-get purge nvidia* sudo apt-get autoremove sudo apt-get autoclean
Reboot your system after this, then run lsmod | grep nvidia—if there’s no output, you’ve successfully cleared all old driver components.
3. Reinstall CUDA with the Right Flags
You mentioned using "unsafe mode" (likely nomodeset) to run the installer, but let’s adjust the process to avoid conflicts:
- Skip the bundled driver: CUDA 9.0 is designed to work with the 384.x driver series (which you’ve already used successfully). When the installer prompts you to install the NVIDIA driver, select No to avoid overwriting or conflicting with existing compatible files.
- Ensure X server is stopped: Even in nomodeset mode, double-check that the display server is shut down. For Ubuntu 17.10’s GNOME desktop, run:
sudo systemctl stop gdm - Run the installer with override: Add the
--overrideflag to bypass strict version checks that might be triggering errors:sudo sh cuda_9.0.176_384.81_linux.run --override
4. Configure Environment Variables & Verify Installation
After installation, set up your system to recognize CUDA tools. Add these lines to your ~/.bashrc file:
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Apply the changes with source ~/.bashrc, then verify:
nvcc -V: Should display your CUDA 9.0 version.nvidia-smi: Should show the 384.x driver running alongside CUDA 9.0.
5. If Errors Persist, Grab Installation Logs
CUDA generates a detailed log file at /var/log/cuda-installer.log. Pull the error messages from this file—common issues include mismatched kernel headers (install them with sudo apt-get install linux-headers-$(uname -r)) or incompatible GCC versions (Ubuntu 17.10 uses GCC 7 by default; CUDA 9 may require GCC 6, which you can install and switch to temporarily).
内容的提问来源于stack exchange,提问作者Conrad Strasheim

