Ubuntu 18.04 LTS Display flashes and turns upside down - How to fix?
Your laptop has an gyroscope chip in it and it thinks the level is changing. In 18.04 turn off auto rotation with the little icon next to the system menu in the upper right corner.
xrandr --output {OUTPUT} --rotate normal
To find out your OUTPUT
xrandr -q
Sample:
xrandr --output eDP-1 --rotate normal
Update
As described by @user847668 in his answer that you can turn off rotation for fixing it permanently.
Turn Off Auto Rotation
- From Top right menu
- Or SuperKey+o
You could blacklist the kernel module for accelerometer of your HP laptop:
sudo nano /etc/modprobe.d/blacklist.conf
and add the following line in blacklist.conf, create file if it doesn't exist:
blacklist hp_accel
Of course, the module name for your laptop could be different. You can list all loaded kernel modules with:
lsmod
In case if you have an SSD, this module is no longer needed. If you have HDD, the module is needed to protect your HDD from sudden fall.