Android: read only filesystem

My Android mobile phone runs MicroG's LineageOS 14.1 version, and I wanted to add a gamepad controller configuration file onto the phone's system partition.

root?​

The system partition is only writable by the root user, but LineageOS by default does not have the su binary installed - you need to download it separately.

The LineageOS' developer settings also have a "root access" setting that has only two options:

But how to you get root access with adb? It turns out that there is a direct command for it:

$ adb root
$ adb shell
$ whoami
root

read-only filesystem​

After becoming root, I wanted to move the key layout file to the correct place:

$ adb push Vendor_2836_Product_0001.kl /sdcard/
$ adb shell
$ mv /sdcard/Vendor_2836_Product_0001.kl /system/usr/keylayout/
Error: read only filesystem

The /system partition is mounted as read-only, and I had to re-mount it as read/write:

$ adb root
$ adb shell
$ mount -o rw,remount /system
$ mv /sdcard/Vendor_2836_Product_0001.kl /system/usr/keylayout/
# .. success

Afterwards I changed owner, group and permissions of my file to be the same as those of the other files in the keylayout directory.

Written by Christian Weiske.

Comments? Please send an e-mail.