Intel Graphics – Shutdown Hangs on Intel Graphics on Ubuntu 16.04 with 4.7.2 Kernel

16.04crashintel graphicsnvidia-optimus

I've got a new laptop with an i7-6700HQ, a nvidia gtx 960m and a 256gb pci ssd and everything works perfectly fine when I'm using the nvidia card. However when I'm using the intel card the system crashes constantly. Whenever I start steam, suspend the computer, reboot, shutdown, turn off the screen or close the lid the systems freezes and I am unable to do anything. I can't even access tty1.
I think this is due to the intel graphics card. I got the following error upon initramfs rebuilds (sudo update-initramfs -u -k all)

update-initramfs: Generating /boot/initrd.img-4.4.0-38-generic
W: Possible missing firmware /lib/firmware/i915/kbl_dmc_ver1.bin for module i915_bpo
W: Possible missing firmware /lib/firmware/i915/skl_guc_ver6.bin for module i915_bpo
update-initramfs: Generating /boot/initrd.img-4.4.0-21-generic

I fixed that by installing the missing firmware from here but the problem persists.

Edit: I reinstalled my entire OS and replaced above error with the actual error I got. I reinstalled nvidia-367 and nvidia-prime. The problem persists…..

Does anyone have any suggestions on how to troubleshoot this problem??

Edit 2: I reinstalled again and I managed to fix it. I reinstalled without swap (it kept asking for a password for cryptswap and caused some of the freezes) I installed the nvidia drivers with gdm3 and added the usual nouveau.modeset=0 to grub all from tty1. I edited /etc/modprobe.d/blacklist.conf after a reboot to blacklist nouveau. I downloaded the i915 firmware packages and installed them.
After I did that last step everything started to work perfectly.

Edit 3: I executed all updates and it stopped working again……
At least I now know that its an update that caused it…..

It's the gnome session that crashes. it appears to be a know bug

I'm reinstalling AGAIN. Some update broke everything and I can't fix it…

Edit ∞: I think I finally managed to fix it….I hope…..
I started by installing ubuntu gnome 16.04 without swap. After installation I rebooted and had to shut down the system by holding alt+prtscn/sysRq+b.
After booting I enter tty1 (ctrlaltf1) and updated the kernel to version 4.7.2 (guide) and rebooted.
I installed nvidia-367 and prime with the lightdm desktop manager (rip nice looking login screen) and rebooted.
I switched to the intel gpu and rebooted.
I logged in and downloaded this. I executed the installation commands needed.

sudo dpkg -i intel-grapics-update-tool_2.0.2_amd64.deb
sudo apt-get -f install
wget -q0 - | sudo apt-key add -

The last line adds the key so the update manager trusts the repository.
I started the installed program (super, intel and clicking the intel logo) and let it do its thing. (This is the step that adds the repository that needs that key.)

I ran sudo apt-get update | sudo apt-get upgrade and rebooted.
This was the step that always failed. logging in after installing the updates. This time however it worked.

I'll keep this edit here until i'm certain that the system is stable. If it is I'll add it as an answer.

Edit ∞+1: the system hangs on shutdown and reboot with intel graphics. I am attempting to fix this

Edit ∞²: I found the reason why my system hangs on shutdown. It's due to the intel graphics drivers…..So I decided to temporarily kill them with the nomodeset parameter in grub (well…until X is loaded that is). Everything works fine now….except secondary displays (and steam (an X error occurred) but this can be fixed by editing this). I am even able to use the intel graphics card (2600 fps glxgears!!!whooo!!). I have since restored the beautiful gdm3 login and am currently adding an extra item to the grub2 list that allows me to quickly switch between intel and nvidia.

Best Answer

I've done the following to get it to work.
please keep in mind that rebooting requires you to hold the power button when it hangs. (alt+prtscn/sysrq+reisub doesn't work)
step 1: reinstall you system without swap (if you encrypt your home directory that is)
step 2: boot into your new installation but don't log in. go to tty1 (ctrlaltf1)
step 3: upgrade your kernel to 4.7.6
step 4: reboot (and hold the power button when it hangs to kill it) and log into tty1
step 5: install the nvidia drivers and prime

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-367 nvidia-prime

choose lightdm when prompted
step 6: reboot and log into gnome.
step 7: open a terminal and execute

sudo prime-select intel

and reboot. When grub shows up press 'e' and at the end of the line that starts with 'linux' add 'nomodeset'. Press F10 to boot into your system
step 8: log in (thats possible thanks to lightdm and nomodeset) Download this and install it. (your firefox will probably not work at this point. to get it to work execute sudo chown -R $USER:$USER ~/.cache)

sudo dpkg -i intel-grapics-update-tool_2.0.2_amd64.deb
sudo apt -f install
wget -q0 - | sudo apt-key add -

step 9: run the program (its the only program that starts with 'intel' in your dash. After it's finished execute a reboot (this is the last reboot that requires you to kill your system).
step 10: (after entering nomodeset) boot the system and log in. Install all the updates and reboot. step 11: enter nomodeset and log in. install gksu (sudo apt install gksu) and run gksudo gedit /etc/default/grub and add nomodeset after quiet splash. (you can run sudo dpkg-reconfigure gdm3 at this point to get the gdm3 login screen back) step 12: run 'gksudo gedit /etc/grub.d/40_custom' and copy your ubuntu menuentry from /boot/grub/grub.cfg into it. remember to remove the nomodeset from 40_custom. name it 'ubuntu nvidia' step 13: create /usr/local/bin/intel (and nvidia) with the following code


prime-select intel
grub-reboot 0



prime-select nvidia
grub-reboot 7

make them executable (and perhaps add them to visudo) and you are done!!
if steam doesn't work on intel see Edit ∞².

ooh and if sudo update-initramfs -u -k all gives you errors you can find the missing firmware here. Read the readme file to find out how to install them (some need --install operator while others just work)