How do I use static UIDs and GIDs for services in my yocto build?
1
vote
0
answers
197
views
I have a piece of equipment running a yocto build. This build includes services like ssh-server, mysql, and ntp, with each run as their own users. mysql is UID 999, sshd is UID 998, etc.
In my latest yocto build, a new user called messagebus was added with UID 999. So now mysql is 998, and sshd is 997. This will break my system if I upgrade to it, because there is a variable partition with things like database files, which mysql needs access to, and are owned by UID 999.
How can I tell yocto which UIDs and GIDs I want to use for those services?
I'm finding a lot of information on how to do it for new recipes that I create, but not how to do it for existing recipes. I tried turning on
= "useradd-staticids"
in my local.conf, but that didn't do anything. It seems those recipes don't have the needed passwd and group files because when I also turned on = "error"
, I was getting errors for those services. I tried to create a recipe for mariadb that just did :prepend := "${THISDIR}/files:"
and then I had files passwd and group that had :x:999:999::/var/mysql:/bin/false
and :x:999:
respectively. I compiled this, and it built, but the rootfs /etc/passwd
file still had 998 as the UID.
Any ideas? Ideally I'd like to manage all this with just one file, but I'll have separate bbappends for each recipe if I have to do it that way.
Asked by Dave
(45 rep)
Jan 16, 2025, 08:40 PM