how to syncthing filesystem "system-ro" to filesystem "system-rw" for files and permissions + simlinks

Hello to everyone.

I want to virtualize correctly Android 10 on top of my Jetson nano (arm64) using qemu and kvm on ubuntu 18.04. This is the tutorial that I’m following :

everything went good until this command :

sudo rsync -avxHAX system-r{o,w}/

something is not good because I get a lot of errors when I transfer the files and permissions from the source to the destination path (both are on the same disk and on the same ext4 partition. You can see the full log with the errors here :

https://pastebin.ubuntu.com/p/W9GjPCt8G4/

the consequence of these errors is that when I try to emulate android with qemu like this :

qemu-system-aarch64 \
-enable-kvm \
-smp 4 \
-m 2048 \
-cpu host \
-M virt \
-device virtio-gpu-pci \
-device usb-ehci \
-device usb-kbd \
-device virtio-tablet-pci \
-usb \
-serial stdio \
-display sdl,gl=on \
-kernel aosp/Image \
-initrd aosp/ramdisk.img \
-drive index=0,if=none,id=system,file=aosp/system.img \
-device virtio-blk-pci,drive=system \
-drive index=1,if=none,id=vendor,file=aosp/vendor.img \
-device virtio-blk-pci,drive=vendor \
-drive index=2,if=none,id=userdata,file=aosp/userdata.img \
-device virtio-blk-pci,drive=userdata \
-full-screen \
-append "console=ttyAMA0,38400 earlycon=pl011,0x09000000 drm.debug=0x0 rootwait rootdelay=5 androidboot.hardware=ranchu androidboot.selinux=permissive security=selinux selinux=1 androidboot.qemu.hw.mainkeys=0 androidboot.lcd.density=160"

this is the error that I get :

[ 2.532754] init: init first stage started!
[ 2.535936] init: [libfs_mgr]ReadFstabFromDt(): failed to read fstab from dt
[ 2.540632] init: [libfs_mgr]ReadDefaultFstab(): failed to find device default fstab
[ 2.546246] init: Failed to fstab for first stage mount
[ 2.549616] init: Using Android DT directory /proc/device-tree/firmware/android/
[ 2.555116] init: [libfs_mgr]ReadDefaultFstab(): failed to find device default fstab
[ 2.560762] init: First stage mount skipped (missing/incompatible/empty fstab in device tree)
[ 2.566906] init: Skipped setting INIT_AVB_VERSION (not in recovery mode)
[ 2.571227] init: execv("/system/bin/init") failed: No such file or directory
[ 2.593768] init: #00 pc 00000000000e90a0 /init
[ 2.599958] reboot: Restarting system with command 'bootloader'

I tried to change my /etc/fstab file like this :

UUID=84d024e0-c8c7-42c0-ad3e-c3e0c1cacdb7 / ext4 acl,user_xattr,noatime,errors=remount-ro 0 1

and also like this :

UUID=84d024e0-c8c7-42c0-ad3e-c3e0c1cacdb7 / ext4 defaults,acl,user_xattr,noatime,errors=remount-ro 0 1

but the error still there :

sending incremental file list
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/system-rw/bin": Operation not supported (95)
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/system-rw/bugreports": Operation not supported (95)
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/system-rw/charger": Operation not supported (95)
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/system-rw/d": Operation not supported (95)
.....
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/system-rw/system/usr/icu": Operation not supported (95)

sent 109,493 bytes received 1,223 bytes 221,432.00 bytes/sec
total size is 1,354,488,586 speedup is 12,233.90
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330) [sender=3.2.3]

this is also interesting :

root@Z390-AORUS-PRO:/home/ziomario/Scrivania/antmicro/aosp_images# sudo mount -o remount,acl /
root@Z390-AORUS-PRO:/home/ziomario/Scrivania/antmicro/aosp_images# sudo rsync -avxHAX system-r{o,w}/

sending incremental file list
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/system-rw/bin": Operation not supported (95)
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/system-rw/bugreports": Operation not supported (95)
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/system-rw/charger": Operation not supported (95)

and so on. I’ve experimented a little bit. This is what I did.

On the source file system there is a symlink called “d”. This is its “stat” ;

ziomario@Z390-AORUS-PRO:~/Scrivania/antmicro/aosp_images/system-ro$ stat d

File: d -> /sys/kernel/debug
Size: 17              Blocks: 0          IO Block: 4096   symbolic link
Device: 715h/1813d      Inode: 19          Links: 1
Access: (0644/lrw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-04-05 17:50:13.000000000 +0200
Modify: 2021-04-05 17:50:13.000000000 +0200
Change: 2021-04-05 17:50:13.000000000 +0200
Birth: 2021-04-05 17:50:27.000000000 +0200

this is what happens when I try to copy it on the destination fs :

ziomario@Z390-AORUS-PRO:~/Scrivania/antmicro/aosp_images$ sudo rsync -avxHAX system-r{o,w}/d

sending incremental file list
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/sys
tem-rw/d": Operation not supported (95)
d -> /sys/kernel/debug
rsync: [receiver] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/syst
em-rw/d": Operation not supported (95)

sent 110 bytes  received 20 bytes  260.00 bytes/sec
total size is 17  speedup is 0.13
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330)
[sender=3.2.3]

the symlink d has been copied on the destination fs and this is its “stat”

ziomario@Z390-AORUS-PRO:~/Scrivania/antmicro/aosp_images/system-rw$ stat d
 File: d -> /sys/kernel/debug
 Size: 17              Blocks: 0          IO Block: 4096   symbolic link
Device: 714h/1812d      Inode: 4148        Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-04-08 00:51:00.699158895 +0200
Modify: 2021-04-05 17:50:13.000000000 +0200
Change: 2021-04-08 00:48:37.187748517 +0200
Birth: 2021-04-08 00:48:37.187748517 +0200

lets see what happens with the folder “odm”. This is what happens when I try to copy it on the destination fs :

ziomario@Z390-AORUS-PRO:~/Scrivania/antmicro/aosp_images$ sudo rsync -avxHAX system-r{o,w}/odm

sending incremental file list
created directory system-rw/odm
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/sys
tem-rw/odm/odm/app": Operation not supported (95)
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/sys
tem-rw/odm/odm/bin": Operation not supported (95)
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/sys
tem-rw/odm/odm/etc": Operation not supported (95)
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/sys
tem-rw/odm/odm/firmware": Operation not supported (95)
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/sys
tem-rw/odm/odm/framework": Operation not supported (95)
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/sys
tem-rw/odm/odm/lib": Operation not supported (95)
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/sys
tem-rw/odm/odm/lib64": Operation not supported (95)
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/sys
tem-rw/odm/odm/overlay": Operation not supported (95)
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/sys
tem-rw/odm/odm/priv-app": Operation not supported (95)
rsync: [generator] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/sys
tem-rw/odm/odm/usr": Operation not supported (95)
odm/
odm/app -> /vendor/odm/app
odm/bin -> /vendor/odm/bin
odm/etc -> /vendor/odm/etc
odm/firmware -> /vendor/odm/firmware
odm/framework -> /vendor/odm/framework
odm/lib -> /vendor/odm/lib
odm/lib64 -> /vendor/odm/lib64
odm/overlay -> /vendor/odm/overlay
odm/priv-app -> /vendor/odm/priv-app
odm/usr -> /vendor/odm/usr
rsync: [receiver] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/syst
em-rw/odm/odm/app": Operation not supported (95)
rsync: [receiver] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/syst
em-rw/odm/odm/bin": Operation not supported (95)
rsync: [receiver] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/syst
em-rw/odm/odm/etc": Operation not supported (95)
rsync: [receiver] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/syst
em-rw/odm/odm/firmware": Operation not supported (95)
rsync: [receiver] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/syst
em-rw/odm/odm/framework": Operation not supported (95)
rsync: [receiver] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/syst
em-rw/odm/odm/lib": Operation not supported (95)
rsync: [receiver] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/syst
em-rw/odm/odm/lib64": Operation not supported (95)
rsync: [receiver] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/syst
em-rw/odm/odm/overlay": Operation not supported (95)
rsync: [receiver] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/syst
em-rw/odm/odm/priv-app": Operation not supported (95)
rsync: [receiver] failed to set permissions on "/home/ziomario/Scrivania/antmicro/aosp_images/syst
em-rw/odm/odm/usr": Operation not supported (95)

sent 742 bytes  received 96 bytes  1,676.00 bytes/sec
total size is 172  speedup is 0.21
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330)
[sender=3.2.3]

this is the “stat” of the odm folder on the source fs :

ziomario@Z390-AORUS-PRO:~/Scrivania/antmicro/aosp_images/system-ro$ stat odm
 File: odm
 Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: 715h/1813d      Inode: 37          Links: 2
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-04-05 16:08:38.000000000 +0200
Modify: 2021-04-05 16:08:38.000000000 +0200
Change: 2021-04-05 16:08:38.000000000 +0200
Birth: 2021-04-05 17:50:27.000000000 +0200

instead this is the stat of the odm folder on the destination fs :

ziomario@Z390-AORUS-PRO:~/Scrivania/antmicro/aosp_images/system-rw$ stat odm
 File: odm
 Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: 714h/1812d      Inode: 8205        Links: 3
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-04-08 00:59:21.666709924 +0200
Modify: 2021-04-08 00:59:21.670709992 +0200
Change: 2021-04-08 00:59:21.670709992 +0200
Birth: 2021-04-08 00:59:21.666709924 +0200

contents of the odm folder on the source :

10 items, totalling 172 bytes

contents of the odm folder on destination :

11 items, totalling 4.3 kB

there is something that’s not good,with the permissions and with the size.

check the images below. The first one is the source fs. The second one is the destination fs. Can you see the differences ?

Since no-one is able to help me to fix this issues and,also,it seems that there aren’t fixes for this problem,I’m looking for an alternative,for a tool similar to rsync. Googling a little bit I’ve found syncthing. Anyway I’m not really sure that it works like I need. I should sync the files and permissions from the read only file system called “system-ro” to the destination file system called “system-rw” as explained on the tutorial,here :

mkdir {system,vendor}-r{o,w}
dd if=/dev/zero of=system-rw.img bs=512 count=6291456
mkfs.ext4 system-rw.img -L "/"
sudo mount system-rw.img system-rw
sudo mount out/target/product/generic_arm64/system.img system-ro -o ro
----> sudo rsync -avxHAX system-r{o,w}/
sudo umount system-r{o,w}
mv system-rw.img out/target/product/generic_arm64/system.img

can someone tell me how can I do this,using syncthing ? thanks.

Syncthing doesn’t sync between local filesystems, and also doesn’t do a better job of copying permissions than rsync. I suggest you figure out the root cause of whatever is your problem and continue using rsync.

unfortunately I’m not so experienced and I’ve already asked to some developers and even them threw in the towel. anyway,thanks.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.