Upside down mouse cursor and inverted position on Ubuntu 18.04
I tried following these instructions, but that didn't work. Then what I did was simply open Terminal using Ctrl+Alt+T and invert the screen using
xrandr --output eDP-1 --rotated inverted
Then running
sudo apt-get update
sudo apt-get upgrade
After rebooting, everything went back to normal.
To prevent GNOME from communicating with the sensor hardware I ran the command
sudo apt-get remove iio-sensor-proxy
This solved everything for me.
You can just run
sudo apt remove iio-sensor-proxy
and reboot then. Everything would come back to normal.