Lagging box around mouse cursor on Ubuntu 17.04 and nvidia driver

I have a Laptop with a GeForce GTX 1050 Ti. Additionally, I have connected two displays to my Laptop via Displayport and installed the nvidia driver via sudo apt-get install nvidia-384 nvidia-settings. When I use the "Intel power saving mode" , then the mouse extremely flickers in some cases (usually only on the main screen of the laptop, but sometimes also on the others). Now I tried to switch to the "Nvidia performance mode" via prime-select nvidia. However, now I have the problem that there is a lagging box around the cursor, which does not show the updated graphics beneath the mouse and still is there for about a second when moving the mouse away. I made a screenshot, where I marked the text and unmarked it; the graphics of the marked text is still there:

enter image description here

The rest is working fine (no mouse flickering) and I would like to keep the nvidia mode. How can I solve the problem?

One addition: The box goes away after disconnecting the displayport (i.e. removing the two additional displays).


I also had this annoying problem, and I was able to solve it by running:

sudo service lightdm restart

(This was suggested in a comment by m00am. At first I had tried to restart sddm, but it displayed a message saying I did not have that service. Installing the sddm package didn't help, but finally chosing the lightdm service worked.)

I clicked OK, and my computer restarted. Finally the lagging and cursor not updating problems were solved.


I had this problem with an AOC portable monitor in Linux Mint 19.1. The solution to restart lightdm worked for me but it was annoying to restart on after every fresh boot. Hence I figured that lightdm is starting too early in the boot sequence, so I modified systemd service config files for a less annoying solution.

In /lib/systemd/system/displaylink-driver.service:

Changed the line After=display-manager.service to Before=display-manager.service

In /etc/systemd/system/display-manager.service:

Modified ExecStartPre to

ExecStartPre=/bin/sh -c '/bin/sleep 10 && [ "$(basename $(cat /etc/X11/default-display-manager 2>/dev/null))" = "lightdm" ]'

For Ubuntu 18.04 you can do the same edit, except to /lib/systemd/system/lightdm.service


Environment: Ubuntu 18.04 GTX1650 nvidia-430-driver(installed from ubuntu software)

Fixed the square around mouse problem by:

sudo apt install lightdm

Configure lightdm as default and reboot

sudo dpkg-reconfigure lightdm
sudo reboot

After rebooting, you will still see the square around mouse, then

sudo apt remove lightdm
sudo reboot

After rebooting, you will be in commandline.

sudo service gdm start

it will bring you into graphical mode again, and you will find that the square around mouse disappear

sudo dpkg-reconfigure gdm3

Then you do not need to type sudo service gdm start every time.

Hope it can help.