Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is it possible to switch between Nvidia's BLOB and Nouveau video drivers on-the-fly?

I think I need to be able to:

  1. [✓] Unload nvidia
  2. [✓] Unload nouveau
  3. [✕] Restore the console after unloading nouveau*
  4. [✓] Swap xorg.conf files
  5. [✓] Take care of blacklisting
  6. [✓] Deal with libglx.so

*) After a bit of talk with the guys at #nouveau, it seems to be difficult or even impossible with the current Ubuntu setup (builtin vesafb). I'm trying to get it to work with uvesafb, but for now the scripts in the answer do what I was looking for.

share|improve this question
    
sounds like a really risky deal O.o, you sure you want to do that? –  RolandiXor Dec 11 '10 at 20:39
3  
Risk means fun. :P –  htorque Dec 11 '10 at 21:21
    
Just in case, can you add the following lines in your script: chvt 1 chvt 7 Reference: hermann-uwe.de/tips-and-tricks/chvt –  ericb Mar 15 '13 at 22:37

4 Answers 4

up vote 6 down vote accepted

I now have two scripts that switch drivers, xorg.conf, take care of blacklisting and the libglx, so the answer is: yes, it is possible.

Blacklisting works with one file in /etc/modprobe.d/ containing either blacklist nvidia or blacklist nouveau. I also replaced /lib/nvidia-current/modprobe.conf with a dummy, else the nvidia driver would always create a link in /etc/modprobe.d/ that blacklists nouveau.

Switch to nouveau:

 #!/bin/bash
 stop gdm

 rmmod nvidia

 sed -i "s/nouveau/nvidia/" /etc/modprobe.d/blacklist-nvidia-nouveau.conf

 update-alternatives --set gl_conf /usr/lib/mesa/ld.so.conf
 ldconfig

 modprobe nouveau

 cp /etc/X11/xorg.conf{.nouveau,}

 start gdm

After executing that, I have nouveau running and a working console (nouveaufb).

Switch to nvidia:

#!/bin/bash
stop gdm

echo 0 > /sys/class/vtconsole/vtcon1/bind
rmmod nouveau
rmmod ttm
rmmod drm_kms_helper
rmmod drm

sed -i "s/nvidia/nouveau/" /etc/modprobe.d/blacklist-nvidia-nouveau.conf

update-alternatives --set gl_conf /usr/lib/nvidia-current/ld.so.conf
ldconfig

modprobe nvidia-current

cp /etc/X11/xorg.conf{.nvidia,}

start gdm

→ Nvidia driver is working, only problem: after unloading the nouveau driver, the console is unusable. I need a way to reset it or load another framebuffer, but since vesafb is compiled into the kernel I don't know what to do.

share|improve this answer
    
The main goal has been achieved, so I'm accepting this until someone can come up with a fix for the terminal problem. –  htorque Dec 12 '10 at 14:00

I don't believe it's possible to do, not only is the nouvou driver kernel mode setting and the nvidia one not, but the nvidia driver uses a hacked xorg library which makes even using the same install on a machine requiring the intel driver a problem. (see upside down elements bugs and questions)

share|improve this answer
1  
I think that's why they added the 'gl_conf' alternative. Using update-alternatives allows to easily switch between the Nvidia library and the "normal" one. –  htorque Dec 12 '10 at 9:12
#!/bin/bash
stop gdm

echo 0 > /sys/class/vtconsole/vtcon1/bind
rmmod nouveau
rmmod ttm
rmmod drm_kms_helper
rmmod drm

sed -i "s/nvidia/nouveau/" /etc/modprobe.d/blacklist-nvidia-nouveau.conf

update-alternatives --set gl_conf /usr/lib/nvidia-current/ld.so.conf
ldconfig

modprobe nvidia-current

cp /etc/X11/xorg.conf{.nvidia,}

start gdm
share|improve this answer

http://nouveau.freedesktop.org/wiki/KernelModeSetting/ suggests running /etc/init.d/consolefont restart after rmmod-ing nouevau to restore the text mode. Note that it has been renamed to console-font on more recent systems and in Ubuntu 13.10 it can not be called this way at all, but like this: service console-font restart

Also, it does not work always. In some cases starting X (service lightdm start - or whatever DM you are using) will start gfx mode and also give a working text mode when switching to vt1 (ctrl-alt-f1).

(I use this to install the nvidia driver into a live CD session)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.