GloDroid / glodroid_manifest

Android port that aims to bring both user- and developer-friendly experience in using AOSP with a set of single-board computers (SBC), phones and other devices.
472 stars 66 forks source link

[PinePhone]: adb remount failed #161

Closed squidink7 closed 2 years ago

squidink7 commented 3 years ago

when I try to gain root access for adb, I need to remount the partitions, however when I run adb remount it results in this output:

Binder ioctl to enable oneway spam detection failed: Invalid argument
skip unmounted partition dev:/dev/block/dm-0 mnt:/system: Success
failed to remount partition dev:/dev/block/dm-1 mnt:/system_ext: Permission denied
failed to remount partition dev:/dev/block/dm-2 mnt:/vendor: Permission denied
failed to remount partition dev:/dev/block/dm-3 mnt:/product: Permission denied
remount failed

I tried running adb root and trying again but to no avail.

I'm using a pinephone and this happens both on v0.6.1 and v0.7.0

rsglobal commented 3 years ago

Yes it's a known issue. Unfortunately I haven't managed to fix it yet.

squidink7 commented 3 years ago

Ok! Well best of luck. I wish I could help but unfortunately I'm far from experienced at Android development. And thank you for your work on this project! being able to use my pinephone as an android development device is really awesome and actually got me into some basic app development! and that wouldn't have happened without the work you've been doing, so thank you again. You rock!

KonstaT commented 3 years ago

https://review.lineageos.org/c/LineageOS/android_system_core/+/318149 ?

rsglobal commented 3 years ago

@squidink7 ,

Thanks for your kind words.

@KonstaT ,

I believe this issue is related to some of kernel extra configurations or extra patches. This issue is only happens on kernel from Megous , which is used on the PinePhone, PineTab, Opi3. Other boards (rpi4, opi-plus2e, etc) has no issues with adb remount

KonstaT commented 3 years ago

Ok, just a FYI then that it's broken in current AOSP 12 branches (but fixed on master).

Can also reproduce that on my builds but only remounting system partition fails on adb remount.

rsglobal commented 3 years ago

I assume that lineage-rpi build is using system-as-root. (same as arpi). GloDroid uses initrd as root.

rsglobal commented 3 years ago

Just checked with my local build (AOSP 12r2) on rpi4:

$ adb remount
Binder ioctl to enable oneway spam detection failed: Invalid argument
Waited one second for gsiservice (is service started? are binder threads started and available?)
Using overlayfs for /system
Using overlayfs for /system_ext
Using overlayfs for /vendor
Using overlayfs for /product
Now reboot your device for settings to take effect
remount succeeded
KonstaT commented 3 years ago

Everything Android 10 and up is system-as-root by default (https://source.android.com/devices/bootloader/partitions/system-as-root). I didn't realize GloDroid was any different but now I see you set BOARD_BUILD_SYSTEM_ROOT_IMAGE := false (https://github.com/GloDroid/glodroid_device/blob/master/common/boardconfig-common.mk#L64).

Android 12 I have running is just plain AOSP (android-12.0.0_r2 to be precise). Nothing LineageOS as it's probably not even buildable without bunch of gerrit patches and it doesn't have much over AOSP yet anyway.

rsglobal commented 3 years ago

IIRC, system-is-root was Android-10 requirements only. Starting from 11 initrd-as-root is required by VTS again. No?

KonstaT commented 3 years ago

IDK, is it? :o Google certification has never been any goal for me so I haven't looked into VTS (and last time I even tried to run CTS was many many years ago on a completely different device).

BTW, that document I linked is pretty confusing: "Devices launching with Android 10: ... Must set BOARD_BUILD_SYSTEM_ROOT_IMAGE to false." AFAICT this is the retain the Android 9 behavior.

And later "In an Android 10 system-as-root configuration, the build always merges $TARGET_SYSTEM_OUT and $TARGET_ROOT_OUT into system.img; this config is the default behavior for all devices running Android 10.".

AFAIK system-as-root was done to get the init files that used to be in ramdisk.img to somewhere that is under dm-verity to improve security. dm-verity is of course not enabled on custom builds like this.

rsglobal commented 3 years ago

I found this: https://cs.android.com/android/platform/superproject/+/master:build/make/core/config.mk;l=852?q=%22cannot%20be%20true%20for%20devices%20with%20dynamic%20partitions%22

So once you have dynamic partitions you can't use system-as-root.

KonstaT commented 3 years ago

Ah, you're using dynamic partitions as well (I'm not).

LOL, everything changes between Android versions so just try to keep up. :)

rsglobal commented 3 years ago

LOL, everything changes between Android versions so just try to keep up. :)

https://www.youtube.com/watch?v=tjRln3WemG4&ab_channel=LinaroOrg

Here is a John's talk on this topic.

KonstaT commented 3 years ago

Yeah, actually already saw that earlier (watched your presentation as well :)).

Good points there that there isn't any actual reference point for maintaining an AOSP device configuration.

From my own experience you can get away using pretty legacy stuff (old HALs, old ways to implement things, etc) if it's not horribly broken. It's just a matter how much "technical debt" you want to leave yourself trying to keep up.

StuartRothrock commented 2 years ago

I appreciate the hard work you guys have done with this. Any update? Is there anything a less than decent hacker can do to fix this? Thanks.

rsglobal commented 2 years ago

It should work in the next release, but next release will be based on Android master branch ( not 12 anymore but not 13 yet )

StuartRothrock commented 2 years ago

Thanks. Any sort of date for a working alpha or beta?

On Sat, Feb 19, 2022 at 3:13 AM rsglobal @.***> wrote:

It should work in the next release, but next release will be based on Android master branch ( not 12 anymore but not 13 yet )

— Reply to this email directly, view it on GitHub https://github.com/GloDroid/glodroid_manifest/issues/161#issuecomment-1045964929, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7FRL35NRWX3FBMATQ7MYTU35GMFANCNFSM5G7OCKAQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

rsglobal commented 2 years ago

I can attach images next week or you can try building it from the sources (next branch)

StuartRothrock commented 2 years ago

Awesome. That'll work. I have a working build environment set up.

On Sat, Feb 19, 2022 at 7:25 AM rsglobal @.***> wrote:

I can attach images next week or you can try building it from the sources (next branch)

— Reply to this email directly, view it on GitHub https://github.com/GloDroid/glodroid_manifest/issues/161#issuecomment-1046006363, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7FRL32M3L3MZXAXDCSJBTU36D35ANCNFSM5G7OCKAQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

squidink7 commented 2 years ago

If you could upload the built images here that would be really nice! I would build it myself but I don't have the disk space.

StuartRothrock commented 2 years ago

Will do. Glad to share and save others' efforts.

On Sat, Feb 19, 2022 at 8:24 AM squidink7 @.***> wrote:

If you could upload the built images here that would be really nice! I would build it myself but I don't have the disk space.

— Reply to this email directly, view it on GitHub https://github.com/GloDroid/glodroid_manifest/issues/161#issuecomment-1046017779, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7FRL2X6XBLVHCDIZN262TU36KYDANCNFSM5G7OCKAQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

rsglobal commented 2 years ago

Awesome. That'll work. I have a working build environment set up.

Looks I forgot to update next with my latest local version and you may have build issue related to vibrator. You may disable vibrator for now.

StuartRothrock commented 2 years ago

ok. I would also like to disable the disk/partition encryption. Would that be an easy task to configure?

On Sat, Feb 19, 2022 at 8:48 AM rsglobal @.***> wrote:

Awesome. That'll work. I have a working build environment set up.

Looks I forgot to update next with my latest local version and you may have build issue related to vibrator. You may disable vibrator for now.

— Reply to this email directly, view it on GitHub https://github.com/GloDroid/glodroid_manifest/issues/161#issuecomment-1046022363, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7FRL7WMUEDAJAXGP26U2DU36NT5ANCNFSM5G7OCKAQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

rsglobal commented 2 years ago

Yes, open fstab and remove fileencryprion=xxxxx from sunxi section.

StuartRothrock commented 2 years ago

If you mean /vendor/etc/fstab, I can't remount /dev/block/dm-2 or /vendor with rw perms. I already tried changing it in GloDroid/device/glodroid/platform/fstab/fstab.cpp and recompiling. It never boots past the "android" splash. I'm willing to try something else.

On Sat, Feb 19, 2022 at 9:22 AM rsglobal @.***> wrote:

Yes, open fstab and remove fileencryprion=xxxxx from sunxi section.

— Reply to this email directly, view it on GitHub https://github.com/GloDroid/glodroid_manifest/issues/161#issuecomment-1046028198, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7FRL6QI5EHF3MBPRZ3MKDU36RS3ANCNFSM5G7OCKAQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

rsglobal commented 2 years ago

GloDroid/device/glodroid/platform/fstab/fstab.c

Yes, that should work. Make sure you erased user data partition.

StuartRothrock commented 2 years ago

It worked. I changed the fstab again and this time left off the comments I added the last time to show my changes. Thanks for the suggestion. I probably would not have tried it again without your reinforcement.

On Sat, Feb 19, 2022 at 10:56 AM rsglobal @.***> wrote:

GloDroid/device/glodroid/platform/fstab/fstab.c

Yes, that should work. Make sure you erased user data partition.

— Reply to this email directly, view it on GitHub https://github.com/GloDroid/glodroid_manifest/issues/161#issuecomment-1046047919, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7FRL6U5WMCQFQIOURJDBLU364S7ANCNFSM5G7OCKAQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

squidink7 commented 2 years ago

Do you still have this image around? If so could you upload it to some file sharing site and give a link? I'd love to try this out for myself Thank you!

rsglobal commented 2 years ago

I'll try to push remount related fixes asap. 2 overlayfs related configs has to be removed from defconfig to make it work properly.

StuartRothrock commented 2 years ago

squidink7 - if you are referring to me, I can directly share the images.tar.gz with you. How do I pm you?

StuartRothrock commented 2 years ago

@rsglobal If you had the time to make the changes for the remount problem, I should have my new mobo Tuesday and can test after that.The sdcard sense switch was broken in the original mobo.

rsglobal commented 2 years ago

Please test these images and give some feedback: https://github.com/rsglobal/glodroid_manifest/releases/tag/v0.7.1

StuartRothrock commented 2 years ago

I'll test the pinephone. I don't have a pinetab. My new mobo is "out for delivery" so I should be able to test later today.

On Tue, Mar 8, 2022 at 11:49 AM rsglobal @.***> wrote:

Please test these images and give some feedback: https://github.com/rsglobal/glodroid_manifest/releases/tag/v0.7.1

— Reply to this email directly, view it on GitHub https://github.com/GloDroid/glodroid_manifest/issues/161#issuecomment-1061985436, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7FRLZDJ6A2SO7XMBJYTH3U66AJBANCNFSM5G7OCKAQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

squidink7 commented 2 years ago

I got a "request would exceed partition size" when flashing the recovery

rsglobal commented 2 years ago

Sorry. Images updated, please check again

StuartRothrock commented 2 years ago

It loads. What am I to test?

StuartRothrock commented 2 years ago

If it was the adb remount - it returns this - Waited one second for gsiservice (is service started? are binder threads started and available?) then after maybe 60 seconds:

Using overlayfs for /system
Using overlayfs for /system_ext
Using overlayfs for /vendor
Using overlayfs for /product
Now reboot your device for settings to take effect
remount succeeded

And I can modify files in the /system directory!! Rebooted and it returns immediately after adb remount. AWESOME!!!

StuartRothrock commented 2 years ago

@rsglobal How can I apply these source changes into my already built source repo?

StuartRothrock commented 2 years ago

@rsglobal If I copy the source files from your link to the .repo/manifests directory and then start with the "repo sync -cq" - should that build properly?

rsglobal commented 2 years ago

Fixed in v0.7.1. (Release will be published soon)

StuartRothrock commented 2 years ago

The one posted the other day booted fine for me on the pinephone. Will try the new one. I am curious if this fixes the ability to mount / or /system for read/write.

On Wed, Mar 9, 2022 at 11:20 AM rsglobal @.***> wrote:

Sorry. Images updated, please check again

— Reply to this email directly, view it on GitHub https://github.com/GloDroid/glodroid_manifest/issues/161#issuecomment-1063103602, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7FRLY3TKOEPXZ7W74EMBTU7DFUHANCNFSM5G7OCKAQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>