Skip to content

brew services start colima not working as expected #1265

Description

@t18n

Description

brew services start colima not working as expected. When I run the command and restart the computer, the service does start, but colima doesn't.

Version

❯ colima version && limactl --version && qemu-img --version
colima version 0.8.1
git commit: 96598cc
WARN[0000] found ~/.colima, ignoring $XDG_CONFIG_HOME...
WARN[0000] delete ~/.colima to use $XDG_CONFIG_HOME as config directory
WARN[0000] or run mv ~/.colima "/Users/tt/.config/colima"

runtime: docker
arch: aarch64

limactl version 1.0.4
qemu-img version 9.2.0
Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers

Operating System

  • macOS Intel <= 13 (Ventura)
  • macOS Intel >= 14 (Sonoma)
  • Apple Silicon <= 13 (Ventura)
  • Apple Silicon >= 14 (Sonoma)
  • Linux

Output of colima status

WARN[0000] found ~/.colima, ignoring $XDG_CONFIG_HOME...
WARN[0000] delete ~/.colima to use $XDG_CONFIG_HOME as config directory
WARN[0000] or run `mv ~/.colima "/Users/tt/.config/colima"`
WARN[0000] found ~/.colima, ignoring $XDG_CONFIG_HOME...
WARN[0000] delete ~/.colima to use $XDG_CONFIG_HOME as config directory
WARN[0000] or run `mv ~/.colima "/Users/tt/.config/colima"`
INFO[0000] colima is running using macOS Virtualization.Framework
INFO[0000] arch: aarch64
INFO[0000] runtime: docker
INFO[0000] mountType: sshfs
INFO[0000] socket: unix:///Users/tt/.colima/default/docker.sock

Reproduction Steps

  1. Install colima, docker with homebrew
  2. Run colima start and it works fine
  3. Run brew services start colima and restart the computer

Expected behaviour

brew services start colima should start Docker service hence start its containers automatically

Additional context

Result of cat /opt/homebrew/var/log/colima.log

time="2025-02-04T00:28:12+01:00" level=info msg="provisioning ..." context=docker
colima
Successfully created context "colima"
colima
Current context is now "colima"
time="2025-02-04T00:28:13+01:00" level=info msg="starting ..." context=docker
time="2025-02-04T00:28:14+01:00" level=info msg=done
time="2025-02-04T00:28:14+01:00" level=info msg="keeping Colima in the foreground, press ctrl+c to exit..."
time="2025-02-04T00:33:43+01:00" level=info msg="interrupted by: terminated"
time="2025-02-04T00:33:43+01:00" level=info msg="stopping colima"
time="2025-02-04T00:33:43+01:00" level=info msg="stopping ..." context=docker
Stopping 'docker.service', but its triggering units are still active:
docker.socket
colima
time="2025-02-04T00:33:43+01:00" level=info msg="stopping ..." context=vm
time="2025-02-04T00:33:43+01:00" level=info msg="Sending SIGINT to hostagent process 1940"
time="2025-02-04T00:33:43+01:00" level=info msg="Waiting for the host agent and the driver processes to shut down"
time="2025-02-04T00:33:43+01:00" level=info msg="[hostagent] Received SIGINT, shutting down the host agent"
time="2025-02-04T00:33:43+01:00" level=info msg="[hostagent] Shutting down the host agent"
time="2025-02-04T00:33:43+01:00" level=info msg="[hostagent] Stopping forwarding \"/var/run/docker.sock\" (guest) to \"/Users/tt/.colima/default/docker.sock\" (host)"
time="2025-02-04T00:33:43+01:00" level=info msg="[hostagent] Stopping forwarding \"/var/run/docker.sock\" (guest) to \"/Users/tt/.colima/docker.sock\" (host)"
time="2025-02-04T00:33:43+01:00" level=info msg="[hostagent] Unmounting \"/Users/tt\""
time="2025-02-04T00:33:43+01:00" level=info msg="[hostagent] Unmounting \"/tmp/colima\""
time="2025-02-04T00:33:43+01:00" level=info msg="[hostagent] Shutting down VZ"
time="2025-02-04T00:33:44+01:00" level=info msg="[hostagent] [VZ] - vm state change: stopped"
time="2025-02-04T00:33:45+01:00" level=info msg=done
time="2025-02-04T00:56:51+01:00" level=info msg="starting colima"
time="2025-02-04T00:56:51+01:00" level=info msg="runtime: docker"
time="2025-02-04T00:56:53+01:00" level=info msg="starting ..." context=vm
time="2025-02-04T00:56:53+01:00" level=info msg="Creating an instance \"colima\" from template://default (Not from template://colima)"
time="2025-02-04T00:56:53+01:00" level=warning msg="This form is deprecated. Use `limactl create --name=colima template://default` instead"
time="2025-02-04T00:56:53+01:00" level=info msg="Using the existing instance \"colima\""
time="2025-02-04T00:56:53+01:00" level=info msg="Starting the instance \"colima\" with VM driver \"vz\""
time="2025-02-04T00:56:54+01:00" level=info msg="[hostagent] hostagent socket created at /Users/tt/.colima/_lima/colima/ha.sock"
time="2025-02-04T00:56:54+01:00" level=info msg="[hostagent] Starting VZ (hint: to watch the boot progress, see \"/Users/tt/.colima/_lima/colima/serial*.log\")"
time="2025-02-04T00:56:54+01:00" level=info msg="SSH Local Port: 49194"
time="2025-02-04T00:56:54+01:00" level=info msg="[hostagent] Waiting for the essential requirement 1 of 4: \"ssh\""
time="2025-02-04T00:56:54+01:00" level=info msg="[hostagent] [VZ] - vm state change: running"
time="2025-02-04T00:57:00+01:00" level=info msg="[hostagent] Received SIGINT, shutting down the host agent"
time="2025-02-04T00:57:00+01:00" level=info msg="[hostagent] Shutting down the host agent"
time="2025-02-04T00:57:00+01:00" level=warning msg="[hostagent] failed to exit SSH master" error="failed to execute `ssh -O exit -p 49194 127.0.0.1`, out=\"Control socket connect(/Users/tt/.colima/_lima/colima/ssh.sock): No such file or directory\\r\\n\": exit status 255"
time="2025-02-04T00:57:00+01:00" level=info msg="[hostagent] Shutting down VZ"
time="2025-02-04T00:57:01+01:00" level=info msg="[hostagent] [VZ] - vm state change: stopped"
time="2025-02-04T00:57:01+01:00" level=fatal msg="exiting, status={Running:false Degraded:false Exiting:true Errors:[] SSHLocalPort:0} (hint: see \"/Users/tt/.colima/_lima/colima/ha.stderr.log\")"
time="2025-02-04T00:57:01+01:00" level=fatal msg="error starting vm: error at 'starting': exit status 1"
time="2025-02-04T01:01:16+01:00" level=info msg="starting colima"
time="2025-02-04T01:01:16+01:00" level=info msg="runtime: docker"
time="2025-02-04T01:01:17+01:00" level=info msg="creating and starting ..." context=vm
time="2025-02-04T01:01:17+01:00" level=info msg="Terminal is not available, proceeding without opening an editor"
time="2025-02-04T01:01:18+01:00" level=info msg="Starting the instance \"colima\" with VM driver \"vz\""
time="2025-02-04T01:01:18+01:00" level=info msg="Attempting to download the image" arch=aarch64 digest= location=/Users/tt/Library/Caches/colima/caches/a24f6ef16e82e4b6293939e225f66e0d31056ee4b5c75f531bb58847c7741810.raw
time="2025-02-04T01:01:18+01:00" level=info msg="Downloaded the image from \"/Users/tt/Library/Caches/colima/caches/a24f6ef16e82e4b6293939e225f66e0d31056ee4b5c75f531bb58847c7741810.raw\""
time="2025-02-04T01:01:18+01:00" level=info msg="Converting \"/Users/tt/.colima/_lima/colima/basedisk\" (raw) to a raw disk \"/Users/tt/.colima/_lima/colima/diffdisk\""
time="2025-02-04T01:01:18+01:00" level=info msg="Expanding to 100GiB"
time="2025-02-04T01:01:19+01:00" level=info msg="[hostagent] hostagent socket created at /Users/tt/.colima/_lima/colima/ha.sock"
time="2025-02-04T01:01:19+01:00" level=info msg="[hostagent] Starting VZ (hint: to watch the boot progress, see \"/Users/tt/.colima/_lima/colima/serial*.log\")"
time="2025-02-04T01:01:19+01:00" level=info msg="SSH Local Port: 49189"
time="2025-02-04T01:01:19+01:00" level=info msg="[hostagent] Waiting for the essential requirement 1 of 4: \"ssh\""
time="2025-02-04T01:01:19+01:00" level=info msg="[hostagent] [VZ] - vm state change: running"
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] Waiting for the essential requirement 1 of 4: \"ssh\""
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] The essential requirement 1 of 4 is satisfied"
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] Waiting for the essential requirement 2 of 4: \"user session is ready for ssh\""
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] The essential requirement 2 of 4 is satisfied"
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] Waiting for the essential requirement 3 of 4: \"sshfs binary to be installed\""
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] The essential requirement 3 of 4 is satisfied"
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] Waiting for the essential requirement 4 of 4: \"fuse to \\\"allow_other\\\" as user\""
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] The essential requirement 4 of 4 is satisfied"
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] Mounting \"/Users/tt\" on \"/Users/tt\""
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] Mounting \"/tmp/colima\" on \"/tmp/colima\""
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] Waiting for the guest agent to be running"
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] Forwarding \"/var/run/docker.sock\" (guest) to \"/Users/tt/.colima/default/docker.sock\" (host)"
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] Forwarding \"/var/run/docker.sock\" (guest) to \"/Users/tt/.colima/docker.sock\" (host)"
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] Guest agent is running"
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] Waiting for the final requirement 1 of 1: \"boot scripts must have finished\""
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] Not forwarding TCP 127.0.0.54:53"
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] Not forwarding TCP 127.0.0.53:53"
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] Not forwarding TCP [::]:22"
time="2025-02-04T01:01:29+01:00" level=info msg="[hostagent] The final requirement 1 of 1 is satisfied"
time="2025-02-04T01:01:29+01:00" level=info msg="READY. Run `limactl shell colima` to open the shell."
installing: 386 OK
installing: amd64 OK
{
  "supported": [
    "linux/arm64",
    "linux/amd64",
    "linux/386"
  ],
  "emulators": [
    "python3.12",
    "qemu-i386",
    "qemu-x86_64"
  ]
}
time="2025-02-04T01:01:29+01:00" level=info msg="provisioning ..." context=docker
colima
Successfully created context "colima"
colima
Current context is now "colima"
time="2025-02-04T01:01:30+01:00" level=info msg="starting ..." context=docker
time="2025-02-04T01:01:31+01:00" level=info msg=done
time="2025-02-04T01:01:31+01:00" level=info msg="keeping Colima in the foreground, press ctrl+c to exit..."

Screenshot

Image

Activity

  1. lmhajdukd commented on Feb 5, 2025

    @lmhajdukd

    The same experience, have to start it manually. On top of that have to start as root to be able to build any image.

  2. AviFS commented on Feb 13, 2025

    @AviFS

    Same issue, also on Apple Silicon >= 14. For me, colima start also work, but brew services start colima does not. Here is the output:

    $ brew services start colima
    Bootstrap failed: 5: Input/output error
    Try re-running the command as root for richer errors.
    Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/avi/Library/LaunchAgents/homebrew.mxcl.colima.plist` exited with 5.

    If it helps, here are the logs from launchtl which brew services is using under the hood.

    launchd: [gui/501 [100020]:] Enabling service homebrew.mxcl.colima
    launchd: [gui/501/homebrew.mxcl.colima:] internal event: WILL_SPAWN, code = 0
    launchd: [gui/501/homebrew.mxcl.colima:] service state: spawn scheduled
    launchd: [gui/501/homebrew.mxcl.colima:] service state: spawning
    launchd: [gui/501/homebrew.mxcl.colima:] launching: speculative
    launchd: [gui/501/homebrew.mxcl.colima [52184]:] xpcproxy spawned with pid 52184
    launchd: [gui/501/homebrew.mxcl.colima [52184]:] internal event: SPAWNED, code = 0
    launchd: [gui/501/homebrew.mxcl.colima [52184]:] service state: xpcproxy
    launchd: [gui/501/homebrew.mxcl.colima [52184]:] internal event: SOURCE_ATTACH, code = 0
    launchd: [gui/501/homebrew.mxcl.colima [52184]:] service state: running
    launchd: [gui/501/homebrew.mxcl.colima [52184]:] internal event: INIT, code = 0
    launchd: [gui/501/homebrew.mxcl.colima [52184]:] Successfully spawned colima[52184] because speculative
    launchd: [pid/52184 [colima]:] uncorking exec source upfront
    launchd: [pid/52184 [colima]:] created
    launchd: [gui/501/homebrew.mxcl.colima [52184]:] exited due to exit(1), ran for 3089ms
    launchd: [gui/501/homebrew.mxcl.colima [52184]:] service state: exited
    launchd: [gui/501/homebrew.mxcl.colima [52184]:] internal event: EXITED, code = 0
    launchd: [gui/501 [100020]:] service inactive: homebrew.mxcl.colima
    launchd: [gui/501/homebrew.mxcl.colima [52184]:] service state: not running
    launchd: [pid/52184 [colima]:] shutting down
    launchd: [pid/52184 [colima]:] cleaning up
    
  3. SoulPancake commented on Feb 14, 2025

    @SoulPancake

    Works fine for Apple Silicom >= 14 for me :/

  4. roshbhatia commented on Feb 21, 2025

    @roshbhatia

    I've been running into this as well, but found a solution to avoid having to manually mess with the .colima directory after restarts. I think this ~may be due to the homebrew service not knowing what XDG_CONFIG_HOME is (if it's set in your shell's config file) and COLIMA_HOME and then creating the .colima directory at the default path.

    You can edit the /opt/homebrew/Cellar/colima/0.8.1/homebrew.colima.service definition (which seems like is used to generate the plist file used during startup) and edit the environment option to look something like the following (I have my XDG_CONFIG_HOME set in my shell's config file):

    Environment="PATH=/opt/homebrew/bin:/opt/homebrew/sbin:/usr/bin:/bin:/usr/sbin:/sbin"
    Environment="XDG_CONFIG_HOME=~/.config"
    Environment="COLIMA_HOME=~/.config/colima/.colima"
    

    After editing it, and deleting the ~/.colima directory, then restarting the service via brew, seems like it's working fine with me, even after restarts.

    ❯ colima status                                              
    WARN[0000] found ~/.colima, ignoring $XDG_CONFIG_HOME... 
    WARN[0000] delete ~/.colima to use $XDG_CONFIG_HOME as config directory 
    WARN[0000] or run `mv ~/.colima "/Users/rbha27/.config/colima"` 
    FATA[0000] error retrieving current runtime: empty value 
    ~ on 🌩️ (us-west-2)  
    ❯ rm -rf ~/.colima 
    ~ on 🌩️ (us-west-2)  
    ❯ brew services restart colima
    Stopping `colima`... (might take a while)
    ==> Successfully stopped `colima` (label: homebrew.mxcl.colima)
    ==> Successfully started `colima` (label: homebrew.mxcl.colima)
    ~ on 🌩️ (us-west-2)  
    ❯ colima status
    INFO[0000] colima is running using macOS Virtualization.Framework 
    INFO[0000] arch: aarch64                                
    INFO[0000] runtime: docker                              
    INFO[0000] mountType: sshfs                             
    INFO[0000] socket: unix:///Users/rbha27/.config/colima/default/docker.sock 
    

    After doing this, unfortunately the colima docker context doesn't show up when running docker context ls, but symlinking the colima sock file to the default docker location seems fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions