Ubuntu22.04 install cuda toolkit
그간 인터넷 서칭을 통해 별 무리없이 쿠타툴킷을 설치해오던 어느날 드디어 이러저러해도 해결이 안되는 순간을 만났습니다.
결국 설치 문제의 원인은 GCC버전이 쿠다툴킷에 맞지 않는 11버전이었다는 것~
(gcc와 g++는 GNU Compiler Collection의 일부로, 각각 C와 C++ 프로그래밍 언어를 컴파일해 실행파일로 바꿔준다.)
cuda_12.4.1_550.54.15_linux.run에 알맞은 gcc-12, g++-12버전으로 설치하길
Steps to Fix:
1. Install gcc-12
- Run the following commands to install gcc-12:
-
sudo apt update sudo apt install gcc-12 g++-12
2. Set gcc-12 as the Default Compiler
- Temporarily set gcc-12 for the current session:
export CC=/usr/bin/gcc-12
- Alternatively, set it globally by updating your default compiler:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12 sudo update-alternatives --config gcc sudo update-alternatives --config g++
쿠다툴킷 다운받고
sudo apt update
z@z-dt:~/Downloads$ sudo sh cuda_12.4.1_550.54.15_linux.run
Failed to verify gcc version. See log at /var/log/cuda-installer.log for details.
z@z-dt:~/Downloads$ sudo apt update
sudo apt install build-essential
첫 설치: Nouveau kernel driver 관련 불능
lsmod | grep nouveau
(파일이 없다면 생성하고 아래 내용 적어주기)
$ sudo vi /etc/modprobe.d/blacklist-nouveau.conf
(파일 안에 넣어야 할 내용)
(점선은 넣는거 아니에요, 점선 사이에 있는 내용만 사용해주세요)
------------------------------------------------------------------------------------------
blacklist nouveau
options nouveau modeset=0
------------------------------------------------------------------------------------------
(파일에 위 내용 추가하고 저장 후 닫기, 아래 명령어도 실행하여 설정 변경시키자, 그리고 재부팅!!)
$ sudo update-initramfs -u
$ sudo reboot
재부팅 후 다시 처음으로 돌아가서 설치
아래 등 여러 이유로 재설치
v@v-d:~$ nvidia-smi
Failed to initialize NVML: Driver/library version mismatch
NVML library version: 565.57
"NVML 초기화 실패: 드라이버/라이브러리 버전 불일치" 오류는 일반적으로 NVIDIA GPU 드라이버와 NVML 라이브러리 간에 버전 불일치가 있을 때 발생합니다. 이 문제를 해결하기 위한 몇 가지 단계는 다음과 같습니다.
1. 자동 업데이트 비활성화
먼저, 업데이트로 인한 버전 불일치를 방지하기 위해 자동 업데이트를 비활성화합니다. Ubuntu에서는 다음을 실행하여 이를 수행할 수 있습니다.
sudo dpkg-reconfigure unattended-upgrades
메시지가 나타나면 "아니요"를 선택하세요.
2. 기존 드라이버 및 라이브러리 제거
기존의 모든 NVIDIA 드라이버 및 라이브러리를 제거합니다.
sudo apt purge nvidia* libnvidia*
lsmod | grep nvidia
기존 설치된 nvidia파일들이 보인다면 GUI(그래픽 사용자 인터페이스)를 우회하고 텍스트 기반 콘솔로 전환해 X-window와 연계된 기존 nvidia드라이버 제거
@codeguyross , I had the same issue during my installation, this is the way I fixed it:
- A NVIDIA kernel module is this case nvidia-drm is already loaded, in my case I stopped the display manager and turn off the graphical interface executing sudo systemctl stop gdm or pressing Ctrl + Alt + F3 (another combination could be Ctrl + Shift + F3) this will take you to a text-based login screen.
- sudo systemctl stop display-manager
한번 더 Ctrl + Alt + F3 Log in with your username and password
- execute sudo rmmod nvidia-drm nvidia-modeset nvidia , this will unload the NVIDIA modules
- check if any modules are still loaded
- lsmod | grep nvidia
- run the CUDA installation again, in my case: sudo sh cuda_12.6.1_560.35.03_linux.run
- the installer is most likely located in the folder Downloads , so you can execute
- sudo sh ./Downloads/cuda_12.6.1_560.35.03_linux.run
- run nvcc --version and nvidia-smi to see if you installed everything correctly
- turn on the graphical interface Ctrl + Alt + F2 or Ctrl + Shift + F2 or executing sudo reboot
I hope this can be helpful
nvidia-smi
nvcc -V
echo 'export PATH=/usr/local/cuda-12.4/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
이번에는 카톡도~
[linux]카카오톡 설치하기 (ubuntu 22.04 desktop)
linux 카카오톡 설치하기 (ubunte 22.04 desktop)
velog.io
바로가기 등록하고 실행
글꼴 ㅁㅁ 는 맑은고딕 글꼴 넣어주기
다시 설치는
sudo apt purge nvidia-*
sudo apt autoremove
v@v-d:~/Downloads$ lsmod | grep nvidia
nvidia_uvm 4931584 0 nvidia_drm 122880 8 nvidia_modeset 1355776 9 nvidia_drm nvidia 54104064 122 nvidia_uvm,nvidia_modeset video 73728 4 asus_wmi,amdgpu,asus_nb_wmi,nvidia_modeset
ctrl+alt+F3 TTY("Teletypewriter"의 약자로, Linux 시스템에서는 독립적인 터미널 세션)로 전환
sudo systemctl stop gdm
ctrl+alt+F3
sudo rmmod nvidia-drm nvidia-modeset nvidia
sudo sh ./Downloads/cuda_12.6.1_560.35.03_linux.run
GPU모니터링은 nvitop이 굿
sudo apt install nvitop