Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adduser: command not found #721

Open
JoelLinn opened this issue Nov 6, 2023 · 4 comments
Open

adduser: command not found #721

JoelLinn opened this issue Nov 6, 2023 · 4 comments

Comments

@JoelLinn
Copy link

JoelLinn commented Nov 6, 2023

With FIRST_USER_NAME being set, /bin/bash: line 2: adduser: command not found is raised here

if ! id -u ${FIRST_USER_NAME} >/dev/null 2>&1; then
adduser --disabled-password --gecos "" ${FIRST_USER_NAME}
fi
because /usr/sbin is not in PATH.
Possible fix is to add export PATH=$PATH:/usr/sbin inside the branch.

@JoelLinn
Copy link
Author

JoelLinn commented Nov 6, 2023

I suspect this might be because /usr/sbin is not in PATH on Arch Linux, maybe there should be a global check added or the PATH overwritten on chroot.

@XECDesign
Copy link
Member

Isn't that a configuration issues with the host OS then?

https://man.archlinux.org/man/file-hierarchy.7#COMPATIBILITY_SYMLINKS

@JoelLinn
Copy link
Author

JoelLinn commented Nov 6, 2023

Isn't that a configuration issues with the host OS then?

No since one can theoretically craft a Unix/Posix OS which has its binaries in /beehive or whatever, but if the corresponding PATH is not overwritten when chrooting, it will fail the pi-gen build.

https://man.archlinux.org/man/file-hierarchy.7#COMPATIBILITY_SYMLINKS

Even if that symlink may exists, it may not be in path by default on the host

@XECDesign
Copy link
Member

Oh right, yeah that makes sense. I didn't realise chroot inherited the host's PATH variable. I wouldn't be against a PR that sets PATH to something sensible when entering the chroot environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants