lineageos4microg / android_vendor_partner_gms

33 stars 66 forks source link

error: mkdir(/default-permissions): Permission denied when building LineageOS 15.1 #32

Open K4sum1 opened 2 months ago

K4sum1 commented 2 months ago

It builds fine without the GMS env variable. This is not with docker, this is under Ubuntu 22.04.

(.lineage_venv) administrator@Android-VM:~/android/lineage$ m -j8 bacon
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=8.1.0
TARGET_PRODUCT=lineage_lilac
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=cortex-a73
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv7-a-neon
TARGET_2ND_CPU_VARIANT=cortex-a73
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-6.5.0-28-generic-x86_64-with-Ubuntu-22.04-jammy
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=OPM7.181205.001
OUT_DIR=/home/administrator/android/lineage/out
WITH_GMS=true
============================================
ninja: no work to do.
ninja: no work to do.
No need to regenerate ninja file
[  0% 0/802] Install: /default-permissions/default-permissions-com.google.android.gms.xmlninja: error: mkdir(/default-permissions): Permission denied

ninja: build stopped: .
15:50:17 ninja failed with: exit status 1

#### failed to build some targets (10 seconds) ####

It also appears to happen under sudo su, although maybe source .lineage_venv breaks sudo su idk.

Edit: I am a dumbass. I switched back to the wrong terminal. I tried building under sudo su, and it wanted to do a full rebuild and near instantly failed setting up the jack server.

Edit 2: sudo su fucked everything up. Good thing I have snapshots.

petefoth commented 2 months ago

From that log entry, you are working in a source directory where you have already tried building (at least) once

ninja: no work to do. ninja: no work to do. No need to regenerate ninja file

If you did that build as a different user ( e.g. as root after sudo su) then the user doing the new build will not have permissions to write anywhere in the source tree. Solution is to remove the soirce tree and start from scratch (and maybe close the issue as the fault is not with the code in this repo)

K4sum1 commented 2 months ago

Oh it happens with first build or if I do it later. Let me finish restoring the snapshot, and I'll send full log of a normal fresh build.

K4sum1 commented 2 months ago

Oh wow it happens a lot sooner than I remember. https://pastebin.com/PsA9Q8q0

K4sum1 commented 2 months ago

I got it to work by reverting these two commits

https://github.com/lineageos4microg/android_vendor_partner_gms/commit/38ae44659d8c8355b428cf16e8f686d93dfbc87f (requires some conflict resolving)

https://github.com/lineageos4microg/android_vendor_partner_gms/commit/ea323e9f915d3c0511ce33558dac8d6c9cf3a612

Here's the current patch (both reverts combined into one) https://github.com/Eclipse-Community/build_lineage/blob/lineage-15.1/patches/fix-build-error-with-microg.patch

petefoth commented 2 months ago

I got it to work by reverting these two commits

38ae446 (requires some conflict resolving)

ea323e9

From the dates of those commits, it looks like they were required when moving to Android 12 (S) / LOS 19.1. All subsequent commits have also been required for that and subsequent Android / LOS versions. So reverting them isn't an option as it would almost certainly break building the currently supported versions.

This repo does not have version-specific branches. The fix for your problem may be to specify the commit previous to the ones you want to revert (i.e. this commit in the REVISION parameter in your manifest e.g. `

If that fix works, we can think about either documenting it in the Ci/Cd project README.md or creating a lineage-15.1 branch in this project.

(I'm assuming that you do have a manifest specifying this repo. If not and you have got this) project by using git clone... outside of repo, then just checkout the required revision e.g. cd vendor/partner_gms && git checkout ea323e9f915d3c0511ce33558dac8d6c9cf3a612

K4sum1 commented 2 months ago

The fix for your problem may be to specify the commit previous to the ones you want to revert

Sure, but then I get ancient versions of MicroG and F-Droid and such. That is also how I found the commits, I checked out one before the suspected problem commits, and that builds fine too. I decided on the revert method since I get up to date MicroG.

petefoth commented 2 months ago

but then I get ancient versions of MicroG and F-Droid and such.

Which will be updated by F-Droid after the ROM is installed and run. If you're prepared to try using the specific commit, I can add the appropriate documentation and create a 15.1 specific branch, which can then get the newer versions separately.

K4sum1 commented 2 months ago

If you're prepared to try using the specific commit, I can add the appropriate documentation and create a 15.1 specific branch, which can then get the newer versions separately.

Well, I did already try previous commits, that's how I found those to break.

Last working: https://github.com/lineageos4microg/android_vendor_partner_gms/commit/323d6edbd66ce6e871f5a3e3b52fa213c6f892ee