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

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

Closed
1 of 3 tasks
SergeyPoznyakAkvelon opened this issue Jun 3, 2022 · 8 comments
Closed
1 of 3 tasks

Comments

@SergeyPoznyakAkvelon
Copy link

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

@abiosoft
Copy link
Owner

abiosoft commented Jun 3, 2022

Does the android sdk emulator directory include all qemu binaries? Does it also include qemu-system-aarch64 and qemu-system-x86_64 ?

@SergeyPoznyakAkvelon
Copy link
Author

@abiosoft It includes:

bin64
darwin-aarch64-replace.sh
emulator
emulator-check
emulator64-crash-service
lib
lib64
mksdcard
package.xml
perfetto-protozero-protoc-plugin
qemu
qemu-img
qsn
resources
source.properties

@abiosoft
Copy link
Owner

abiosoft commented Jun 3, 2022

because nix would take up too much space

If this is the only concern, there is nix-collect-garbage command (provided you are not aware).

@SergeyPoznyakAkvelon
Copy link
Author

If this is the only concern, there is nix-collect-garbage command (provided you are not aware).

Yes, I know about it. But most of the packages that take up space are required for nix to run and a lot of them are copies of system utilities already available in macos. It would take 40gb of space for me and I kept running out of disk space on a daily basis.

@abiosoft
Copy link
Owner

abiosoft commented Jun 3, 2022

@abiosoft It includes:

bin64
darwin-aarch64-replace.sh
emulator
emulator-check
emulator64-crash-service
lib
lib64
mksdcard
package.xml
perfetto-protozero-protoc-plugin
qemu
qemu-img
qsn
resources
source.properties

It becomes easier, we can easily check for qemu-system-{os_arch} instead.

@abiosoft
Copy link
Owner

abiosoft commented Jun 3, 2022

A fix is underway, you can test with brew install --head colima once the build finishes and the PR gets merged.

@abiosoft
Copy link
Owner

abiosoft commented Jun 3, 2022

Kindly confirm if this is fixed

@RobinCsl
Copy link

RobinCsl commented Jun 9, 2022

I ran into a similar issue, and running brew remove colima; brew install --head colima did the trick.
Thank you @abiosoft!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants