Rsync a LXC privileged container changes some users

Hi to all,

Sorry if my question is trivial, but I’ve been on it for hours.

I am migrating a dedicated server to another, both running Debian 12 and LXC 5.0.2.

I use rsync -avhze from destination (pull), with root user on both sides, to preserve permissions and ownership based on users and groups names.

It works well except for some users that have different numeric IDs (edit) don’t exist in host : below an example in /path/to/container/rootfs/var/lib/

Old host :

drwx--S---  7 systemd-resolve  systemd-network 4,0K 10 juil. 18:10 mysql/
drwx------  2 systemd-resolve  systemd-network 4,0K  4 juin   2017 mysql-files/
drwxr-xr-x  2 glances          tcpdump         4,0K 25 oct.   2023 ntp/

Same with numeric IDs :

drwx--S---  7 102 103 4,0K 10 juil. 18:10 mysql/
drwx------  2 102 103 4,0K  4 juin   2017 mysql-files/
drwxr-xr-x  2 109 116 4,0K 25 oct.   2023 ntp/

Inside old container : (all’s fine here, and numeric IDs are the same as in host)

drwx--S---  7 mysql   mysql 4,0K 10 juil. 18:10 mysql/
drwx------  2 mysql   mysql 4,0K  4 juin   2017 mysql-files/
drwxr-xr-x  2 ntp     ntp   4,0K 25 oct.   2023 ntp/

New host : (some users/groups names differ from old host)

drwx--S---  7 systemd-resolve systemd-network 4.0K Jul 10 16:10 mysql/
drwx------  2 tcpdump         kvm             4.0K Jun  4  2017 mysql-files/
drwxr-xr-x  2             109 tcpdump         4.0K Oct 25  2023 ntp/

Same with numeric IDs : (some users/groups numbers differ from old host)

drwx--S---  7 996 998 4.0K Jul 10 16:10 mysql/
drwx------  2 102 103 4.0K Jun  4  2017 mysql-files/
drwxr-xr-x  2 109 107 4.0K Oct 25  2023 ntp/

Inside new container : (wrong users/groups)

drwx--S---  7     996 polkitd 4.0K Jul 10 18:10 mysql/
drwx------  2     996 polkitd 4.0K Jun  4  2017 mysql-files/
drwxr-xr-x  2 ntp     input   4.0K Oct 25  2023 ntp/

Same with numeric IDs : (different from new host!)

drwx--S---  7 996 998 4.0K Jul 10 18:10 mysql/
drwx------  2 996 998 4.0K Jun  4  2017 mysql-files/
drwxr-xr-x  2 109 107 4.0K Oct 25  2023 ntp/

Relevant users in old host :

mysql:x:102:103:MySQL Server,,,:/nonexistent:/bin/false
systemd-network:x:105:110:systemd Network Management,,,:/run/systemd/netif:/bin/false
systemd-resolve:x:106:111:systemd Resolver,,,:/run/systemd/resolve:/bin/false
ntp:x:109:116::/home/ntp:/bin/false
systemd-coredump:x:999:999:systemd Core Dumper:/:/usr/sbin/nologin
polkitd:x:998:998:polkit:/nonexistent:/usr/sbin/nologin

Relevant users in new host :

(no mysql, ntp users, as I never installed mysql on host and don't need ntp anymore)
systemd-network:x:998:998:systemd Network Management:/:/usr/sbin/nologin
systemd-resolve:x:996:996:systemd Resolver:/:/usr/sbin/nologin
polkitd:x:995:995:polkit:/nonexistent:/usr/sbin/nologin

I read some pages about LXC ID mapping and rsync options, but the effects are confusing to me, I don’t understand what I should do to manage this properly.

Of course some chown cleaning would do the job, but I want to understand and be able to migrate the right way, so any help appreciated!
Thanks,

It seems that users & groups that already exist in the destination host, will be regognized as owners inside the container, right ?

Does it make sense to create missing users in the host, just for the need of rsync ? Seems odd though… and not much easier to maintain than a bunch of manual chown