Instalando o bendito driver NVIDIA 304

Publicado por Felipe Ruiz Peixoto em 21/05/2020

[ Hits: 6.634 ]

Blog: https://www.ubuntu.com/

 


Instalando o bendito driver NVIDIA 304



Olá! Depois de algum tempo sem postar nada, resolvi mostrar para vocês como eu consegui fazer o driver NVIDIA 304 rodar na GeForce 6100PM-M2 V3.0 com Ubuntu 18.

Eu vi diversos tutoriais, e muitos deles diziam que era impossível, que o melhor a ser feito era trocar o hardware, ou ficar com um ubuntu mais antigo, o 16.

Primeiro, tente instalar o driver da maneira normal, acessando as configurações do seu sistema, ou pelo seu gerenciador de pacotes preferido.

Caso não seja possível, prepare-se para uma longa jornada!

Instale o synaptic e o gdebi:

# apt-get install synaptic gdebi

Instale os pacotes necessários para o procedimento:

# dpkg --add-architecture i386
# apt-get install gcc make libc6:i386 libglvnd-dev pkg-config build-essential gcc-multilib dkms mesa-utils lightdm mate-desktop-environment ncurses-dev libncurses5-dev libssl-dev libelf-dev bison bc fakeroot git xz-utils

Baixe o driver "NVIDIA-Linux-x86_64-304.137.run" e coloque ele em uma pasta de fácil acesso (/home/usuário ou ~).

Baixe o patch "nvidia-304.137-bionic-18.04.patch" e coloque ele em uma pasta de fácil acesso (/home/usuário ou ~).

Baixe o kernel "linux-kernel-4.10.0-42.46", todos os seus arquivos.

Extraia o kernel:

# dpkg-source -x *.dsc

Para compilar o kernel, use os comandos abaixo:

# make menuconfig
# make
# make modules_install install

Configure seu kernel, ou deixe as opções padrão, e salve o arquivo com o nome .config, depois saia do menu de configuração.

No meu caso, eu tive que fazer algumas configurações, e tentar compilar o kernel várias vezes. As mudanças feitas foram:

CONFIG_XEN=y do arquivo .config para:

CONFIG_XEN=n

Link simbólico para a pasta include dentro de cada pasta do diretório ubuntu/vbox/, da pasta do source extraído do kernel.

Use este comando:

# ln -s ../include/

E no diretório ubuntu/vbox/vboxguest execute este comando:

# ln -s ../r0drv/

Para agilizar, deixarei aqui o meu arquivo .config, que deve ser copiado para a pasta do kernel extraído. Terminada a compilação, a pasta na qual a source do kernel foi extraída e compilada, é a linux-source deste kernel.

O caminho absoluto dela será usado na instalação do driver nvidia304, com o parâmetro --kernel-source-path.

Crie o script NVIDIA-Linux-src-path-script.sh conforme abaixo:

#!/bin/bash
#Altere o caminho conforme a sua necessidade
src_folder="/media/usuario/1234abcde-1234-5678-xxxx-aaaaaaaaaaaa/nvid304ubu18-1/linux-kernel-4.4.95/linux-4.4.0"
echo "Usando o caminho:"
echo $src_folder
sudo ./NVIDIA-Linux-x86_64-304.137.run --kernel-source-path $src_folder

Mude o caminho entre parênteses após a definição src_folder= para o caminho da pasta do kernel que você extraiu e compilou. Salve o arquivo em um local de fácil acesso, junto do driver, e dê a permissão de execução.

Reinicie o computador, e no menu do grub, desça para 'Opções avançadas', aperte enter, desça para a versão do kernel recém instalada, e aperte enter, para usar este kernel.

Execute o Synaptic, e desinstale os outros kernels, deixando apenas o kernel que você acabou de compilar e instalar.

Desative o driver Nouveau, executando como super usuário (sudo -s ou sudo su):

# cat << END > /etc/modprobe.d/disable-nouveau.conf
blacklist nouveau
blacklist vga16fb
blacklist rivafb
blacklist nvidiafb
blacklist rivatv
blacklist amd76_edac
options nouveau modeset=0
END


# update-initramfs -u
# echo options nouveau modeset=0 | tee -a /etc/modprobe.d/nouveau-kms.conf

Reinicie, e rode o kernel compilado. Insira os repositórios do Ubuntu Xenial (sources.list) na pasta /etc/apt do seu sistema, fazendo backup do arquivo original. Encerre a sessão (ou reinicie), não faca login no modo gráfico, aperte CTRL + ALT + F2, e faça login no modo texto, com seu usuário e senha.

Exemplo de sources.list do xenial:

# deb cdrom:[Ubuntu 18.04.2 LTS _Bionic Beaver_ - Release amd64 (20190210)]/ bionic main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu bionic main restricted
deb-src http://archive.ubuntu.com/ubuntu bionic universe multiverse main restricted #Added by software-properties

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu bionic-updates universe multiverse main restricted #Added by software-properties

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu bionic universe
# deb-src http://br.archive.ubuntu.com/ubuntu/ bionic universe
deb http://archive.ubuntu.com/ubuntu bionic-updates universe
# deb-src http://br.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu bionic multiverse
# deb-src http://br.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://archive.ubuntu.com/ubuntu bionic-updates multiverse
# deb-src http://br.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse #Added by software-properties

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu bionic partner
deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://archive.ubuntu.com/ubuntu bionic-security main restricted
deb-src http://archive.ubuntu.com/ubuntu bionic-security universe multiverse main restricted #Added by software-properties
deb http://archive.ubuntu.com/ubuntu bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://archive.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse

#COMPATIBILITY
deb http://archive.ubuntu.com/ubuntu xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial universe multiverse main restricted #Added by software-properties

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu xenial-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial-updates universe multiverse main restricted #Added by software-properties

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu xenial universe
# deb-src http://br.archive.ubuntu.com/ubuntu/ xenial universe
deb http://archive.ubuntu.com/ubuntu xenial-updates universe
# deb-src http://br.archive.ubuntu.com/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu xenial multiverse
# deb-src http://br.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://archive.ubuntu.com/ubuntu xenial-updates multiverse
# deb-src http://br.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse #Added by software-properties

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://archive.ubuntu.com/ubuntu xenial-security main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial-security universe multiverse main restricted #Added by software-properties
deb http://archive.ubuntu.com/ubuntu xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://archive.ubuntu.com/ubuntu xenial-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse

Instale o driver NVIDIA, executando sudo NVIDIA-Linux-src-path-script.sh. Não use DKMS para evitar problemas futuros, instale os softwares para 32 bits i386, e escolha a opção de mudar automaticamente o xorg.conf com o nvidia-xconfig.

Se ocorrer algum problema com o servidor X sendo executado, execute o comando sudo telinit 3, e tente novamente.

Reinicie, e entre no kernel compilado em modo recovery. Ative a rede para acessar a internet, e acesse o sistema em modo texto como root.

Instale o xserver-xorg-core na versão do Ubuntu Xenial, o mesmo irá desinstalar o ubuntu-desktop, xorg, e diversos outros arquivos.

Instale o xserver-xorg-core-hwe-16.04 e reinstale o ubuntu-desktop. Execute o comando startx. Se não funcionar, reinicie, com o comando reboot, e entre neste kernel compilado em modo normal.

Faca login alterando o ambiente do gnome padrao do Ubuntu para o Mate, execute o synaptic, bloqueie a versao do xserver-xorg-core, xserver-xorg-legacy-hwe-18.04 e do xserver-xorg-core-hwe-16.04, execute no terminal o nvidia-settings, e o glxgears.

Bugfix

O sistema pode apresentar erros de GLX. Abra o programa de configuração da NVIDIA, mude as configurações para aumentar a performance, desative o Sync to VBlank, Allow flipping, Texture Clamping, clique em nvidia-settings Configuration, clique em Save Current Configuration, salve no local padrão, clique em X Server Display Configuration, clique em Save to X configuration file, salve no local padrão.

Clique no botão para sair do programa, e salve o arquivo de configuração no local padrão. Modifique o arquivo .xinitrc adicionando a seguinte linha, antes da última linha que começa com a palavra exec:

nvidia-settings --load-config-only

Salve o arquivo, e feche o programa.

Reinicie, não faça login, aperte CTRL + ALT + F2, e reinstale o driver da NVIDIA.

Pode ocorrer erro ao tentar tocar videos MP4. Conserte isso instalando o ubuntu-restricted-extras, smplayer, e reinstalando o libvdpau:

# apt-get install ubuntu-restricted-extras --install-suggests
# apt-get install smplayer --install-suggests
# apt-get install libvdpau --install-suggests --reinstall

Para evitar outros problemas, troque o arquivo sources.list modificado no diretorio /etc/apt, pelo arquivo padrao do Ubuntu 18.

Se o erro persistir, abra o Synaptic, e reinstale tudo o que for relacionado ao vdpau (principalmente o libvdpau).

Caso ocorra erros com a execução de programas como jogos 3D, pode ser causado por uma corrupção nas bibliotecas de compatibilidade para 32 bits. Reinstale todo o nouveau, reinicie o computador, e reinstale o driver nvidia-304.

Entre no Synaptic e trave/bloqueie a versão do libnvidia-legacy-304xx-glcore.

Ainda no Synaptic, acesse a seção dos instalados, selecione todos com CTRL + A, clique no menu Pacote, e desmarque a opção Automaticamente instalado, para aumentar a capacidade de customização do sistema.

Limpe o sistema apagando os pacotes do /var/cache/apt/archives, ou executando o bleachbit (cuidado com ele!). Desinstale programas repetidos e desnecessários. Cuidado com as pastas /grub e /lib/modules. Podem armazenar arquivos de kernels anteriores aos que foram compilados, ocupando muito espaço no disco.

Pode ser necessário desativar o wayland, e instalar outra tela de login, que pode ser o lightdm.

Espero que este artigo ajude quem precisar instalar o driver. Vou disponibilizar uma screenshot, e alguns scripts mais tarde. FLWS!

Outras dicas deste autor

A conio.h para GNU/Linux

Web-ICQ no GNU/Linux - Como colocar no site e criar botão para executar

[RESOLVIDO] Links e botões que não funcionam no navegador

Scripts facilitadores para live streaming

"RPG Maker" escrito em Python e Pygame

Leitura recomendada

Atualizando kernel no Debian 6 - 32 bits

Slackware com kernel 3.10 - Erro com driver NVidia [Resolvido]

Solucionando problemas com o ALSA

Kernel compilado para o AA1 no UNR

Como suspender/hibernar o computador via linha de comando

  

Comentários

[2] Comentário enviado por fibios em 30/07/2020 - 22:07h

Boa noite amigo
Tive muitos problemas com o drive da NVIDIA 304.137, porém instalei uns meses atrás no Linux Mint (quaisquer baseado no 18.04) com o auxilio desse tutorial aqui:

https://ubuntuforums.org/showthread.php?t=2396263

muito fácil de fazer, basicamente é um patch que você instala no pasta do driver, coloca na blacklist xserver-xorg-core, entra com CTRL+ALT+F2 ou F1, desativa o lightdm e instala o driver e reinicia. Funciona perfeitamente, no final reinstala o libvdpau.

Porém esse procedimento só tem funcionado com o Kernel 4.xxx, nos Kernels 5.xxx não funcionam, então seria interessante um tutorial para este novo Kernel. Já tentei dois procedimentos que envolvem patch, no entanto, sem sucesso.

Grato pelo tempo.



Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts