lima icon indicating copy to clipboard operation
lima copied to clipboard

SSH `ControlMaster` breaks group update in provision section

Open dictcp opened this issue 3 years ago • 2 comments

For a lima-vm config similar to the following one

provision:
  - mode: system
    script: |
      #!/bin/bash
      set -eux -o pipefail
      command -v docker >/dev/null 2>&1 && exit 0
      export DEBIAN_FRONTEND=noninteractive
      curl -fsSL https://get.docker.com | sh
  - mode: user
    script: |
      #!/bin/bash
      set -eux -o pipefail
      sudo usermod -G docker -a $(whoami)

The usage in ssh ops -o ControlMaster=auto will leads the ssh connection is being re-used, which is created before the provision script is executed (where the user group is updated)

Expected behaviour: the group update via provision section is effective

Actual behaviour: the group update is effective, unless a new ssh connection is created, OR VM is rebooted.

dictcp avatar Dec 06 '21 17:12 dictcp

This seemed historically to always happen, when using Ansible to install Docker (it uses python-over-ssh to install things)

afbjorklund avatar Dec 08 '21 16:12 afbjorklund

@dictcp FYI you can chmod 777 /var/run/docker.sock as a work around. https://github.com/lima-vm/lima/issues/528#issuecomment-1130451916

chancez avatar May 18 '22 19:05 chancez