TWRP and LineageOS display flipped (180 degree rotation) I installed the latest version of TWRP and LineageOS on my BQ Aquaris U Plus and followed all instructions. Somehow, both TWRP (twrp-3.2.1-0-tenshi) and LineageOS (lineage-14.1-20180127-nightly-tenshi-signed) are flipped upside down. 

As far as my search has led me, I have to edit the /system/build.prop and add the line 

ro.sf.hwrotation=0


However, I am not able to push the file back to my phone. Nor am I able to edit the file on the device itself. 

I am using the following code (Linux Mint): 

sudo adb kill-server
sudo adb start-server
sudo adb root
sudo adb devices
sudo adb remount
sudo nano build.prop 
sudo adb push build.prop /system


After that, adb does not seem to respond (empty line). 

Am I missing something? Is there any possibility to fix this issue?
I know, this was asked a long time ago... but, for future reference:

The problem seems to be the phone's firmware. The original stock ROM is still based on Android M ("Marshmallow"), but the current versions of LineageOS are based on Android N ("Nougat"). Apparently this is a problem, because between Android M and N, some things in the phone's firmware changed, causing the screen to be upside down. Flashing a new LineageOS, however, does not update the phone's firmware.

Update: As @loki mentioned in a comment, using the BQ Firmware Flash Tool is a convenient way to revert to the stock ROM and to update to the newest version. Afterwards, LineageOS can be installed as usual. I first assumed it would only be for Windows, but there is also a version for Ubuntu in the zip file.

My solution was:


Flash back the stock ROM with fastboot. Note: It doesn't work with TWRP; the zip file needs to be extracted. It contains a script which flashes all parts of the phone's software.
Use the stock ROM's updater to update to the newest version. This usually takes 2 update steps (probably because of the switch to Android N).
Start over with flashing TWRP. At this point, the screen orientation should be correct in TWRP.
Flash LineageOS with TWRP.


One final note: My phone needed a full data wipe in order to get rid of the disk encryption. The phone can be encrypted afterwards from within LineageOS, however, the original encryption from the stock ROM could not be decrypted correctly.