guysoft / CustomPiOS

A Raspberry Pi and other ARM devices distribution builder
GNU General Public License v3.0
497 stars 143 forks source link

Support user creation at build-time for raspbian and raspios #179

Open sunefred opened 1 year ago

sunefred commented 1 year ago

I am having some problems with functionality that requires a user and a home folder in my distro. I am using the base module to add the user and set the password:

export BASE_USER="myuser"
export BASE_ADD_USER="yes"
export BASE_USER_PASSWORD="mypassword"

Because the code path that updates the user for raspbian and raspios uses the /boot/userconf.txt method, the user is not created at build-time so myuser and its home folder will not exist during build. This also affects built in functionality, such as unpack which will fail with "User not found".

unpack /filesystem/home/myuser /home/"${BASE_USER}" "${BASE_USER}"

My workaround is to set the distro to something else to trigger normal user creation. This works for me only because I do not use other modules that requires the BASE_DISTRO variable.

export BASE_DISTRO="other"

Why not skip the /boot/userconf.txt method all together?

guysoft commented 1 year ago

Hey, just saw this now. What base image are you using? You can use the pi user and it should let uou access the user during build time

What exactly are you trying to rum?