mkarchroot is failing with "permission denied" errors even if using it as root:
$this->bbcode_second_pass_code('', '
[root@linux ~]# mkarchroot $CHROOT/root base-devel
==> Creating install root at /root/chroot/root
==> Installing packages to /root/chroot/root
:: Synchronizing package databases...
core 264.0 KiB 243 KiB/s 00:01 [################################################################] 100%
extra 2.9 MiB 855 KiB/s 00:03 [################################################################] 100%
community 6.4 MiB 1959 KiB/s 00:03 [################################################################] 100%
alarm 7.2 KiB 800 KiB/s 00:05 [################################################################] 100%
aur 9.3 KiB 13.9 KiB/s 00:01 [################################################################] 100%
error: could not open file /root/chroot/root/var/lib/pacman/sync/core.db: Permission denied
error: could not open file /root/chroot/root/var/lib/pacman/sync/extra.db: Permission denied
error: could not open file /root/chroot/root/var/lib/pacman/sync/community.db: Permission denied
error: could not open file /root/chroot/root/var/lib/pacman/sync/alarm.db: Permission denied
error: could not open file /root/chroot/root/var/lib/pacman/sync/aur.db: Permission denied
error: target not found: base-devel
==> ERROR: Failed to install packages to new root
==> ERROR: Failed to install all packages
[root@linux ~]# ls -la chroot/root/var/lib/pacman/
local/ sync/
[root@linux ~]# ls -la chroot/root/var/lib/pacman/sync/
total 9832
drwxr-xr-x 2 root root 4096 Oct 31 19:27 .
drwxr-xr-x 4 root root 4096 Oct 31 19:27 ..
-rw-r--r-- 1 root root 58799 Oct 28 04:08 alarm.db
-rw-r--r-- 1 root root 9536 Oct 30 17:53 aur.db
-rw-r--r-- 1 root root 6669554 Oct 31 02:09 community.db
-rw-r--r-- 1 root root 270372 Oct 30 08:08 core.db
-rw-r--r-- 1 root root 3008500 Oct 30 23:08 extra.db
[root@linux ~]# echo $CHROOT
/root/chroot')
I've tried also setting permissions but I can't get it to replicate the install behaviour if modifying mkarchroot code to skip the check if the directory exists, it has to do with pacstrap.
Does anybody know what could possibly be going on? I mean, it's obviously the lack of permissions but I have no idea how to configure the script to handle this since the files are made during the install process and then used - so it needs to be an edit in the script code.