{"id":29,"date":"2017-02-05T22:48:33","date_gmt":"2017-02-05T22:48:33","guid":{"rendered":"https:\/\/blog.syddel.uk\/?p=29"},"modified":"2024-10-04T13:43:58","modified_gmt":"2024-10-04T12:43:58","slug":"kubuntu-16-10-installation","status":"publish","type":"post","link":"https:\/\/blog.syddel.uk\/?p=29","title":{"rendered":"Installing Kubuntu 16.10 on nVidia Optimus Laptop"},"content":{"rendered":"<p>I&#8217;ve been using Ubuntu since 2009 (Ubuntu 9.04). I&#8217;m comfortable with Ubuntu because I can usually just install it and get things done rather than spending days or weeks trying to get things working properly (although I must admit it is extremely gratifying getting things working properly). Unlike everyone else I know who uses Linux, I actually like the Unity desktop, although I despise the default orange color scheme (something that can be easily changed).<\/p>\n<p>Very recently, I decided to try out Kubuntu 16.10. I&#8217;m really glad I did. I&#8217;m not going to say I like Kubuntu better than Ubuntu (or KDE more than Unity), but I will say that Kubuntu 16.10 is beautiful and an absolute pleasure to use. Having said that, I found the installation quite difficult on any laptop that has dual Intel\/nVidia graphics.<\/p>\n<p>I&#8217;m going to list the steps I used to get Kubuntu 16.10 working on my Defiance II.<\/p>\n<h4>My Laptop<\/h4>\n<h4>I have a PC Specialist Defiance II, which is a re-branded Clevo P65_P67RGRERA.<\/p>\n<pre escaped=\"true\" line=\"0\" lang=\"bash\">syd@d2-lin:~$ sudo dmidecode | grep -A 9 \"System Information\"\nSystem Information\n        Manufacturer: PC Specialist Limited\n        Product Name: P65_P67RGRERA\n        Version: Not Applicable                  \n        Serial Number: Not Applicable                  \n        UUID: 275BFA80-A763-0000-0000-000000000000\n        Wake-up Type: Power Switch\n        SKU Number: Not Applicable                  \n        Family: Not Applicable\n<\/pre>\n<\/h4>\n<h4>BIOS Settings<\/h4>\n<p>After much trial and error I discovered that, on my laptop, it was important to have the following BIOS settings:<\/p>\n<p><code>UEFI: Enabled<\/code><br \/>\n<code>Secure Boot: Disabled<\/code><br \/>\n<code>GPU Settings: DISCRETE<\/code><\/p>\n<p>On my laptop I set the GPU settings by navigating to:<\/p>\n<p><code>Advanced -&gt; Advanced Chipset Control -&gt; MSHYBRID or DISCRETE SWITCH<\/code><\/p>\n<p>in the BIOS. This will differ from laptop to laptop, and some laptops may not even offer the option to switch between the two.<\/p>\n<h4>Boot from Installation Media<\/h4>\n<p>When booting from the installation media you need to press the &#8216;e&#8217; key when the GRUB menu is displayed. Add &#8216;nomodeset&#8217; just before &#8220;quiet splash&#8221;, then press F10 to boot. I have found that without setting &#8216;nomodeset&#8217;, the installation will completely lock up at some point.<\/p>\n<p>So long as <em>nomodeset<\/em> is set, the installation should complete without any problems. Once the installation is complete, you will be asked to remove the installation media and press <enter>. Do this. I have found that sometimes my laptop just won&#8217;t reboot at this stage, and I have to hold down the power button to force a power off.<\/enter><\/p>\n<p>The following steps is where the fun begins&#8230;<\/p>\n<h4>Install Updates<\/h4>\n<p>Again, this may differ from laptop to laptop, but I found that on both Ubuntu 16.10 and Kubuntu 16.10, I could not sign in to the GUI at this point. If I tried to do so, the system would just freeze.<\/p>\n<p><strong>Immediately<\/strong> after the login screen is displayed, press ALT + CTRL + F1 to bring up a virtual console (terminal). Failure to do this quickly enough after the reboot may result in your system freezing.<\/p>\n<p>In the console, install system updates as usual:<\/p>\n<pre escaped=\"true\" line=\"0\" lang=\"bash\">sudo apt update\nsudo apt upgrade\nsudo apt dist-upgrade\nsudo apt autoremove\n<\/pre>\n<p>If you don&#8217;t have a wifi connection at this stage, you may have to use a network cable.<\/p>\n<p>When done, reboot using:<\/p>\n<pre escaped=\"true\" line=\"0\" lang=\"bash\">sudo reboot\n<\/pre>\n<p>Again, immediately after the login screen is displayed, press ALT + CTRL + F1 to bring up a console.<\/p>\n<h4>Install Latest Kernel<\/h4>\n<p>To install the latest kernel (4.9.8 at time of writing):<\/p>\n<pre escaped=\"true\" line=\"0\" lang=\"bash\">mkdir \/tmp\/kernel &amp;&amp; cd \/tmp\/kernel\nwget http:\/\/kernel.ubuntu.com\/~kernel-ppa\/mainline\/v4.9.8\/linux-headers-4.9.8-040908_4.9.8-040908.201702040431_all.deb\nwget http:\/\/kernel.ubuntu.com\/~kernel-ppa\/mainline\/v4.9.8\/linux-headers-4.9.8-040908-generic_4.9.8-040908.201702040431_amd64.deb\nwget http:\/\/kernel.ubuntu.com\/~kernel-ppa\/mainline\/v4.9.8\/linux-image-4.9.8-040908-generic_4.9.8-040908.201702040431_amd64.deb\nsudo dpkg -i *.deb\n<\/pre>\n<p>Reboot, and once again immediately press ALT + CTRL + F1 when the login window is displayed.<\/p>\n<h4>Installing the Latest nVidia Drivers<\/h4>\n<p>To install the latest nVidia drivers (378 at time of writing):<\/p>\n<pre escaped=\"true\" line=\"0\" lang=\"bash\">sudo add-apt-repository ppa:graphics-drivers\/ppa\nsudo apt update &amp;&amp; sudo apt install nvidia-378\n<\/pre>\n<p>Once again, reboot (with: sudo reboot), and once again press ALT + CTRL + F1 the moment the login window appears.<\/p>\n<h4>Set ACPI OSI Kernel Boot Parameter<\/h4>\n<p>On my laptop, I found this step very important. Without it, I was getting kernel panics on rebooting. Edit \/etc\/default\/grub and change the GRUB_CMDLINE_LINUX_DEFAULT line so it includes acpi_osi=\\&#8221;!Windows 2015\\&#8221;. For example, it should look something like this:<\/p>\n<pre escaped=\"true\" line=\"0\" lang=\"bash\">GRUB_CMDLINE_LINUX_DEFAULT=\"quiet splash acpi_osi=\\\"!Windows 2015\\\"\"\n<\/pre>\n<p>When done, run:<\/p>\n<pre escaped=\"true\" line=\"0\" lang=\"bash\">sudo update-grub2\n<\/pre>\n<p>then reboot:<\/p>\n<pre escaped=\"true\" line=\"0\" lang=\"bash\">sudo reboot\n<\/pre>\n<p>From this point, you no longer have to bring up a console. You&#8217;ll be able to boot in to Kubuntu using the GUI. There is, however, one more step to complete&#8230;<\/p>\n<h4>Tearing<\/h4>\n<h4>You&#8217;ll notice that there&#8217;s tearing. This is a known issue with KDE for which there is a known workaround &#8211; enabling triple buffering!<\/p>\n<p>Create a file in \/etc\/profile.d\/ called &#8220;tearing.sh&#8221; (the filename doesn&#8217;t have to be &#8220;tearing.sh&#8221;, it can be anything you choose). Tearing.sh should contain a single line:<\/p>\n<pre escaped=\"true\" line=\"0\" lang=\"bash\">export KWIN_TRIPLE_BUFFER=1\n<\/pre>\n<p>You will have to log out and log back in again (or just reboot the laptop) for this setting to take effect.<\/h4>\n<h4>Switching from nVidia to Intel Graphics<\/h4>\n<p>From here on in, switching between nVidia and Intel graphics requires going in to the BIOS and selecting with GPU you want to use. When in Intel GPU mode, you can check to make sure the nVidia GPU is not powered on using:<\/p>\n<pre escaped=\"true\" line=\"0\" lang=\"bash\">cat \/proc\/acpi\/bbswitch\n<\/pre>\n<p>(the result should be &#8220;OFF&#8221;).<\/p>\n<p>If you want to see how much power your laptop is using, install powerstat:<\/p>\n<pre escaped=\"true\" line=\"0\" lang=\"bash\">sudo apt install powerstat\n<\/pre>\n<p>To run powerstat, you need to be running off battery (i.e. make sure the laptop is no plugged in to the mains). On my laptop, power usage at idle is around 11 Watts:<\/p>\n<pre>mnemonic@d2-lin:~$ sudo powerstat\n[sudo] password for mnemonic: \nRunning for 300.0 seconds (30 samples at 10.0 second intervals).\nPower measurements will start in 180 seconds time.\n\n  Time    User  Nice   Sys  Idle    IO  Run Ctxt\/s  IRQ\/s Fork Exec Exit  Watts\n01:37:51   0.0   0.0   0.0 100.0   0.0    1     42     26    0    0    0  11.90 \n01:38:01   0.0   0.0   0.0  99.9   0.0    1     65     28    0    0    0  11.74 \n01:38:11   0.0   0.0   0.0 100.0   0.0    1     47     24    0    0    1  12.09 \n01:38:21   0.0   0.0   0.0 100.0   0.0    1     34     20    0    0    0  12.22 \n01:38:31   0.0   0.0   0.0 100.0   0.0    2     50     22    0    0    0  11.90 \n01:38:41   0.2   0.0   0.0  99.8   0.0    1    142     63    6    2   21  12.29 \n01:38:51   0.0   0.0   0.0 100.0   0.0    1     39     20    1    0    0  12.13 \n01:39:01   0.1   0.0   0.0  99.9   0.0    2    180     43    3    1    0  11.70 \n01:39:11   0.1   0.0   0.0  99.9   0.0    1    100     39    4    1    3  11.31 \n01:39:21   0.1   0.0   0.1  99.9   0.0    1    121     40    7    2    6  12.24 \n01:39:31   0.0   0.0   0.0  99.9   0.0    1     50     30    0    0    6  11.78 \n01:39:41   0.0   0.0   0.0 100.0   0.0    1     33     18    0    0    0  11.74 \n01:39:51   0.0   0.0   0.0 100.0   0.0    1     36     22    0    0    0  11.74 \n01:40:01   0.0   0.0   0.0 100.0   0.0    1     65     26    0    0    1  11.72 \n01:40:11   0.4   0.0   0.2  99.3   0.1    1    582    289    0    0    0  11.82 \n01:40:21   0.0   0.0   0.0 100.0   0.0    1     30     17    0    0    0  11.74 \n01:40:31   0.0   0.0   0.0 100.0   0.0    1     34     20    0    0    0  11.75 \n01:40:41   0.0   0.0   0.0 100.0   0.0    1     31     20    0    0    0  11.70 \n01:40:51   0.0   0.0   0.0 100.0   0.0    1     34     22    0    0    0  11.70 \n01:41:01   0.1   0.0   0.0  99.9   0.0    1    256     35    1    0    0  11.70 \n01:41:11   0.1   0.0   0.0  99.9   0.0    1    102     37    6    2    2  11.73                                              \n01:41:21   0.1   0.0   0.0  99.9   0.0    1     45     26    1    0    5  11.70                                             \n01:41:31   0.0   0.0   0.0 100.0   0.0    1     37     21    0    0    0  11.68                                            \n01:41:41   0.0   0.0   0.0  99.9   0.0    1     94     35    6    2    2  11.26                                              \n01:41:51   0.1   0.0   0.0  99.9   0.0    1    117     42    6    2    6  11.69 \n01:42:01   0.8   0.0   0.4  98.5   0.4    1   1138    539    0    0    4  11.87 \n01:42:11   0.0   0.0   0.0  99.9   0.0    1     62     29    0    0    0  11.84                                                       \n01:42:21   0.0   0.0   0.0 100.0   0.0    1     41     22    0    0    0  11.72                                                       \n01:42:31   0.0   0.0   0.0 100.0   0.0    1     38     22    0    0    1  11.72                                                       \n01:42:41   0.0   0.0   0.0 100.0   0.0    1     35     19    0    0    0  11.69                                                       \n-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------                                                       \n Average   0.1   0.0   0.0  99.9   0.0  1.1  122.6   53.8  1.4  0.4  1.9  11.79                                                        \n  StdDev   0.1   0.0   0.1   0.3   0.1  0.2  215.8  102.1  2.3  0.8  4.1   0.22                                                        \n-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------                                                        \n Minimum   0.0   0.0   0.0  98.5   0.0  1.0   29.5   17.3  0.0  0.0  0.0  11.26                                                        \n Maximum   0.8   0.0   0.4 100.0   0.4  2.0 1138.1  539.4  7.0  2.0 21.0  12.29                                                        \n-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------                                                        \nSummary:                                                                                                                               \nSystem:  11.79 Watts on average with standard deviation 0.22\n<\/pre>\n<h4>Conclusion<\/h4>\n<p>While the above will enable a hybrid graphics laptop to choose between the nVidia and Intel GPUs, not everything works correctly.<\/p>\n<p>In Intel GPU mode:<\/p>\n<ul>\n<li>The screen brightness cannot be adjusted using the keyboard.<\/li>\n<li>The video output ports (mini-displayport\/HDMI) do not work.<\/li>\n<li>Hibernate doesn&#8217;t work (there is a workaround: ALT + CTRL + F1, then ALT + CTRL + F7).<\/li>\n<\/ul>\n<p>In nVidia GPU mode, everything just works.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been using Ubuntu since 2009 (Ubuntu 9.04). I&#8217;m comfortable with Ubuntu because I can usually just install it and get things done rather than spending days or weeks trying to get things working properly (although I must admit it is extremely gratifying getting things working properly). Unlike everyone else I know who uses Linux,<a class=\"moretag\" href=\"https:\/\/blog.syddel.uk\/?p=29\"><span class=\"screen-reader-text\">Read more about Installing Kubuntu 16.10 on nVidia Optimus Laptop<\/span>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":120,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[9,6,5,7,8],"class_list":["post-29","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-installation","tag-hybrid-graphics","tag-installation","tag-kubuntu","tag-nvidia","tag-optimus"],"_links":{"self":[{"href":"https:\/\/blog.syddel.uk\/index.php?rest_route=\/wp\/v2\/posts\/29","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.syddel.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.syddel.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.syddel.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.syddel.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=29"}],"version-history":[{"count":48,"href":"https:\/\/blog.syddel.uk\/index.php?rest_route=\/wp\/v2\/posts\/29\/revisions"}],"predecessor-version":[{"id":458,"href":"https:\/\/blog.syddel.uk\/index.php?rest_route=\/wp\/v2\/posts\/29\/revisions\/458"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.syddel.uk\/index.php?rest_route=\/wp\/v2\/media\/120"}],"wp:attachment":[{"href":"https:\/\/blog.syddel.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.syddel.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.syddel.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}