Skip to content

Commit

Permalink
Ensure render group present on AMD - Vast fix
Browse files Browse the repository at this point in the history
  • Loading branch information
robballantyne committed Apr 8, 2024
1 parent 08cd22e commit e11ccb2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions build/COPY_ROOT/opt/ai-dock/bin/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,14 @@ function init_create_user() {
useradd -ms /bin/bash $USER_NAME -d $home_dir -u $WORKSPACE_UID -g $WORKSPACE_GID
printf "user:%s" "${USER_PASSWORD}" | chpasswd
usermod -a -G $USER_GROUPS $USER_NAME

# For AMD devices - Ensure render group is created if /dev/kfd is present
if ! getent group render >/dev/null 2>&1 && [ -e "/dev/kfd" ]; then
groupadd -g "$(stat -c '%g' /dev/kfd)" render
usermod -a -G render $USER_NAME
fi

# May not exist - todo check device ownership
usermod -a -G render $USER_NAME
usermod -a -G sgx $USER_NAME
# See the README (in)security notice
printf "%s ALL=(ALL) NOPASSWD: ALL\n" ${USER_NAME} >> /etc/sudoers
Expand All @@ -265,7 +271,7 @@ function init_create_user() {
chown ${WORKSPACE_UID}:${WORKSPACE_GID} "${home_dir}/.bashrc" "${home_dir}/.profile"
fi
# Set initial keys to match root
if [[ -e /root/.ssh/authorized_keys && ! -d ${home_dir}/.ssh ]]; then
if [[ -e /root/.ssh/authorized_keys && ! -d ${home_dir}/.ssh ]]; then
rm -f ${home_dir}/.ssh
mkdir -pm 700 ${home_dir}/.ssh > /dev/null 2>&1
cp -f /root/.ssh/authorized_keys ${home_dir}/.ssh/authorized_keys
Expand Down

0 comments on commit e11ccb2

Please sign in to comment.