rancher-sandbox / rancher-desktop

Container Management and Kubernetes on the Desktop
https://rancherdesktop.io
Apache License 2.0
5.93k stars 280 forks source link

Kubernetes Error - Rancher Desktop 1.12.3 - darwin (x64) (MAC OS - Sonoma 14.3) #6470

Open sapnaKundapura opened 8 months ago

sapnaKundapura commented 8 months ago
Screenshot 2024-02-13 at 3 03 10 PM

lima.log

Actual Behavior

Rancher desktop fails to start gives Kubernetes Erros

` '0' ], stdout: '', stderr: 'time="2024-02-13T13:32:42+05:30" level=debug msg="interpreting argument \"0\" as an instance name"\n' + 'time="2024-02-13T13:32:42+05:30" level=info msg="Using the existing instance \"0\""\n' + 'time="2024-02-13T13:32:42+05:30" level=fatal msg="errors inspecting instance: [strconv.Atoi: parsing \"\": invalid syntax]"\n', code: 1, [Symbol(child-process.command)]: '/Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/lima/bin/limactl.ventura --debug start --tty=false 0' } lima.log

Screenshot 2024-02-13 at 3 03 10 PM

`

Steps to Reproduce

Rancher Desktop to start

Result

Rancher desktop fails to start gives Kubernetes Erros

Expected Behavior

It should start normally and load the Image

Additional Information

No response

Rancher Desktop Version

1.12.3

Rancher Desktop K8s Version

Not using Kubernete - The version it shows is v1.29.1

Which container engine are you using?

moby (docker cli)

What operating system are you using?

macOS

Operating System / Build Version

Sonoma 14.3

What CPU architecture are you using?

x64

Linux only: what package format did you use to install Rancher Desktop?

None

Windows User Only

No response

jandubois commented 8 months ago

Can you attach the file ~/Library/Application\ Support/rancher-desktop/lima/0/lima.yaml to this bug?

Was this an upgrade of a previous version? If yes, do you happen to know which version it was before?

GabrielEngSist commented 7 months ago

I have the same issue after installing MacOS Updates to Sonoma 14.3.1 (23D60).

~/Library/Application\ Support/rancher-desktop/lima/0/lima.yaml:

ssh:
  loadDotSSHPubKeys: false
  localPort: 57071
firmware:
  legacyBIOS: false
containerd:
  system: false
  user: false
provision:
  - mode: system
    script: |
      #!/bin/sh
      set -o errexit -o nounset -o xtrace
      mkdir -p /bootfs
      mount --bind / /bootfs
      # /bootfs/etc is empty on first boot because it has been moved to /mnt/data/etc by lima
      if [ -f /bootfs/etc/os-release ] && ! diff -q /etc/os-release /bootfs/etc/os-release; then
        cp /etc/machine-id /bootfs/etc
        cp /etc/ssh/ssh_host* /bootfs/etc/ssh/
        mkdir -p /etc/docker /etc/rancher
        cp -pr /etc/docker /bootfs/etc
        cp -pr /etc/rancher /bootfs/etc

        rm -rf /mnt/data/etc.prev
        mkdir /mnt/data/etc.prev
        mv /etc/* /mnt/data/etc.prev
        mv /bootfs/etc/* /etc

        # install updated files from /usr/local, e.g. nerdctl, buildkit, cni plugins
        cp -pr /bootfs/usr/local /usr

        # lima has applied changes while the "old" /etc was in place; restart to apply them to the updated one.
        reboot
      fi
      umount /bootfs
      rmdir /bootfs
  - mode: system
    script: |
      #!/bin/sh
      set -o errexit -o nounset -o xtrace
      fstrim /mnt/data
  - mode: system
    script: |
      #!/bin/sh
      set -o errexit -o nounset -o xtrace
      sed -i -E 's/^#?MaxSessions +[0-9]+/MaxSessions 25/g' /etc/ssh/sshd_config
      rc-service --ifstarted sshd reload
  - mode: system
    script: |
      #!/bin/sh
      set -o errexit -o nounset -o xtrace
      if ! [ -d /mnt/data/root ]; then
        mkdir -p /root
        mv /root /mnt/data/root
      fi
      mkdir -p /root
      mount --bind /mnt/data/root /root
  - mode: system
    script: |
      #!/bin/sh
      set -o errexit -o nounset -o xtrace
      mkdir -p /etc/docker

      # Delete certs.d if it is a symlink (from previous boot).
      [ -L /etc/docker/certs.d ] && rm /etc/docker/certs.d

      # Create symlink if certs.d doesn't exist (user may have created a regular directory).
      if [ ! -e /etc/docker/certs.d ]; then
        # We don't know if the host is Linux or macOS, so we take a guess based on which mountpoint exists.
        if [ -d "/Users/${LIMA_CIDATA_USER}" ]; then
          ln -s "/Users/${LIMA_CIDATA_USER}/.docker/certs.d" /etc/docker
        elif [ -d "/home/${LIMA_CIDATA_USER}" ]; then
          ln -s "/home/${LIMA_CIDATA_USER}/.docker/certs.d" /etc/docker
        fi
      fi
  - mode: system
    script: |
      #!/bin/sh
      hostname lima-rancher-desktop
  - mode: system
    script: |
      #!/bin/sh
      set -o errexit -o nounset -o xtrace
      # During boot is the only safe time to delete old k3s versions.
      rm -rf /var/lib/rancher/k3s/data
      # Delete all tmp files older than 3 days.
      find /tmp -depth -mtime +3 -delete
  - mode: system
    script: |
      #!/bin/sh
      set -o errexit -o nounset -o xtrace
      for dir in / /etc /tmp /var/lib; do
        mount --make-shared "${dir}"
      done
  - mode: system
    script: |
      #!/bin/sh
      # Move logrotate to hourly, because busybox crond only handles time jumps up
      # to one hour; this ensures that if the machine is suspended over long
      # periods, things will still happen often enough.  This is idempotent.
      mv -n /etc/periodic/daily/logrotate /etc/periodic/hourly/
      rc-update add crond default
      rc-service crond start
  - mode: system
    script: |
      set -o errexit -o nounset -o xtrace
      usermod --append --groups docker "${LIMA_CIDATA_USER}"
  - mode: system
    script: |
      export CAROOT=/run/mkcert
      mkdir -p $CAROOT
      cd $CAROOT
      mkcert -install
      mkcert localhost
      chown -R nobody:nobody $CAROOT
  - mode: system
    script: |
      set -o errexit -o nounset -o xtrace

      # openresty is backgrounding itself (and writes its own pid file)
      sed -i 's/^command_background/#command_background/' /etc/init.d/openresty

      # configure proxy only when allowed-images exists
      aiListConf=/usr/local/openresty/nginx/conf/allowed-images.conf
      # Remove the reference to an obsolete image conf filename
      oldIAListConf=/usr/local/openresty/nginx/conf/image-allow-list.conf
      setproxy="[ -f $aiListConf ] && supervise_daemon_args=\"-e HTTPS_PROXY=http://127.0.0.1:3128 \$supervise_daemon_args\""
      for svc in containerd docker; do
        sed -i "\#-f $aiListConf#d" /etc/init.d/$svc
        sed -i "\#-f $oldIAListConf#d" /etc/init.d/$svc
        sed -i "/^supervise_daemon_args/a $setproxy" /etc/init.d/$svc
      done

      # Make sure openresty log directory exists
      install -d -m755 /var/log/openresty
  - mode: system
    script: |
      #!/bin/sh
      set -o errexit

      mount bpffs -t bpf /sys/fs/bpf
      mount --make-shared /sys/fs/bpf
      mount --make-shared /sys/fs/cgroup
portForwards:
  - guestPortRange:
      - 1
      - 65535
    guestIPMustBeZero: true
    hostIP: 0.0.0.0
  - guestSocket: /var/run/docker.sock
    hostSocket: /Users/bi002465/.rd/docker.sock
vmType: qemu
rosetta:
  enabled: false
  binfmt: false
images:
  - location: /Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/alpine-lima-v0.2.31.rd12-rd-3.18.0.iso
    arch: aarch64
cpus: 2
memory: 2147483648
mounts:
  - location: "~"
    writable: true
  - location: /tmp/rancher-desktop
    writable: true
  - location: /Volumes
    writable: true
  - location: /var/folders
    writable: true
  - location: /private/tmp
    writable: true
  - location: /private/var/folders
    writable: true
  - location: /Applications/Rancher Desktop.app/Contents/Resources/resources
    writable: true
mountType: reverse-sshfs
hostResolver:
  hosts:
    lima-rancher-desktop: lima-0
    host.rancher-desktop.internal: host.lima.internal
    host.docker.internal: host.lima.internal
arjunarunkumar92 commented 7 months ago

Facing similar issue with Rancher 1.12.3, here is a copy of lima.yaml

ssh:
  loadDotSSHPubKeys: false
  localPort: 56166
firmware:
  legacyBIOS: false
containerd:
  system: false
  user: false
provision:
  - mode: system
    script: |
      #!/bin/sh
      set -o errexit -o nounset -o xtrace
      mkdir -p /bootfs
      mount --bind / /bootfs
      # /bootfs/etc is empty on first boot because it has been moved to /mnt/data/etc by lima
      if [ -f /bootfs/etc/os-release ] && ! diff -q /etc/os-release /bootfs/etc/os-release; then
        cp /etc/machine-id /bootfs/etc
        cp /etc/ssh/ssh_host* /bootfs/etc/ssh/
        mkdir -p /etc/docker /etc/rancher
        cp -pr /etc/docker /bootfs/etc
        cp -pr /etc/rancher /bootfs/etc

        rm -rf /mnt/data/etc.prev
        mkdir /mnt/data/etc.prev
        mv /etc/* /mnt/data/etc.prev
        mv /bootfs/etc/* /etc

        # install updated files from /usr/local, e.g. nerdctl, buildkit, cni plugins
        cp -pr /bootfs/usr/local /usr

        # lima has applied changes while the "old" /etc was in place; restart to apply them to the updated one.
        reboot
      fi
      umount /bootfs
      rmdir /bootfs
  - mode: system
    script: |
      #!/bin/sh
      set -o errexit -o nounset -o xtrace
      fstrim /mnt/data
  - mode: system
    script: |
      #!/bin/sh
      set -o errexit -o nounset -o xtrace
      sed -i -E 's/^#?MaxSessions +[0-9]+/MaxSessions 25/g' /etc/ssh/sshd_config
      rc-service --ifstarted sshd reload
  - mode: system
    script: |
      #!/bin/sh
      set -o errexit -o nounset -o xtrace
      if ! [ -d /mnt/data/root ]; then
        mkdir -p /root
        mv /root /mnt/data/root
      fi
      mkdir -p /root
      mount --bind /mnt/data/root /root
  - mode: system
    script: |
      #!/bin/sh
      set -o errexit -o nounset -o xtrace
      mkdir -p /etc/docker

      # Delete certs.d if it is a symlink (from previous boot).
      [ -L /etc/docker/certs.d ] && rm /etc/docker/certs.d

      # Create symlink if certs.d doesn't exist (user may have created a regular directory).
      if [ ! -e /etc/docker/certs.d ]; then
        # We don't know if the host is Linux or macOS, so we take a guess based on which mountpoint exists.
        if [ -d "/Users/${LIMA_CIDATA_USER}" ]; then
          ln -s "/Users/${LIMA_CIDATA_USER}/.docker/certs.d" /etc/docker
        elif [ -d "/home/${LIMA_CIDATA_USER}" ]; then
          ln -s "/home/${LIMA_CIDATA_USER}/.docker/certs.d" /etc/docker
        fi
      fi
  - mode: system
    script: |
      #!/bin/sh
      hostname lima-rancher-desktop
  - mode: system
    script: |
      #!/bin/sh
      set -o errexit -o nounset -o xtrace
      # During boot is the only safe time to delete old k3s versions.
      rm -rf /var/lib/rancher/k3s/data
      # Delete all tmp files older than 3 days.
      find /tmp -depth -mtime +3 -delete
  - mode: system
    script: |
      #!/bin/sh
      set -o errexit -o nounset -o xtrace
      for dir in / /etc /tmp /var/lib; do
        mount --make-shared "${dir}"
      done
  - mode: system
    script: |
      #!/bin/sh
      # Move logrotate to hourly, because busybox crond only handles time jumps up
      # to one hour; this ensures that if the machine is suspended over long
      # periods, things will still happen often enough.  This is idempotent.
      mv -n /etc/periodic/daily/logrotate /etc/periodic/hourly/
      rc-update add crond default
      rc-service crond start
  - mode: system
    script: |
      set -o errexit -o nounset -o xtrace
      usermod --append --groups docker "${LIMA_CIDATA_USER}"
  - mode: system
    script: |
      export CAROOT=/run/mkcert
      mkdir -p $CAROOT
      cd $CAROOT
      mkcert -install
      mkcert localhost
      chown -R nobody:nobody $CAROOT
  - mode: system
    script: |
      set -o errexit -o nounset -o xtrace

      # openresty is backgrounding itself (and writes its own pid file)
      sed -i 's/^command_background/#command_background/' /etc/init.d/openresty

      # configure proxy only when allowed-images exists
      aiListConf=/usr/local/openresty/nginx/conf/allowed-images.conf
      # Remove the reference to an obsolete image conf filename
      oldIAListConf=/usr/local/openresty/nginx/conf/image-allow-list.conf
      setproxy="[ -f $aiListConf ] && supervise_daemon_args=\"-e HTTPS_PROXY=http://127.0.0.1:3128 \$supervise_daemon_args\""
      for svc in containerd docker; do
        sed -i "\#-f $aiListConf#d" /etc/init.d/$svc
        sed -i "\#-f $oldIAListConf#d" /etc/init.d/$svc
        sed -i "/^supervise_daemon_args/a $setproxy" /etc/init.d/$svc
      done

      # Make sure openresty log directory exists
      install -d -m755 /var/log/openresty
  - mode: system
    script: |
      #!/bin/sh
      set -o errexit

      mount bpffs -t bpf /sys/fs/bpf
      mount --make-shared /sys/fs/bpf
      mount --make-shared /sys/fs/cgroup
portForwards:
  - guestPortRange:
      - 1
      - 65535
    guestIPMustBeZero: true
    hostIP: 0.0.0.0
  - guestSocket: /var/run/docker.sock
    hostSocket: /Users/arjun.arun.kumar/.rd/docker.sock
vmType: qemu
rosetta:
  enabled: false
  binfmt: false
images:
  - location: /Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/alpine-lima-v0.2.31.rd12-rd-3.18.0.iso
    arch: aarch64
cpus: 2
memory: 6442450944
mounts:
  - location: "~"
    writable: true
  - location: /tmp/rancher-desktop
    writable: true
  - location: /Volumes
    writable: true
  - location: /var/folders
    writable: true
  - location: /private/tmp
    writable: true
  - location: /private/var/folders
    writable: true
  - location: /Applications/Rancher Desktop.app/Contents/Resources/resources
    writable: true
mountType: reverse-sshfs
hostResolver:
  hosts:
    lima-rancher-desktop: lima-0
    host.rancher-desktop.internal: host.lima.internal
    host.docker.internal: host.lima.internal
ElvenSpellmaker commented 7 months ago

I get a similar error on Windows 11, Kubernetes is disabled and so it shouldn't be trying to launch it at all? It's intermittent, and closing Rancher, wsl --shutdown and restarting sometimes fixes it.