System user shifting

I have noticed that some of the system user is “shifting” from time to time. I have enabled navidrome service and have /var/lib/navidrome preserved by preservation with user and group both set to navidrome. From time to time, the /var/lib/navidrome directory and some of its subdirectories and files and have their user changed to something else and that leads to navidrome service to fail. Since both the parent directory and some of the subdirectories get affected, I assume it is not the problem for perservation.

This also happens on another machine. On that machine, I have setup a system user syncoid manually and then I run the command zfs allow -u syncoid send,hold,mount <dataset> for syncoid syncing. But after sometime I found that the allowed user has changed from syncoid to sshd.

This confuses me as I have to manually change back the shifted user. Why is this happening and any way to solve it?

Thanks.

Do you have /var/lib/nixos preserved?

Yes, I have that preserved.

It sounds like the UIDs/GIDs on your system are being remapped. make sure /var/lib/nixos/uid-map and /var/lib/nixos/gid-map are being preserved. consider backing these up and next time you notice the users shifting, compare the maps to see what’s going on.

2 Likes

I have backed up /var/lib/nixos and compare the files after the users shifting and found no difference between them.

I also noticed that the shifting happened only after system reboot.

To be clear, are the actual numeric UID/GIDs (as opposed to human-friendly “syncoid”/“sshd”) on the files shifting?

It would be helpful to understand if the file attrs themselves are being changed vs. the system’s understanding of them. Since you say that the uid-map/gid-map are unchanged, that leads me to believe the numeric ids in the file attrs are changing, but it would be better to have confirmation.

2 Likes