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

Unable to start colima, when path of home folder contains BLANK #724

Closed
1 of 5 tasks
bigguyong opened this issue May 24, 2023 · 8 comments
Closed
1 of 5 tasks

Unable to start colima, when path of home folder contains BLANK #724

bigguyong opened this issue May 24, 2023 · 8 comments
Labels
bug Something isn't working
Milestone

Comments

@bigguyong
Copy link

Description

Unable to start colima, seems caused by the home folder's path, it contains a BLANK. For privacy reason, I replace the path name of home folder to "AAAAA BB"

{"level":"debug","msg":"Creating iso file /Users/AAAAA BB/.lima/colima/cidata.iso","time":"2023-05-24T17:31:03+08:00"}
{"level":"debug","msg":"Using /var/folders/rk/35js3v794kq79srwrx20mj800000gp/T/diskfs_iso3638406399 as workspace","time":"2023-05-24T17:31:03+08:00"}
{"level":"debug","msg":"Failed to detect CPU features. Assuming that AES acceleration is available on this Apple silicon.","time":"2023-05-24T17:31:03+08:00"}
{"level":"debug","msg":"OpenSSH version 9.0.1 detected","time":"2023-05-24T17:31:04+08:00"}
{"level":"debug","msg":"AES accelerator seems available, prioritizing aes128-gcm@openssh.com and aes256-gcm@openssh.com","time":"2023-05-24T17:31:04+08:00"}
{"level":"warning","msg":"Specifying args ([BB/.colima/_wrapper/3a9197e1ca3cd2da076da2b473d7a7eb118e2cca/bin/qemu-system-aarch64]) via $QEMU_SYSTEM_AARCH64 is supported only for debugging!","time":"2023-05-24T17:31:04+08:00"}
{"level":"fatal","msg":"exec: "/Users/AAAAA": stat /Users/AAAAA: no such file or directory","time":"2023-05-24T17:31:04+08:00"}

Version

Colima Version: 0.5.5
Lima Version:0.15.1
Qemu Version:8.0.0

Operating System

  • macOS Intel <= 12 (Monterrey)
  • macOS Intel >= 13 (Ventura)
  • macOS M1 <= 12 (Monterrey)
  • macOS M1 >= 13 (Ventura)
  • Linux

Output of colima status

FATA[0000] colima is not running

Reproduction Steps

Expected behaviour

No response

Additional context

No response

@watersb
Copy link
Contributor

watersb commented May 26, 2023

I just completed a patch for Colima to use the XDG_Base_Dirs specification if things like XDG_CONFIG_HOME are defined in the environment.

It also falls back on using the Go stdlib os.UserConfigDir() and os.UserCacheDir(), which should point to your ~/Library/Application Support and ~/Library/Caches folders on macOS, if you're not using the XDG...

I haven't yet tested it on a HOME with spaces in the path, but I'll take a look.

colima-XDGBaseDir.patch

@abiosoft
Copy link
Owner

@watersb there is a dedicate issue for that #483, you can move the conversation over.

@watersb
Copy link
Contributor

watersb commented May 26, 2023

As a work-around, you can try setting the environment variable LIMA_HOME to something that doesn't have spaces, for example

export LIMA_HOME="/opt/lima"
sudo mkdir $LIMA_HOME
sudo chown $USERNAME $LIMA_HOME

as this may be a problem in the upstream Lima tool, rather than in Colima.

@abiosoft
Copy link
Owner

as this may be a problem in the upstream Lima tool, rather than in Colima.

It is most likely an upstream issue.

@bigguyong can you share the generated lima config located at ~/.lima/colima/lima.yaml ?

@jandubois
Copy link

It is most likely an upstream issue.

I think you are setting QEMU_SYSTEM_AARCH64 to a filename with a space in it. Try surrounding the filename with quotes, as we parse the env variable with shellwords.Parse().

I know for a fact that having spaces in LIMA_HOME is not a problem because Rancher Desktop sets it to "$HOME/Library/Application Support/rancher-desktop/lima" and it works fine.

@abiosoft abiosoft added the bug Something isn't working label May 26, 2023
@jandubois
Copy link

I'm wondering if you are using QEMU_SYSTEM_* to pass additional arguments to qemu. If this is necessary for regular operations, then it would be good to open an enhancement request against Lima so we can support this normally via lima.yaml. The environment variables are supposed to be a debugging aid, not an API.

If you just want to specify the path to qemu, then a better mechanism (IMO) would be to simply put the directory for the binaries at the front of the PATH before you invoke limactl. This would leave the QEMU_SYSTEM_* variables available to the user to still pass additional arguments for debugging.

@bigguyong
Copy link
Author

~/.lima/colima/lima.yaml

xxxx@c0496 ~ % cat /.lima/colima/lima.yaml
vmType: qemu
arch: aarch64
images:
- location: https://github.com/abiosoft/alpine-lima/releases/download/colima-v0.5.5/alpine-lima-clm-3.18.0-aarch64.iso
arch: aarch64
digest: sha512:84c93e8aaa09446618bf87daa993e260da69b50e95670aed5df6671b2cff9464810752cbf70f6ee5ddf9d3e1c91d98104b3c573cc024c5f0687ad3f4d2e93ebc
- location: https://github.com/abiosoft/alpine-lima/releases/download/colima-v0.5.5/alpine-lima-clm-3.18.0-x86_64.iso
arch: x86_64
digest: sha512:f761b807fe9ba345968df72c07f8c5abcae0c4a44976fe5595c0ff748ef693841221a70e663986c700b027cea32b7cac24d5490d4c721593c39f2b8840c362a2
cpus: 2
memory: 2GiB
disk: 60GiB
mounts:
- location: "
"
writable: true
- location: /tmp/colima
writable: true
mountType: reverse-sshfs
containerd:
system: false
user: false
dns:
- 192.168.107.1
firmware:
legacyBIOS: false
hostResolver:
enabled: false
hosts:
host.docker.internal: host.lima.internal
portForwards:
- guestPortRange:
- 0
- 0
guestSocket: /var/run/docker.sock
hostPortRange:
- 0
- 0
hostSocket: /Users/AAAAAA BB/.colima/default/docker.sock
proto: tcp
- guestPortRange:
- 0
- 0
guestSocket: /var/run/docker.sock
hostPortRange:
- 0
- 0
hostSocket: /Users/AAAAAA BB/.colima/docker.sock
proto: tcp
- guestIPMustBeZero: true
guestIP: 0.0.0.0
guestPortRange:
- 1
- 65535
hostIP: 0.0.0.0
hostPortRange:
- 1
- 65535
proto: tcp
- guestIP: 127.0.0.1
guestPortRange:
- 1
- 65535
hostIP: 127.0.0.1
hostPortRange:
- 1
- 65535
proto: tcp
provision:
- mode: system
script: sysctl -w fs.inotify.max_user_watches=1048576
- mode: user
script: sudo usermod -aG docker $USER
- mode: system
script: grep -q "^rc_env_allow" /etc/rc.conf || echo 'rc_env_allow="*"' >> /etc/rc.conf
- mode: system
script: |
#!/usr/bin/env sh
# set -x

    FILE=/etc/network/interfaces
    BACKUP="$FILE.bak"

    # this only happens one in the beginning
    if [ ! -f "$BACKUP" ]; then
        cp "$FILE" "$BACKUP"
    fi

    # reset the network file
    cp "$BACKUP" "$FILE"

    validate_ip() {
        # Add basic IP address validation, make sure it is in 192.168.106.0/24 subnet
        echo $1 | grep -q -E "^192.168.106.(([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$"
        return $?
    }

    update_iface_to_static() {
        # update the interface from dhcp to static ip address
        local IFACE=$1
        local IP_ADDRESS=$2
        local FILE=$3

    sed -i "/iface $IFACE inet dhcp/d" $FILE
    sed -i "/^auto $IFACE/a iface $IFACE inet static\n  address $IP_ADDRESS\n  netmask 255.255.255.0\n  gateway 192.168.106.1\n" $FILE
    }

    set_iface_to_dhcp() {
        # update interface to using dhcp
        local IFACE=$1

        cat >>$FILE <<EOF
    auto $IFACE
    iface $IFACE inet dhcp

    EOF
    }

    set_iface_to_static() {
        local IFACE=$1
        local IP_ADDRESS=$2

    # default subnet is 192.168.106.0/24
    # default gateway is 192.168.106.1

        cat >>$FILE <<EOF
    auto $IFACE
    iface $IFACE inet static
      address $IP_ADDRESS
      netmask 255.255.255.0
      gateway 192.168.106.1

    EOF
    }

    written() (
        grep -q "^auto ${1}" "${FILE}"
    )

    vmnet() (
        IFACE="col0"
        if written $IFACE; then
            if [ "$IFACE" == "col0" ]; then
                update_iface_to_static $IFACE $COLIMA_IP $FILE
            fi
            exit 0;
        fi

        if [ "$IFACE" == "col0" ]; then
            if [ -n "$COLIMA_IP" ]; then
                if validate_ip "$COLIMA_IP"; then
                    set_iface_to_static $IFACE $COLIMA_IP
                else
                    set_iface_to_dhcp
                fi
            else
                set_iface_to_dhcp
            fi
        else
            set_iface_to_dhcp
        fi
    )

    gvproxy() (
        IFACE=$(ifconfig -a | grep 'HWaddr 5A:94:EF:3C:99:E6' | awk -F' ' '{print $1}')

        if written $IFACE; then exit; fi

        cat >>$FILE <<EOF
    auto $IFACE
    iface $IFACE inet static
      address 192.168.107.2
      netmask 255.255.255.0
      gateway 192.168.107.1
      metric 200

    EOF
    )

    vmnet
    gvproxy
    service networking restart
- mode: system
  script: mkmntdirs && mount -a
- mode: system
  script: readlink /sbin/fstrim || fstrim -a

@watersb
Copy link
Contributor

watersb commented May 30, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants