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

Enable support for image launching on macOS and Windows #1260

Open
moondev opened this issue Dec 19, 2019 · 20 comments
Open

Enable support for image launching on macOS and Windows #1260

moondev opened this issue Dec 19, 2019 · 20 comments
Labels
enhancement high high importance

Comments

@moondev
Copy link

moondev commented Dec 19, 2019

Is it possible to directly launch a qcow2/img cloud-init enabled image on macOS? This works great on Linux. Is this due to differences between qemu and hyperkit image format?

Test image used: https://download.fedoraproject.org/pub/fedora/linux/releases/31/Cloud/x86_64/images/Fedora-Cloud-Base-31-1.9.x86_64.qcow2

works on linux

multipass launch -n fedora https://download.fedoraproject.org/pub/fedora/linux/releases/31/Cloud/x86_64/images/Fedora-Cloud-Base-31-1.9.x86_64.qcow2

fails on macos

returns "http and file based images are not supported"
@Saviq
Copy link
Collaborator

Saviq commented Dec 19, 2019

Hi @moondev yeah, we currently have to pass kernel + initrd directly to hyperkit (no bootloader), so we can't really support images that we can't be sure will work with the kernels we use…

We're working on it, though!

@Saviq Saviq added enhancement high high importance labels Dec 19, 2019
@Saviq Saviq changed the title Launching qcow2 image on macOS: launch failed: "http and file based images are not supported" Enable support for image launching on macOS Dec 19, 2019
@moondev
Copy link
Author

moondev commented Dec 20, 2019

@Saviq Thanks for the details! Very interesting as well as clever way to leverage hyperkit for cloud-init.

Looking forward to a future update to support this. I suppose using an alternative hypervisor could be an option but then you would need to install it first which is no fun. Congrats on the 1.0.0 launch and keep up the great work!

@alexellis
Copy link

Would qemu work as an alternative with its hardware acceleration?

@Saviq
Copy link
Collaborator

Saviq commented Jan 7, 2020

Hi @alexellis we'll be evaluating qemu for that reason (and more) in the near future.

@alexellis
Copy link

How are you planning on dealing with networking? I had issues getting any examples for qemu on MacOS to work for port mapping.

@jasonmccallister
Copy link
Contributor

jasonmccallister commented Feb 28, 2020

Ideally I would love to be able to build a custom pre-built Ubuntu image and download them from the launch command. We have a hefty cloud-config setup right now that would reduce our setup by just downloading an image instead.

(I know this is on the roadmap, just excited to see the progress being made)

@Saviq Saviq changed the title Enable support for image launching on macOS Enable support for image launching on macOS and Windows May 28, 2020
@Saviq
Copy link
Collaborator

Saviq commented Oct 25, 2021

Since this runs on QEMU and not hyperkit, any chance we could get image launching support for the Apple Silicon release?
#1260

Originally posted by @m-bers in #1857 (comment)

@m-bers, all, it would be near impossible for us to ensure the user experience with custom images. There are certain requirements of the image to be compatible with Multipass. Those of you requesting it would probably be fine with it, but others may be surprised and frustrated that "random" images downloaded from the Internet don't work.

Apart from --cloud-init to bootstrap, we've now launched support for workflows, which can solve some of your use cases. Hopefully snapshots (#208) would solve even more.

@madalinignisca
Copy link

Wouldn't it be easy to add a parameter flag to enable "experiment" mode and allow it in Windows/MacOS, and we users would be responsible if the image would work or not? I don't understand at all the reason to forbid Windows and MacOS users to have this feature even if they explicitly would accept it as experimental and unsupported.

To give an example: This blocks me right now to do a large demo of something that works really nice on my personal laptop with Ubuntu as main host, but can't run it on my work laptop with Windows, and my company forbids to use another device for the demo purely of some company policies.
Are you considering that with this kind of things you are blocking us developers and engineers to convince our companies for (more) adoption of Ubuntu and Canonical products and services?

@z0mbix
Copy link

z0mbix commented Mar 17, 2022

Hi, do you have any update on this problem?

@mkhon
Copy link

mkhon commented Jun 10, 2022

I succeeded substituting Ubuntu 20 disk image with CentOS 7 cloud image on macOS:

  1. create Ubuntu 20 multipass VM, then stop it
multipass launch -n <name>
multipass stop <name>
  1. download CentOS cloud image (I used this one: https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-2009.qcow2c)

  2. convert the image and store into instance vault:

"/Library/Application Support/com.canonical.multipass/bin/qemu-img-hyperkit" convert -O qcow2 CentOS-7-x86_64-GenericCloud-2009.qcow2c "/var/root/Library/Application Support/multipassd/vault/instances/<name>/CentOS-7-x86_64-GenericCloud-2009.qcow2"
  1. move out existing disk image and make a symlink:
mv ubuntu-20.04-server-cloudimg-amd64.img ubuntu-20.04-server-cloudimg-amd64.img~
ln -s CentOS-7-x86_64-GenericCloud-2009.qcow2 ubuntu-20.04-server-cloudimg-amd64.img

The contents of the instance vault directory should look like:

-rw-r--r--  1 root  wheel  931856384 Jun 10 13:31 CentOS-7-x86_64-GenericCloud-2009.qcow2
-rw-r--r--  1 root  wheel      53248 Jun 10 13:15 cloud-init-config.iso
-rw-r--r--  1 root  wheel         12 Jun 10 13:24 pty
-rw-r--r--  1 root  wheel   27621125 Jun  8 15:50 ubuntu-20.04-server-cloudimg-amd64-initrd-generic
-rw-r--r--  1 root  wheel   13668608 Jun  8 15:50 ubuntu-20.04-server-cloudimg-amd64-vmlinuz-generic
lrwxr-xr-x  1 root  wheel         39 Jun 10 13:23 ubuntu-20.04-server-cloudimg-amd64.img -> CentOS-7-x86_64-GenericCloud-2009.qcow2
  1. start the instance
multipass start <name>

The instance uses Ubuntu 20 kernel and initrd which should be suitable for almost any recent Linux cloud image

Additionally, you may need to copy out /lib/modules from Ubuntu image (e.g. boot Ubuntu instance, copy /lib/modules out, then boot your image, copy /lib/modules back) so that kernel modules in the image match the kernel used by multipass.

Make sure you umount /lib/modules (or /usr/lib/modules) before copying it back because it is mounted (I guess by initird) as tmpfs (copymods):

# umount -l /usr/lib/modules
# systemctl restart systemd-udevd

@townsend2010
Copy link
Contributor

Hey @mkhon,

That's quite enterprising to say the least:wink:

@goofrider
Copy link

Now that Mac OS version of Multipass is switching to Qemu, would the team consider enabling instance creation from custom URLs/ISOs?

@BurlyLuo
Copy link

+1

@BurlyLuo
Copy link

Do we have a plan to support CentOS?

@atomlab
Copy link

atomlab commented Oct 24, 2023

Hello! Where do I need to place the downloaded Debian Cloud image to run it on MacOS with M1 processor?
https://cloud.debian.org/images/cloud/bookworm/daily/latest/debian-12-genericcloud-arm64-daily.qcow2

@underrun
Copy link

underrun commented Mar 14, 2024

Since this runs on QEMU and not hyperkit, any chance we could get image launching support for the Apple Silicon release?
#1260

Originally posted by @m-bers in #1857 (comment)

@m-bers, all, it would be near impossible for us to ensure the user experience with custom images. There are certain requirements of the image to be compatible with Multipass. Those of you requesting it would probably be fine with it, but others may be surprised and frustrated that "random" images downloaded from the Internet don't work.

@Saviq I don't think this argument holds up while multipass supports launching images from files on linux. If I download some random image from the internet and try to start it on linux, canonical has exactly as much control over the user experience in that situation as it does on macos or windows.

The users of multipass on mac/win are likely mostly developers. The users that even want to try building a qcow2 image out of an iso for some non ubuntu cloud image probably know what they are doing enough to be aware of the pitfalls and debug them. And it's pretty likely those users are trying to use a file based image in multipass to make their lives easier via the really nice ux multipass provides.

In other words, by not supporting file based images on mac/win you are ensuring users will have a much worse experience working with their custom images.

Please address this issue.

@OhMyMndy
Copy link

Since I have been following this thread for over 2 years, I found an alternative solution to run other distro's in the same fashion as Multipass does, with Lima.

After installing Lima, you can create a Debian VM as such:
limactl create --name debian-12 https://raw.githubusercontent.com/lima-vm/lima/master/examples/debian-12.yaml
or use https://github.com/lima-vm/lima/blob/master/examples/ubuntu-lts.yaml to run Ubuntu.

Start your VM with limactl start debian-12.

And then shell into your vm with limactl shell debian-12.

@canonical, if I violate the terms of service, please just remove my comment.

@madalinignisca
Copy link

Thank you!

Since I have been following this thread for over 2 years, I found an alternative solution to run other distro's in the same fashion as Multipass does, with Lima.

After installing Lima, you can create a Debian VM as such:

limactl create --name debian-12 https://raw.githubusercontent.com/lima-vm/lima/master/examples/debian-12.yaml

or use https://github.com/lima-vm/lima/blob/master/examples/ubuntu-lts.yaml to run Ubuntu.

Start your VM with limactl start debian-12.

And then shell into your vm with limactl shell debian-12.

@canonical, if I violate the terms of service, please just remove my comment.

@emakarov
Copy link

emakarov commented Aug 20, 2024

currently i was exploring the flow of creating a packer image from our production docker image and then launch it with multipass on Mac. and also stucked with the same limitation. Not sure if any other way to do this exists. While workaround exists, it looks like a very strange limitation, especially if workaround really works (in progress of checking this)
In regards to things like Lima, @OhMyMndy by any chance if you know, does it work with rosetta mode on Mac M1/M2?

@Fred78290
Copy link

@townsend2010
@Saviq

Bump up the issue.
After reading code, no reason that multipass limit custom image on linux only because qemu is used on macos.

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

No branches or pull requests