This question is clearly realted to this one.

However, I tried the suggested approaches and neither of them worked.

Let me explain what happend:
I'm using an Asus notebook with an integrated NVIDIA GPU. However, I've only been using the Intel graphics and it worked fine. I needed the NVIDIA driver for CUDA, so I installed the matching driver from the NVIDIA website.
Afterwards, I could not log in ubuntu with a GUI, but only in text mode.
I then uninstalled all NVIDIA packages. However, I think that I broke something, because I have the same black boxes around all windows, as described in the referenced question.