Skip to content

Having Android emulator in PATH breaks colima qemu wrapper logic #316

@SergeyPoznyakAkvelon

Description

@SergeyPoznyakAkvelon

Describe the Issue

When you have Android SDK installed using Android Studio or other methods and you manually add the ~/Library/Android/sdk/emulator/ to PATH, colima fails to start with an error:

> msg="[hostagent] could not find firmware for \"/Users/sergey/.colima/_wrapper/bin/qemu-system-x86_64\" (hint: try setting `firmware.legacyBIOS` to `true`)" fields.level=fatal
> msg="host agent process has exited: exit status 1"
FATA[0429] error starting vm: error at 'creating and starting': exit status 1

Version

Colima Version:

colima version 0.4.2
git commit: f112f336d05926d62eb6134ee3d00f206560493b

Lima Version:

0.11.0

Qemu Version

What is the output of qemu-img --version

qemu-img version 2.12.0(gradle_1.3.0-beta4-75998-g9abce6f84a)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers

What is the output of /usr/local/bin/qemu-img --version

qemu-img version 7.0.0
Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers

Operating System

  • macOS Intel
  • macOS m1
  • Linux

To Reproduce

Steps to reproduce the behavior:

  1. Install Android Studio
  2. Install Android SDK from the Studio
  3. Add ~/Library/Android/sdk/emulator/ to PATH
  4. Try to install colima from homebrew and start it

Expected behavior

Expect colima to prefer the qemu version installed from homebrew.

Additional context

I stumbled on this when migrating from the nix package manager back to homebrew, because nix would take up too much space. After installing colima from homebrew I got this error and was stuck on it for a few hours. Couldn't find any similar issues, so creating this one.

I tracked down the issue when looking through the code referencing the _wrapper directory colima creates for qemu. When searching for the share directory it looks up qemu from path on this line:

qemu, err := exec.LookPath("qemu-img")

I'd be happy to help with this, but I'm not sure what's the best solution here. Maybe detecting somehow that colima is installed from homebrew and looking up qemu only from /usr/local/bin or something like that?

Workaround

Delete android sdk emulator dir from PATH

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