GUI/Unity crashing in 16.04 LTS after updates 2018-01-04, compiz segfaults

UPDATE APRIL

I was hit again by this bug/symptoms on 26 April 2018. I could solve it by applying the March fix AND additionally cleaning the crash dir.

rm ~/.config/upstart/lowgfx.conf
sed -i 's/-lowgfx//' ~/.config/compiz-1/compizconfig/config
rm -r ~/.cache/
sudo rm -r /var/crash/*
reboot

UPDATE March 2018.

It seems a bug with more or less the same symptoms hit a couple of users beginning of March 2018. This new bug is in compiz-config, not compiz. And it is less severe: guest session and low graphics mode is working fine. New bug report.

Fix (for most users):

rm ~/.config/upstart/lowgfx.conf
sed -i 's/-lowgfx//' ~/.config/compiz-1/compizconfig/config
rm -r ~/.cache/
reboot

Explanation: Remove any lowgfx.conf file and change profile = unity-lowgfx to profile = unity in .config/compiz-1/compizconfig/config. Clean the .cache directory in your home directory.Reboot.Thx to everyone contributing in the bugreport.

If you're hit in March and above solution is not working, leave a message on the bug report. Try workaround 3 (see below). Otherwise try to tweak compiz settings in CCSM. Or delete/clean your ~/.cache directory.


Bug Fixed (January)

This bug is fixed now. Updates are in Xenial-updates, so an update will solve the issue.

 sudo apt update && sudo apt upgrade -y

You can disable proposed:

 System Settings -> Software & Updates -> Tab Developer options -> uncheck proposed

Or revert any of your workarounds.

Background

This bug is acknowledged and caused by the mesa updates of 2018-01-04 to 17.2.4. The bug is now marked as a duplicate of an earlier bug filed 2017-12-01, unfortunately that bug was misfiled.

Only older Intel, ~2006-2011, with integrated graphics (gen4/5) are affected, so that's why it slipped through testing. And it only seems to affect Unity, not Gnome or LXDE.

Following info is obsolete

The patch for this bug will be available in xenial-proposed shortly. Please help Ubuntu by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Please give feedback at the bug report page to help getting this update out to other Ubuntu users. See comment 48 for info.

To enable proposed (please read info in above links first):

 System Settings -> Software & Updates -> Tab Developer options -> check proposed

Install patches

  sudo apt-get install libgl1-mesa-dri/xenial-proposed
  sudo reboot

Then add a file /etc/apt/preferences.d/proposed-updates

 Package: *
 Pin: release a=xenial-proposed
 Pin-Priority: 400

This will protect you from updating all packages in the proposed repository next time you do a sudo apt upgrade. You don't want that.

If you add this file before you install the patches, you will get a dependency error message.

If you have used a PPA as a workaround, you have to purge that first.

 sudo ppa-purge ppa:paulo-miguel-dias/pkppa
 sudo reboot

Until this bug is fixed, what are the workarounds?

1. Install lubuntu-desktop (LXDE) aside unity

sudo apt-get install lubuntu-desktop

This will take around 400MB and install things like Abiword, you can remove them later to save disk-space. Simply choose Lubuntu at login. Remove lubuntu-desktop again when the bug is resolved.

2. Downgrade the mesa-packages

This is described in the bug report. It can have unwanted side-effects and break dependencies, so decide for yourself.

As it seems these 4 packages need to be downgraded:

libegl1-mesa 17.2.4-0ubuntu1~16.04.2
libgbm1 17.2.4-0ubuntu1~16.04.2
libgl1-mesa-dri 17.2.4-0ubuntu1~16.04.2
libwayland-egl1-mesa 17.2.4-0ubuntu1~16.04.2

One way is to download them from the link in this comment and follow the instructions. dpkg -i *.deb

I you use Wine you will need the i386 packages too.

Prevent automatic upgrading from these 4 packages. Don't forget to remove that file once the bug is resolved.

3. Use low graphics mode

This will mitigate the bugs and give you a somewhat working GUI. But:

  • Dash not working
  • Alt tab not working
  • logout, reboot and halt needs to be done with terminal, same for programs not in the launcher
  • super key (windows) not working

That said: launcher, workspace switching and keyboard shortcuts are working, so just spread your programs over workspaces :)

Create a file ~/.config/upstart/lowgfx.conf

start on starting unity7
pre-start script
initctl set-env -g UNITY_LOW_GFX_MODE=1
end script

Logout and login.

4. PPA

Update mesa to a newer version through a PPA. Don't forget to purge the PPA when the bug is solved. This is probably the best choice. Please read the info on the PPA-page before you apply following code.

 sudo apt-add-repository ppa:paulo-miguel-dias/pkppa
 sudo apt update && sudo apt upgrade -y
 sudo reboot

Reboot and it should be fine. If not please leave a message in the bug report.

Don't forget to purge the PPA when the bug is resolved.

 sudo ppa-purge ppa:paulo-miguel-dias/pkppa

5. Downgrade from HWE to stock kernel (and mesa/x-server)

Bug is caused by mesa (17.2.4) updates, and mesa is updated along kernels in the HWE stack. Returning to stock kernel (4.4) will solve the issue, it will downgrade mesa to 11.2.

sudo apt install --install-recommends xserver-xorg xserver-xorg-core
xserver-xorg-video-all xserver-xorg-input-all xserver-xorg-video-intel 
server-xorg-video-qxl
sudo reboot

That will removes all HWE packages. Probably the most secure solution.

Hopefully this bug bug will be solved soon. Consider helping Ubuntu in testing .