sleep 0.2 to prevent bus error after cloud-init

This commit is contained in:
pvincent
2024-02-22 10:34:00 +04:00
parent 353a553bc0
commit 9c9b395f51
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -109,7 +109,7 @@ EOF
lxc config set "$CONTAINER" environment.PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/miaou-bash/tools:/TOOLBOX -q lxc config set "$CONTAINER" environment.PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/miaou-bash/tools:/TOOLBOX -q
if [[ "$OPTION_NESTING" == true ]]; then if [[ "$OPTION_NESTING" == true ]]; then
lxc config set $CONTAINER security.nesting true -q lxc config set "$CONTAINER" security.nesting true -q
lxc config device add "$CONTAINER" miaou disk source=/opt/miaou path=/opt/miaou -q lxc config device add "$CONTAINER" miaou disk source=/opt/miaou path=/opt/miaou -q
fi fi
@@ -124,6 +124,7 @@ EOF
# purge cloud-init after success # purge cloud-init after success
lxc exec "$CONTAINER" -- systemd-run -q -p After=cloud-final.service -p Type=oneshot --no-block bash -c '\ lxc exec "$CONTAINER" -- systemd-run -q -p After=cloud-final.service -p Type=oneshot --no-block bash -c '\
sleep 0.2 &&\
cloud-init status --wait &&\ cloud-init status --wait &&\
cp /var/lib/cloud/data/status.json /root/cloud-status.json &&\ cp /var/lib/cloud/data/status.json /root/cloud-status.json &&\
systemctl stop cloud-{config,final,init-local,init}.service &&\ systemctl stop cloud-{config,final,init-local,init}.service &&\
+1 -1
View File
@@ -63,7 +63,7 @@ EOF
lxc exec "$CONTAINER" -- mkdir -p "/home/$SSH_USER/.ssh" lxc exec "$CONTAINER" -- mkdir -p "/home/$SSH_USER/.ssh"
lxc exec "$CONTAINER" -- chown "$SSH_USER:$SSH_USER" "/home/$SSH_USER/.ssh" lxc exec "$CONTAINER" -- chown "$SSH_USER:$SSH_USER" "/home/$SSH_USER/.ssh"
lxc exec "$CONTAINER" -- chmod 760 "/home/$SSH_USER/.ssh" lxc exec "$CONTAINER" -- chmod 760 "/home/$SSH_USER/.ssh"
lxc file push --uid 0 --gid 0 "/home/$miaou_user/.ssh/id_rsa.pub" "$CONTAINER/home/$SSH_USER/.ssh/authorized_keys" &>/dev/null lxc file push --uid 0 --gid 0 "/home/$miaou_user/.ssh/id_ed25519.pub" "$CONTAINER/home/$SSH_USER/.ssh/authorized_keys" &>/dev/null
lxc exec "$CONTAINER" -- chown "$SSH_USER:$SSH_USER" "/home/$SSH_USER/.ssh/authorized_keys" lxc exec "$CONTAINER" -- chown "$SSH_USER:$SSH_USER" "/home/$SSH_USER/.ssh/authorized_keys"
lxc exec "$CONTAINER" -- chmod 600 "/home/$SSH_USER/.ssh/authorized_keys" lxc exec "$CONTAINER" -- chmod 600 "/home/$SSH_USER/.ssh/authorized_keys"