The Gyroscope Problem
Modern laptops—especially 2-in-1 convertibles like the Lenovo Yoga, Dell XPS 2-in-1, and Microsoft Surface line—are equipped with internal hardware gyroscopes and accelerometers. When you install Ubuntu Linux on these devices, the GNOME desktop environment automatically detects these sensors and enables an “Auto-Rotate” feature. Just like a smartphone, turning your laptop sideways will cause the Linux desktop to instantly flip into portrait mode. While useful when using the device purely as a tablet, this feature is incredibly annoying when you are lying on the couch with your laptop on an angle, causing the screen to violently rotate upside down and ruin your workflow.
How to Disable Auto-Rotate from the System Menu
The quickest way to lock your screen orientation in place is by using the quick settings menu located in the top-right corner of the desktop.
1. Click the cluster of icons (Network, Volume, Battery) in the very top-right corner of the Ubuntu top bar to open the System Menu.
2. Look for an icon that looks like a padlock with a circular arrow around it (or a small rectangle turning sideways). This is the Orientation Lock button.
3. Click the icon so that it is highlighted or toggled “On”.
When the orientation lock is active, Ubuntu will completely ignore the hardware gyroscope. The screen will remain locked in its current position (usually standard Landscape) regardless of how you tilt or rotate the physical device.
How to Disable the Sensor Service via Terminal
If the quick-settings button is glitching, or if you are using an older laptop where a faulty sensor is constantly forcing the screen to flip randomly, you can permanently disable the underlying system service that reports sensor data to the graphical interface.
Ubuntu uses a service called `iio-sensor-proxy` to read accelerometer data. Stopping this service permanently solves the problem.
1. Open your terminal application.
2. To stop the service immediately for the current session, run:
sudo systemctl stop iio-sensor-proxy.service
3. To permanently disable the service so it never starts again upon rebooting, run:
sudo systemctl disable iio-sensor-proxy.service
4. Finally, mask the service so that no other application can accidentally attempt to restart it:
sudo systemctl mask iio-sensor-proxy.service
With the sensor proxy neutralized, the GNOME desktop receives no gyroscope data, ensuring your display orientation remains permanently fixed.