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

The latest updates (4/1/2018) make my laptop constantly crash the GUI/Unity:

(Intel Pentium su4100 processor)

syslog:

Jan  5 11:38:53 1810 kernel: [ 1850.327738] compiz[11911]: segfault at 0 ip 00007f6c7baf0c16 sp 00007ffd5ec71c60 error 4 in i965_dri.so[7f6c7b513000+82d000]

After login I end up with an empty desktop, just a wallpaper, GUI/Unity are in a crash loop:

  • No panel.
  • No dash.
  • Can't start a program.
  • Launcher disappears.
  • Sidebar disappears.
  • System crash.
  • Windows key not working.
  • The key combination Alt+Tab not working.

Simply, the computer is not usable. Same for guest login. The only thing working: open up a terminal CTRL+ALT+T to examine log files.

I somehow forced Low Graphics Mode on Unity to let me log in and file the bug, but still lots of problems:

  • Dash not working
  • Alt+Tab not working
  • Sometimes windows all disappear for a few seconds

Bug report

Any ideas for a solution or workaround?

UPDATE

If you have the same/ very similar problems, follow the link to my bug report and mark there that you're affected too. Or file your own. Please leave a comment if you wish, or upvote - this is a nasty problem - but an answer should offer a fix or a workaround so users can use their computer again.

Without proper bug reports, Ubuntu can't fix issues.


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 .