Optimal Ubuntu Graphics Setup for Thinkpads
Motivation
This setup, combined with thinkdisp will get you:
1) Multiple Monitors
2) Working 3D Acceleration on all displays (so compiz effects work)
3) Power saving when mobile (Nvidia card off)
4) Safe updating without killing the multimon setup
5) The ability to use VT-x (which has to be disabled in BIOS in discrete-only mode due to a bug)
If you’d like to learn more about how the graphics are wired and why these workarounds are necessary, check out Zachary Sunberg’s post here. None of this would have been possible without his original guide, which can be found in the sources at the end of this page. Additionally, if you’re running Arch Linux, check out Gordin’s adaptation of this guide for Arch.
For guaranteed success, you should follow these instructions to the letter. I’ve been able to successfully perform them multiple times on a clean install of 12.04 x64 on my W520.
Instructions
First, go ahead and install Bumblebee. This gives you the ability to switch the nvidia card on/off in Optimus Mode (make sure this is set in BIOS).
Once that’s done, reboot. Next, you’ll install some dependencies for later parts.
Now, patch and install the Intel Graphics Driver to allow it to support a virtual display. (Thanks to liskin for the patch)
Reboot again. At this point, if you execute xrandr in terminal, you should see two displays listed, one of them will be named VIRTUAL. This indicates that everything has installed correctly up to this point. Next, you’ll need to install screenclone, which copies the VIRTUAL display to your external display. (Thanks again to liskin, the developer of screenclone).
Now, as explained here, you’ll need to make the following modifications to /etc/bumblebee/bumblebee.conf:
You can see a copy of my bumblebee.conf for reference here. If everything seems to have installed without error, reboot one last time. Now connect your VGA or Displayport monitor and do the following: (thanks to RCSIRIUS in the comments below for confirming Displayport functionality)
A few seconds after running screenclone, you should have a functional external monitor! If you get a flashing cursor for more than about 5 seconds, something is wrong with your configuration files above, try following the guide again.
Next, we’ll hold the xserver-xorg-video-intel package so that you can update safely without killing your multimon setup.
Finally, to make this usable as a daily-driver, I suggest installing thinkdisp, an indicator applet I developed that automates display on/off, nvidia card on/off, and status checking. You can find the installation guide here (don’t worry, it’s much simpler than this).
Sources
http://zachstechnotes.blogspot.com/2012/04/post-title.html
http://zachstechnotes.blogspot.com/2012/01/tri-head-display-on-linux-thinkpad-w520.html
https://github.com/Bumblebee-Project/Bumblebee/issues/122
https://help.ubuntu.com/community/PinningHowto#Introduction%20to%20Holding%20Packages
By Jsmith54 June 15, 2012 - 7:41 pm
This worked perfectly! I spent the past month trying to achieve a similar setup but to no avail. Also easy to follow for newbies like me
By Sagar Karandikar June 16, 2012 - 12:34 pm
I’m glad that you found it useful
By Sirius June 21, 2012 - 12:27 pm
Thank you very much.
I’ve been looking for ways to utilizaar two monitors since I bought it, but only this has worked. Also works with DisplayPort and you can add more resolutions to xrand thinkdisp.py and THANKS
By rcsirius June 21, 2012 - 12:35 pm
Great, thank you.
It has worked well, even with the Displayport. I have only tended to add a few resolutions for the monitors I have, but it has worked very well.
thanks
By Sagar Karandikar June 21, 2012 - 5:53 pm
Thanks, I updated the post to reflect this.
By Yves PERREY June 22, 2012 - 10:08 pm
Great job, works great.
Thank you very much!
By Mguel June 23, 2012 - 5:05 am
Hi, first thanks for the hacking, the guide, answering the questions and ultimately making the thinkpad w520 more linux friendly.
About the guide: It’s giving me errors
maybe because I used Zachs guide first: http://zachstechnotes.blogspot.com/2012/04/post-title.html ? don’t know…
The steps went ok with no errors. It’s when I reboot now get an error and if I try to activate other monitor with thinkdisp, it freezes. The first time it actually showed a screen on the external monitor but for part of the display (preferences where with a lower resolution). So I disconect display to change preferences and connect again but it freezed when I pressed turn display off. Rebooted changed settings, but they didn’t stick so finally changed manually pref.ini on /home/Documents/thinkdisp to 1920×1080 and left instead of right. But then every time I tried to turn display on, it freezed.
Besides the freezed when I reboot, it gives me some errors, and lubuntu asks me if I want to report them (without showing me details of the problem itself)
I’m on lubuntu 12.04 (fresh install about a month ago), thinkpad w520, bios set to Optimus, and as I told before, followed this guide http://zachstechnotes.blogspot.com/2012/04/post-title.html before following this one…
cheers, and I appreciate any help I could get
Mguel
By Sagar Karandikar June 24, 2012 - 3:36 am
Are you still able to turn on the external display with manual optirun/xrandr/screenclone like in gist #6?
By Mguel June 24, 2012 - 3:13 pm
Hi! thanks for the answer. Right now I’m not in a place where I can test it (missing the cable), but in a couple of hours I’ll be able to test and I’ll report back. Thanks!
By Mguel June 24, 2012 - 7:30 pm
OK I have the same results really when using thinkdisp and optirun/xrandr/screenclone:
I can activate the external display if I use –right-of or right on thinkdisp. If I use “left”, it always freezes with xrandr or thinkdisp at any tested resolution.
the other strange thing is that the external display is very ugly and it seems low res (1024×768) which is not a mode on virtual display, so to be able to see the lubuntu “System Tray” icons (ie thinkdisp) I had to use a resolution of 800×600. If I use any thing bigger I can’t see them.
(I’m using a samsung fullhd led lcd connected with vga cable, don’t have a displayport to hdmi converter to test) On windows it doesn’t let me have the 1920×1080, if I select it, it goes to 1600×1200. In linux if I use xrandr to 1600×1200 or higher the lcd info says its at 1024×768
Thanks!
By Sagar Karandikar June 25, 2012 - 12:57 am
That is quite odd. I have a feeling that the “left” setting will work once you get the correct resolution for the external display. What happens when you try to set it to 1920×1080 in lubuntu?
By Mguel June 25, 2012 - 4:35 am
Hi, thanks for the reply!!
It displays only a part of the panel (task bar), and if I press “Info” on my lcd remote control, it displays “1024×768 @ 60 Hz”.
I don’t think it has to do much with the external monitor resolution actually, because the first time I tried it was at a colleague house with other monitor, and the behaviour was the same. Now to test it more I bought a VGA cable and test it on my home LCD. The other day the first time I tried it, it displayed only on part of the screen (was using the 1440x… that is set by default) and when I tried to disable it it freezed. Then after rebooting, and setting the pref.ini to 1920×1080 (also a fullHD monitor) to the left it freezed and never could make it work again (today testing it I realized that it works more to the right… strange… but even to the right has some ackward behaviour.
Is there a way to reverse it all back and maybe do it all again?
or is there some sort of log which could be of use? (I’m more of a newbie
so not sure what every step do actually or how to reverse each one of them)
By Sagar Karandikar June 25, 2012 - 2:21 pm
Your best bet is probably to try and start from scratch on the clean install. This entire process is extremely finicky and has only ever worked for me when following this guide from scratch. There’s a lot of weird overlap between drivers written by different people and I don’t know of a way to revert it all to stock without knowing exactly what was previously installed.
On an unrelated note, looks like I need to fix some CSS :p These narrow-width nested replies are really hard to read haha.
By Mguel June 26, 2012 - 1:44 am
I was on a clean install, installed a couple of weeks ago, so the drive installed previously was only the one through synaptic update
now I’m trying to undo things with:
- disabling bumblebee repositories
and “release” the hold on intel driver:
sudo -s
sudo echo xserver-xorg-video-intel install | dpkg –set-selections
should I uninstall bumblebee and bumblebee-nvidia?
By Mguel June 26, 2012 - 1:47 am
restored xorg.conf (before bumblebee)
By Sagar Karandikar June 26, 2012 - 8:16 pm
Yeah, at the very least I would recommend uninstalling everything graphics-driver-related.
By Gordon June 26, 2012 - 12:13 am
hallo sagar,
thank you very much for this. i love it.
i have only one problem. did you know how make this work for two external monitors?
best regards
gordon
By Sagar Karandikar June 26, 2012 - 12:59 am
Unfortunately, I don’t have access to a Displayport monitor so I haven’t been able to test it out. I don’t think it will work though because people were having problems with 2 external displays even in Windows.
By Gordon June 26, 2012 - 6:46 am
thanks for the replay,
i will work on it.
i note that dvi also works.
By Sagar Karandikar June 26, 2012 - 8:15 pm
Thanks, let me know if you get it working!
By dojuba June 28, 2012 - 8:47 am
Many many thanks for this post. Followed it by making changes necessary for my debian system. Works like a charm on my Lenovo W520.
By Gordin June 30, 2012 - 2:59 pm
Thanks for this guide. Finally I have a working setup on my W520
I adapted this guide for archlinux here if anyone cares: http://blog.gordin.de/post/optimus-guide
Also, in my version I use “optirun screenclone -d :8 -x 1″ instead of running optirun true. This you don’t have to handle the second X server yourself and you can use bbswitch as PMMethod to handle starting and shutting down the nvidia card. Maybe you can use that to simplify your guide.
By Sagar Karandikar July 1, 2012 - 6:27 pm
Great! I’ll throw in a link at the top to direct Arch Linux users to your guide.
By Jacob Beard August 4, 2012 - 7:02 am
+1 to this advice!
Using “optirun true” and the bumblebee.conf mentioned in the main article was extremely flaky. It would usually work one time, the first time I called “optirun true” afer starting my computer. But it would fail to turn on the external monitor in many cases, such as after a suspend/resume cycle. The setup mentioned in the main article has the added disadvantage of disabling power management settings in bumblebee, which I feel is precisely the point of using optimus and bumblebee.
Using the technique in Gordin’s post, however, would seem to resolve this, as it turns the NVidia card on on-demand, and uses bbswitch for power management in bumblebee.conf. It’s been a very reliable technique so far.
By Sagar Karandikar August 4, 2012 - 7:24 am
If you use this with thinkdisp as stated at the end of the article, everything is handled in the same way as in Gordin’s post. Thinkdisp only turns on the card (with bbswitch) when you are using an external display and has it off otherwise.
The built-in power management in bumblebee won’t do anything more here since we have 2 cases that are “physically triggered” so to speak – external monitor on, where the nvidia card /must/ be on and external monitor off, where the nvidia card should be off.
As to your issues with suspend/resume, there shouldn’t be a difference between Gordin’s approach and mine (with thinkdisp). Were you leaving the external display/second x-server/nvidia card on when suspending?
By Garble July 11, 2012 - 8:08 am
This is awesome! Thank you, it worked
By Empoulator July 21, 2012 - 6:37 am
It is not working for me
. I like the guide anyway, thanks.
After typing optirun true, I get the following message:
[ERROR]Cannot access secondary GPU – error: [XORG] (EE) NVIDIA(0): Failed to assign any connected display devices to X screen
Typing screenclone -d :8 -x 1 leads to:
terminate called after throwing an instance of ‘std::runtime_error’
what(): screenclone.cc:78 display
Any idea of what I can do?
By Sagar Karandikar July 21, 2012 - 6:39 am
Do you have the card set to Optimus Mode in BIOS?
By Empoulator July 21, 2012 - 2:25 pm
Yes I do have this mode set in BIOS.
I do see the virtual screen when I type xrandr.
The command optirun glxspheres still gives:
[ERROR]Cannot access secondary GPU – error: [XORG] (EE) NVIDIA(0): No display devices found for this X screen.
The graphic card was working before this set of instructions… I don’t have a clue how to come back to the previous one.
Best regards,
Pierre
By Empoulator July 25, 2012 - 7:05 am
The problem may come from the fact that I use “Gnome Classic (no effect)” rather than the standard Ubuntu settings ?
By Empoulator July 25, 2012 - 7:13 am
After redoing all the steps on Ubuntu 12.04 (standard mode rather than Gnome no effects mode), it appears that optirun works again !
Unfortunately, the command
screenclone -d :8 -x 1
Still leads to:
terminate called after throwing an instance of ‘std::runtime_error’ what(): screenclone.cc:78 display
Best regards
By Sagar Karandikar July 25, 2012 - 8:23 am
Are you trying this on a clean install? When I was figuring this all out, I would get:
terminate called after throwing an instance of ‘std::runtime_error’ what(): screenclone.cc:78 displayIf something was wrong with the preexisting configuration.
By Empoulator July 30, 2012 - 5:11 am
Dear Sagar Karandikar,
thanks a lot for your fast replies. I will check my installation carefully.
Maybe reinstalling Ubuntu could be a good solution for me.
best regards,
Empoulator
By Empoulator July 30, 2012 - 6:23 am
I apologize for these multiple posts on your website.
I just upgraded to ubuntu 12.04 and it is not working…
I don’t know how to clean ubuntu without losing important files/configs so that I won’t reinstall it from scratch unless I do not find an easier solution.
Maybe the following indications can help you.
At start, I get some error messages (translated from French) :
Xorg stopped in an unexpected manner.
Package : xserver-xorg-core-2:1.11.4-0ubuntu10.6
xorg assert failure …/intel_bufmgr_gem_init: Assertion ’0′ failed
Then screenclone crashes too.
In the list of commands you indicate, I cannot do :
sudo rm /etc/X11/xorg.conf
the file is non existent. This seems to indicate there is a problem with my config, but I don’t see a solution except this full reinstallation.
I thank you again for your precious time.
sudo rm /etc/X11/xorg.conf
By bdk August 7, 2012 - 1:09 am
I had the same problem; turns out you need to run ALL of gist #6 as root. I was running it as a normal user, then I ran them, all 3 commands as root and it worked Perfectly!
By Empoulator August 7, 2012 - 11:37 am
Dear Sagark,
It finally worked ! Thanks a lot for your concern.
Thanks also to BDK for his advice. It could indeed be better to add the sudo stuff in your post (patch, wget, git, screenclone), but this was not the point.
I should have read Gordon’s post earlier.
The simple solution was to type :
optirun screenclone -d :8 -x 1
instead of
screenclone -d :8 -x 1
I guess it could be good to indicate this alternative command on your post since my config has nothing particular.
Very best regards and thanks again for your nice job ! I guess you will follow your dream easily and become a free software developper.
By Daniel Wainwright July 24, 2012 - 7:38 pm
I have this mostly working on a Dell XPS. The display on the laptop monitor is cloned onto an external monitor on the hdmi port, but the resolution on the external display is only 640×480, showing me just the top left corner of the desktop. Do you know how I can go about correcting this?
By Sagar Karandikar July 25, 2012 - 8:28 am
This might be a result of your monitor not handling resolution in a standard way. What usually happens with this implementation is that the monitor always stays at its native resolution and setting a lower or higher resolution causes the desktop to either not take up the whole display or extend off the display. So the resolution “on the monitor” never really changes. I’ll look into this to see if I can fix it, but I suspect that it’ll be rather complicated since there’s little documentation.
By s1ck August 3, 2012 - 2:54 pm
Hey, thanks for the great explanation. Unfortunately, I got the same error like “EMPOULATOR”. After running screenclone -d :8 -x 1 it crashes with:
terminate called after throwing an instance of ‘std::runtime_error’
what(): screenclone.cc:390 main
Also there is no xorg.conf to remove in /etc/X11
Maybe someone had the same error and has an advice on how to fix this. Working with my external HDMI monitor would be great
Again, thanks for your guide!
By Sagar Karandikar August 4, 2012 - 7:32 am
Have you previously done anything related to bumblebee or graphics drivers? Also, can you post what version of the intel drivers and bumblebee you’re using?
By bdk August 7, 2012 - 1:13 am
I replied to EMPOULATOR above, that I had the same problem as him and you, turns out you need to run ALL of gist #6 as root. I was running it as a normal user, then I ran them, all 3 commands as root and it worked Perfectly!
SAGAR – Works perfectly on my W530; was getting nervous that I would not be able to use my external monitor. I followed everything step by step, except for the montor resolution. Works awesome! Off to install thinkdisp.
By Sagar Karandikar August 7, 2012 - 6:10 am
Thanks for letting me know about the root thing! I’ll make sure everything else works on a clean install at the end of this week and update the guide.
By s1ck August 7, 2012 - 1:43 pm
ah, thx a lot. I will try this out.
By Yet Another JavaScript Blog » Thinkpad W520 Multi-Monitor nVidia Optimus with Bumblebee on Ubuntu 12.04 August 4, 2012 - 12:05 pm
[...] http://sagark.org/optimal-ubuntu-graphics-setup-for-thinkpads [...]
By Jacob Beard August 4, 2012 - 12:10 pm
Hi Sagar,
Thanks for the great post. I made a few tweaks to your method based on Gordin’s blog post, and wrote about my overall results here: http://blog.echo-flow.com/2012/08/04/thinkpad-w520-multi-monitor-nvidia-optimus-with-bumblebee-on-ubuntu-12-04/
By Jethro August 5, 2012 - 5:20 pm
Had to do this to be able to build screenclone:
sudo apt-get install libxcursor-dev libxdamage-dev libxinerama-dev libxtst-dev
By optimus1234 August 6, 2012 - 5:09 am
Thanks for a straight forward guide to solving this pesky problem!
I have followed your guide with a clean install of Ubuntu 12.04 on a Thinkpad W520. All steps in the guide were carried out successfully and xrandr shows the VIRTUAL display. However, running screenclone results in a flashing cursor for more than five seconds as you mentioned, and I have re-followed the installation instructions several times. Any ideas what could be wrong?
As S1CK mentioned, I did not have a xorg.conf file in /etc/X11 and I ran into the same runtime-error at first.
By Jardi August 6, 2012 - 11:51 pm
I tried this on my Thinkpad T420 with Debian Wheezy, I had to install xserver-xorg-video-intel version 2.20 with this patch: http://store.lisk.in/tmp/xserver-xorg-video-intel-2.20.2_virtual_crtc.patch from Liskni_si, other wise X would crash whenever I tried to use the virtual crtc and output.
Now, here is the weird thing, if I first run optirun true and then try to run screenclone -d :8 -x 1 it fails with the message:
terminate called after throwing an instance of ‘std::runtime_error’
what(): screenclone.cc:78 display
Aborted
But if I run optirun screenclone -d :8 -x 1 then I get my screen saver showing on my TV, I just get my screen saver though, I can move my cursor around but there are no windows, or anything else.
By Sagar Karandikar August 7, 2012 - 6:08 am
Try running gist #6 as root like BDK said above. Otherwise, I’ll probably have some free time at the end of this week to debug/update this guide for an updated clean install.
By zorbas February 9, 2013 - 9:24 am
Haven’t been able to do make this work on a W530 with Debian Wheezy (Gnome) and the 2.20.2 (btw. tried with 2.19.sth too, that just crashed X) driver. The second monitor turns on but I just see a black screen.
By Sebastian August 7, 2012 - 2:53 am
really great instructions.
also work on my t420s.
couldn’t you add the patched intel graphics to your ppa for thinkdisp.
I’m no experienced ubuntu packager but from my understanding it shouldn’t be too hard to automatically apply said patch to the latest source and let it build…
By lauri August 9, 2012 - 3:10 am
I can confirm that this also works on Mint 13 on the W520. You will need to add deb-src -lines to sources.list , mine looks like this: http://pastebin.com/T6y3HTBF
You will also need to patch the version 2.17.0 of xserver-xorg-video-intel package with the 2.18.0 patch, but that seems to work without problems.
By Jeff August 12, 2012 - 5:08 am
Thanks for this, it works like a champ on my ThinkPad W520!
One minor quirk, when I manually lock the screen things work as expected on both displays (they black out, logging in again unlocks both). When I close the lid (which only turns off the display), however, the secondary display (connected to VGA1) stays on and when I reopen the lid I need to re-enable the screen to use it (windows open on the screen stay there, but the mouse won’t scroll to that display).
I don’t know if it’s possible for thinkdisp to detect when the lid is closed and to perform some magic to blank the second display and spuriously re-enable once the lid is opened again.
Besides that, I’d second the SUID option to avoid needing to ask for the login password so frequently. You may need a simple compiled program that only executes the relevant command, SUID on a script is a little scary…
By Jeff August 12, 2012 - 7:31 am
Yay, more comment spam from me!
One more optimization for you. I created start_disp and stop_disp scripts which mimic the commands you run in thinkdisp (def start_disp and def kill_disp). I then edited /etc/acpi/lid.sh to run kill_disp after the /usr/share/acpi-support/screenblank command and start_disp just before the su $user -c “xset dpms force on” line. If thinkdisp is modified to allow parameters (thinkdisp start_disp, thinkdisp kill_disp for example) this method could be used to preserve state when the lid is closed a bit more easily.
Also note with respect to the sudoers hack I also posted, be sure to include /usr/bin/killdisp1 in the whitelisted commands.
By Sagar Karandikar August 13, 2012 - 12:28 am
Cool, I just did the SUID thing with the killdisp script (which is now written in C). There’s now only one password prompt immediately after thinkdisp is installed and run for the first time, then never again.
As to the screen lid thing, I’d definitely like to look into that kind of automation next.
By Jeff August 13, 2012 - 3:29 am
Thanks! With the lid thing, I’ve found that I need to have a secondary state value. There’s the current screen/card status, but also the expected status. This way when the lid is closed the screen/card is off, but the expected value is on. When I open the lid I only turn the screen on if the expected value is on.
I did this by writing on or off to /tmp/screen_status but it’s probably better in /proc by the bbswitch value. Since some people use the second monitor with the lid closed this should probably be an optional setting.
By Arnau August 20, 2012 - 3:39 am
I succeed to see the virtual screen using xrandr
Screen 0: minimum 320 x 200, current 3520 x 1080, maximum 8192 x 8192
LVDS1 connected 1600×900+0+0 (normal left inverted right x axis y axis) 345mm x 194mm
1600×900 60.0*+ 50.0
1440×900 59.9
1360×768 59.8 60.0
1152×864 60.0
1024×768 60.0
800×600 60.3 56.2
640×480 59.9
VGA1 disconnected (normal left inverted right x axis y axis)
VIRTUAL unknown connection 1920×1080+1600+0 (normal left inverted right x axis y axis) 0mm x 0mm
1920×1200 60.0
1920×1080 59.9*
1600×1200 60.0
1680×1050 60.0 59.9
1400×1050 60.0
1440×900 59.9
1280×960 60.0
1360×768 59.8 60.0
1152×864 60.0
800×600 56.2
640×480 59.9
after typing
sudo xrandr –output LVDS1 –auto –output VIRTUAL –mode 1920×1080 –right-of LVDS1
the mouse moves to the right of the screen beyond the border, so I guess the new screen is partially set up, but when typing
optirun screenclone -d :8 -x 1
(with or without sudo) nothing happens.
Any idea?
bumblebee.conf
# Configuration file for Bumblebee. Values should **not** be put between quotes
## Server options. Any change made in this section will need a server restart
# to take effect.
[bumblebeed]
# The secondary Xorg server DISPLAY number
VirtualDisplay=:8
# Should the unused Xorg server be kept running? Set this to true if waiting
# for X to be ready is too long and don’t need power management at all.
KeepUnusedXServer=false
# The name of the Bumbleblee server group name (GID name)
ServerGroup=bumblebee
# Card power state at exit. Set to false if the card shoud be ON when Bumblebee
# server exits.
TurnCardOffAtExit=false
# The default behavior of ‘-f’ option on optirun. If set to “true”, ‘-f’ will
# be ignored.
NoEcoModeOverride=false
# The Driver used by Bumblebee server. If this value is not set (or empty),
# auto-detection is performed. The available drivers are nvidia and nouveau
# (See also the driver-specific sections below)
Driver=nvidia
## Client options. Will take effect on the next optirun executed.
[optirun]
# The method used for VirtualGL to transport frames between X servers.
# Possible values are proxy, jpeg, rgb, xv and yuv.
VGLTransport=proxy
# Should the program run under optirun even if Bumblebee server or nvidia card
# is not available?
AllowFallbackToIGC=false
# Driver-specific settings are grouped under [driver-NAME]. The sections are
# parsed if the Driver setting in [bumblebeed] is set to NAME (or if auto-
# detection resolves to NAME).
# PMMethod: method to use for saving power by disabling the nvidia card, valid
# values are: auto – automatically detect which PM method to use
# bbswitch – new in BB 3, recommended if available
# switcheroo – vga_switcheroo method, use at your own risk
# none – disable PM completely
# https://github.com/Bumblebee-Project/Bumblebee/wiki/Comparison-of-PM-methods
## Section with nvidia driver specific options, only parsed if Driver=nvidia
[driver-nvidia]
# Module name to load, defaults to Driver if empty or unset
KernelDriver=nvidia
Module=nvidia-current
PMMethod=bbswitch
# colon-separated path to the nvidia libraries
LibraryPath=/usr/lib/nvidia-current:/usr/lib32/nvidia-current
# comma-separated path of the directory containing nvidia_drv.so and the
# default Xorg modules path
XorgModulePath=/usr/lib/nvidia-current/xorg,/usr/lib/xorg/modules
XorgConfFile=/etc/bumblebee/xorg.conf.nvidia
## Section with nouveau driver specific options, only parsed if Driver=nouveau
[driver-nouveau]
KernelDriver=nouveau
PMMethod=auto
XorgConfFile=/etc/bumblebee/xorg.conf.nouveau
xorg.conf.nvidia
# /usr/bin/X -ac -audit 0 -config /etc/X11/xorg.conf.nvidia -sharevts -modulepath /usr/lib/nvidia/current,/usr/lib/xorg/modules -nolisten tcp -noreset :1
# or
# /usr/bin/X -auth /var/lib/gdm/:0.Xauth -audit 0 -config /etc/X11/xorg.conf.nvidia -sharevts -modulepath /usr/lib/nvidia/current,/usr/lib/xorg/modules -nolisten tcp -noreset :1
Section “ServerLayout”
Identifier “Layout0″
Screen “Screen0″
Option “AutoAddDevices” “false”
EndSection
Section “Device”
Identifier “Device0″
Driver “nvidia”
VendorName “NVIDIA Corporation”
BusID “PCI:1:0:0″
#Option “ConnectedMonitor” “DFP”
Option “UseDisplayDevice” “none”
Option “DPI” “96 x 96″
EndSection
Section “Screen”
Identifier “Screen0″
Device “Device0″
DefaultDepth 24
SubSection “Display”
Depth 24
EndSubSection
EndSection
Version of Nvidia driver installed following the guide: nvidia-current 304.37-0ubuntu1~precise~xup1
Version of xserver-xorg-video-intel: xserver-xorg-video-intel-2.19.0
Version of xserver-xorg-video-intel patch: xserver-xorg-video-intel-2.18.0_virtual_crtc.patch
Ubuntu: 12.04
Kernel version: 3.2.0-29-generic-tp
By Sagar Karandikar August 31, 2012 - 8:02 pm
Is this on a clean install or have you tried to get the card working before using other methods? The “nothing-happening” bug usually occurs when there’s a conflict between multiple video drivers.
By Kam August 21, 2012 - 8:29 pm
I followed your instructions and everything worked perfectly. Thanks a lot for taking the time to write this up and post links. I really appreciate it. I’m running Ubuntu 12.04 64bit on a W530 with the K1000 card.
By leandro August 24, 2012 - 9:52 pm
Wow , great guide. Thanks for sharing.. I am getting an error though
note: The first line below is this step: ‘cd xserver-xorg… #(the source you just downloaded, tab to autocomplete)’…
leandro@leandro-ThinkPad-W530:~$ cd xserver-xorg-video-intel-2.17.0/
leandro@leandro-ThinkPad-W530:~/xserver-xorg-video-intel-2.17.0$ wget https://raw.github.com/liskin/patches/master/hacks/xserver-xorg-video-intel-2.18.0_virtual_crtc.patch
–2012-08-25 00:48:06– https://raw.github.com/liskin/patches/master/hacks/xserver-xorg-video-intel-2.18.0_virtual_crtc.patch
Resolving raw.github.com (raw.github.com)… 207.97.227.243
Connecting to raw.github.com (raw.github.com)|207.97.227.243|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 7221 (7.1K) [text/plain]
xserver-xorg-video-intel-2.18.0_virtual_crtc.patch: Permission denied
Cannot write to `xserver-xorg-video-intel-2.18.0_virtual_crtc.patch’ (Success).
Any ideas what is wrong? Thanks for your help
By Sagar Karandikar August 31, 2012 - 7:58 pm
Try adding “sudo” before the wget.
By ppafford August 28, 2012 - 8:23 am
I get the following error:
“xrandr: Failed to get size of gamma for output default”
I’m running a fresh install of 12.04 32 Bit
By Dylan August 31, 2012 - 9:13 am
Followed instructions exactly on a new install of Xubuntu 12.04 on Lenovo W530; worked perfectly, output to miniDisplayPort.
Thinkdisp didn’t work for me; I’ll try figuring out why not later.
Thanks for all the work! You basically un-bricked my new laptop!
By Sagar Karandikar August 31, 2012 - 8:04 pm
Unfortunately I don’t have a minidisplayport monitor to test with, let me know if you figure anything out!
By Ivo September 1, 2012 - 3:17 am
Got this working by following the instrucitons and heeding some of the remarks from the comments. It would be helpful if you could mention them in the article, as they probably apply to most of the people reading it:
* In gist #3, the ‘wget’ and ‘patch’ commands also need to be run with ‘sudo’
* In order to be able to build screenclone, you need to run
‘sudo apt-get install libxcursor-dev libxdamage-dev libxinerama-dev libxtst-dev’
* In gist #6, ‘optirun screenclone -d :8 -x 1′ is needed
By nrnjn September 13, 2012 - 5:27 am
This config worked fine until i installed thinkdisp on my Lenovo W520, Ubuntu 12.04. Now xrandr enlists VIRTUAL as an output. However screenclone doesnt work and Thinkdisp gives the following output when run from terminal
ERROR: Module nvidia does not exist in /proc/modules
1″1280x1024_59.90″ 108.70 1280 1360 1496 1712 1024 1025 1028 1060 -HSync +Vsync
X Error of failed request: BadName (named color or font does not exist)
Major opcode of failed request: 150 (RANDR)
Minor opcode of failed request: 16 (RRCreateMode)
Serial number of failed request: 30
Current serial number in output stream: 30
“1024x768_59.90″ 64.00 1024 1080 1184 1344 768 769 772 795 -HSync +Vsync
X Error of failed request: BadName (named color or font does not exist)
Major opcode of failed request: 150 (RANDR)
Minor opcode of failed request: 16 (RRCreateMode)
Serial number of failed request: 30
Current serial number in output stream: 30
Can post if something else is needed.
Thanks!
By Jure November 10, 2012 - 7:05 am
i have exactly the same problem as NRNJN:
when i run sudo thinkdisp i get:
ERROR: Module nvidia does not exist in /proc/modules
…
By Pali September 21, 2012 - 5:50 am
Thanks a lot!
I have two external monitors and this seems to be configured only for one. It would be great if I could somehow run nvidia-setting to handle output for nvidia card. Have anyone tried this? The main problem is that nvidia-settings thinks there is no driver installed.
Tested on thinkpad T520. Works great.
But
By monty October 16, 2012 - 1:11 pm
Hey,
thanks for the how-to. Worked like a charm on my T420!
I have one issue, though (despite I am not sure yet it’s actually related to bumblebee):
My external monitor (via DisplayPort/HDMI) keeps switching off after 10 minutes inactivity (i.e. watching a movie). The main display stays on though and the settings for Turning screen off is set to Never. After moving the mouse or sth it comes up again.
I tried different media players, its always the same behaviour.
Is there some kind of power saving setting I am missing? Or could someone give me a hint how to track down, what’s responsible for that?
I am on Ubuntu 12.04 with Gnome 3.
Cheers,
Monty
By floxyz October 26, 2012 - 2:48 am
Hi, I started this tutorial and came only until step 2 – after that it always tells me that I have to run in low-graphics mode and wenn I say OK I have a few options to choose from but I can’t select any of these because I can’t choose them with mouse or keyboard.
But I with CTRL+ALT+F1 I can start at least a terminal.
Any ideas on how I can either go on with the installation or restore the state of my installation?
By floxyz October 26, 2012 - 2:56 am
Edit:
I restored the previous state with sudo apt-get installing the unpatched version of xorg again.
But I really want to use a second monitor…
By andre November 13, 2012 - 12:39 pm
Hi,
tried this guide on t520 with clean ubuntu 12.04 64bit. After installing generated intel-video driver ubuntu boots into promt, cant start x-server. Xrandr says: no display found… Any suggestions?
By Andre November 13, 2012 - 1:40 pm
I Think the patch doesn’t work anymore, Xserver segfaults.
By winuxguy November 14, 2012 - 3:08 pm
Thank you so much!!! I have been lurking on this thing and even got to the point of compiling a new kernel and I did try messing with the Intel graphics to no avail. Works as intended. Now I can do work on my laptop while watching movies on a 1080p LED TV.
By steez November 24, 2012 - 5:32 am
Hi, installation worked fine for me. Do you know which part of the setup causes the external monitor to go to sleep after no keyboard/mouse interaction for 10mins? That’s kinda disturbing when watching a movie.
By Monty January 3, 2013 - 12:33 pm
In case you’re still wondering: adding these lines (after the ServerLayout section) to my xorg.conf.nvidia fixed the 10 mins sleep problem:
Section “ServerFlags”
Option “blank time” “0″
Option “standby time” “0″
Option “suspend time” “0″
Option “off time” “0″
Option “dpms” “false”
EndSection
Cheers,
Monty
By ArmyHill01 December 11, 2012 - 8:42 am
I’ve successfully followed this guide for 12.04 but am now trying to adopt it for 12.10 and keep failing.
I’m currently trying to use intel 2:2.20.2 for this but was wondering if anyone has had any success getting this or similar to work in 12.10 ?
Thanks Sagar for the post, excellent work !
By NeoBelerophon December 13, 2012 - 6:17 am
Worked fine for my with Lenovo W520 and Ubuntu 12.10 x64
VGA and Displayport is usable
Only thing is that thinkdisp does not work properly after reboot
I allways have to turn it on again. Some detection if a monitor is connected would be nice
By Wlo December 31, 2012 - 11:12 am
I’ve been crying out for this guide for the best part of two years – thank you!
I have a prob and I’m a little unclear as to which bit may be causing my issue, so any advice on where to start would be much appreciated.
I’m on a T420, and followed these instructions from a clean Ubuntu 12.10 64bit install. Everything works fine upon boot, but I can’t come back from suspend. I just get a shell and no GUI. If I type “startx” I get “No screens found”. Any ideas?
Many thanks again for your guide.
Wlo.
By Jonas Camillus Jeppesen January 7, 2013 - 9:29 pm
On 12.10 (kernel 3.5) I also end up with no gui and from time to time a message saying “Low graphics mode”. The problem seems to be that the version xserver-xorg-video-intel is newer than when this guide was written and as a consequence the patch https://raw.github.com/liskin/patches/master/hacks/xserver-xorg-video-intel-2.18.0_virtual_crtc.patch no longer works. As a mattr of fact it causes xorg to segfault (check the syslog when in this no-gui-mode by pressing ctrl+alt+f1 to get a terminal, logging in and running something like “grep bumblebeed /var/log/syslog”).
Luckily for us liskin have made some updated patches.
I’ve sucessfully completed the “patch xserver-xorg-video-intel and install”-instructions (Gist / command paste no. 2 from the top) using this patch instead of the one mentioned in the guide:
https://raw.github.com/liskin/patches/master/hacks/xserver-xorg-video-intel-2.20.14_virtual_crtc.patch
The only two commands that needs changing is the “wget …” (new url) command and the “sudp dpkg –install …” command (the package is now named …2.20… instead of …2.17..).
So just redo all those commands and reboot. After that I got my x running again and I see VIRTUAL when running xrandr.
By Jonas Camillus Jeppesen January 9, 2013 - 1:20 pm
First of all, this might be an almost exact replica of a reply I tried to make (maybe made) a couple of days ago. I think I was promised that my reply was awaiting approval, but at time of typing this reply it has still not appeared. Anyway I made a mistake in my previous reply I would like to correct, so …
I’ve successfully followed this guide with small modifications on Ubuntu 12.10 amd64 on my Thinkpad T420.
The reason why the guide, as it is, fails on 12.10 (blank display after one of the reboots) is that the version of xserver-xorg-video-intel has increased and the patch (by liskin) linked to in the guide now causes xorg to segfault on start. When I followed the guide to the letter my self I got a message saying “low graphics mode” upon one of the reboots and then just a blank display. To deal with the blank screen press ctrl+alt+f1 to get a login terminal. From here debugging and redoing of the guide with modifications can be made. The segfault can be seen by running something like “grep bumblebee /var/log/syslog” and it will show you lines indicating a segmentation fault has happedned for xorg.
All that need needs to be changed to get it working on 12.10 is the patch. liskin have made a few newer patches than the one linked to in this guide. The one I’ve found to work with 12.10 is
https://raw.github.com/liskin/patches/master/hacks/xserver-xorg-video-intel-2.20.2_virtual_crtc.patch
Just adapt the “patch xorg”-instructions (second paste / Gists) to use this patch instead.
By DD January 21, 2013 - 3:18 pm
@Wlo
Any solution yet, I have the same problem with W520 64 bit running Ubuntu 12.10, it comes back from suspend to a shell with no GUI.
By Cri February 13, 2013 - 8:52 am
After the last upgrade of my Ubuntu 12.04 64 bit, xrandr does not show the VIRTUAL display anymore. I’ve reapeated the steps of patching, rebuilding and reinstalling the xserver-xorg-video-intel and now it segfaults. Installing xserver-xorg-video-intel with apt-get or building it from sources (but without applying the patch above) allows me to restore a working X environment but, of course, without the ability to attach an external monitor.
By Tim May 24, 2013 - 5:49 am
Same here. The virtual crtc patch no longer appears to work, and causes a segfault with the current 12.04 distribution. Would appreciate it if anyone has any suggestions.
By rpat January 3, 2013 - 9:20 pm
I am trying to get this to work with two displaylink usb to dvi adaptors on a dell laptop with ubuntu 12.04 lts. no luck so far. any ideas?
By dale February 9, 2013 - 5:11 pm
I have a Lenovo W530 – I got this to work on Linux Mint (Mate) 13.
I did a fresh install of Linux Mint (Mate) 14 and the intel-server is at 2.2.20.9 –
It doesn’t work without the patch and applying the patch causes X to not work at all.
I’d really like this running on Mint 14. Anyone have any hints?
By Ashrith Barthur February 13, 2013 - 4:13 pm
Hello Sagar,
I am trying to get this working on a a Dell3007WFP monitor which is WQXGA. Maximum resolution of 2560×1600. I was able to confortably reproduce this on a smaller monitor but have not been successful on the 30″
I do
optirun true
xrandr –output LVDS1 –auto –output VIRTUAL –mode 1920×1080 –right-of LVDS1 (lower than the maximum resolution)
screenclone -d :8 -x 1
This turns the monitor on, because up until that point the monitor is not turned on. But after that there is nothing rendered on the monitor. I am not sure what the problem might be. Is it that this setup would not support WQXGA monitors? Although I am rendering at much lower resolution which is 1920×1080. I know this resolution works on windows.
By Jonathan D. Lettvin February 14, 2013 - 8:29 pm
I have a W520 running ubuntu 12.04 64 bit. I tried to follow these instructions once before. That video configuration was disrupted and I had to do a fresh install taking the better part of a day. It was installing and configuring either bumblebee or another driver that led to the problem. I am feeling shy about trying again.
My goal is less ambitious. I want to run programs that currently fail.
They generate output like this:
Xlib: extension “GLX” missing on display “:0.0″.
freeglut (./ubigraph_server): OpenGL GLX extension not supported by display ‘:0.0′
The knowledge displayed in this discussion makes me hopeful.
Could someone advise me how to take steps to meet my goal?
By External display is not working under Ubuntu with a Thinkpad W530 | Ubuntu Info - James n Sheri.comUbuntu Info – James n Sheri.com May 11, 2013 - 9:13 pm
[...] Installed hybrid-screenclone and follow this http://sagark.org/optimal-ubuntu-graphics-setup-for-thinkpads/ : It allows to have an external displays but it is very slow and not automatic (no screen detection [...]
By RL May 23, 2013 - 2:57 pm
Hello,
Great guide! It works, however I am getting about 20% of the sceen cutoff. I’ve tried using different resolutions with xrandr but it doesn’t change anything. Any thoughts?
Thanks!
By Tim May 24, 2013 - 3:08 am
After installing xserver-xorg-video-intel_2.17.0-1ubuntu4_amd64.deb and rebooting, I am no longer able to start X. It segfaults.
[ 515.818] (II) GLX: Initialized DRI2 GL provider for screen 0
[ 515.818]
Backtrace:
[ 515.818] 0: /usr/bin/X (xorg_backtrace+0×26) [0x7f0b6cf579e6]
[ 515.818] 1: /usr/bin/X (0x7f0b6cdcf000+0x18c88a) [0x7f0b6cf5b88a]
[ 515.818] 2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7f0b6c0f5000+0xfcb0) [0x7f0b6c104cb0]
[ 515.818] 3: /usr/lib/xorg/modules/drivers/intel_drv.so (0x7f0b69187000+0xebaf) [0x7f0b69195baf]
[ 515.818] 4: /usr/lib/xorg/modules/drivers/intel_drv.so (0x7f0b69187000+0xfaf7) [0x7f0b69196af7]
[ 515.818] 5: /usr/bin/X (0x7f0b6cdcf000+0xbe0c7) [0x7f0b6ce8d0c7]
[ 515.818] 6: /usr/bin/X (0x7f0b6cdcf000+0x3d64c) [0x7f0b6ce0c64c]
[ 515.818] 7: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xed) [0x7f0b6af8676d]
[ 515.818] 8: /usr/bin/X (0x7f0b6cdcf000+0x3daad) [0x7f0b6ce0caad]
[ 515.818] Segmentation fault at address 0×4
[ 515.818]
Caught signal 11 (Segmentation fault). Server aborting
[ 515.818]
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
[ 515.818] Please also check the log file at “/var/log/Xorg.0.log” for additional information.
Any ideas?
By Amir June 11, 2013 - 12:39 pm
Thanks for the manual but it doesn’t work in 13.04.
Could you update this please?
I’m using the newest patch https://raw.github.com/liskin/patches/master/hacks/xserver-xorg-video-intel-2.20.14_virtual_crtc.patch (it doesn’;t fail but current source is at 2.21).
xrandr doesn’t show a virtual monitor and it doesn’t work from there….
By Ed W. June 12, 2013 - 8:28 am
In case anyone is curious, I got triple monitor working with an out-of-the-box install of Ubuntu 13.04 on a Thinkpad T430. Here’s how:
I have the 3-port 90w dock from IBM.
* Install Ubuntu 13.04 on the T430, but do not dock the laptop while you’re installing.
* Reboot.
* Once the login prompt comes up, dock the laptop. The third display will come on!
* Use the “Display” widget to config your desktop layout.
* You’re done!
I will note that if you boot the laptop while docked, the third display *will not* come up.
I will further note that I did not install the proprietary nvidia drivers, and I did not install Bumblebee. Just stock Ubuntu 13.04.
Hope this helps someone.
By Ed W. June 12, 2013 - 10:34 am
One further update: if you install bumblebee in the config above, the triple monitor trick stops working. Even if you remove bumblebee and the associated packages, triple monitor stays broken.