-
Notifications
You must be signed in to change notification settings - Fork 650
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
changing number of CPUs for an instance #1158
Comments
Hi @VasiliyS, I'm afraid it's not, not easily at the moment. #756 designs the experience, but it's not yet implemented. Depending on platform, you could just edit the VM in the hypervisor (Hyper-V, VirtualBox), or stop Multipass and edit its instance database. Let us know what your environment is and we can guide you there :) |
@Saviq - Thank you. I'm on a Mac. Where can I find the instance database? |
@VasiliyS here are the steps: # stop multipassd
sudo launchctl unload /Library/LaunchDaemons/com.canonical.multipassd.plist
# edit /var/root/Library/Application Support/multipassd/multipassd-vm-instances.json
# you'll need sudo for that
# start multipassd again
sudo launchctl load /Library/LaunchDaemons/com.canonical.multipassd.plist The format should be quite easy to grok: {
"primary": {
"deleted": false,
"disk_space": "5368709120",
"mac_addr": "52:54:00:5c:f4:14",
"mem_size": "1073741824",
"metadata": {
},
"mounts": [
],
"num_cores": 1,
"ssh_username": "ubuntu",
"state": 0
}
} You want to edit |
@Saviq - Just tried it. The instance doesn't start - the cli times out ("timed out waiting for response"). |
@VasiliyS hmm can you look in |
@Saviq - I was able to create a new instance with 2 cpus, worked fine. I'm attaching 2 files with excerpts from the log. One where I've edited the cpu key to 2 and the instance doesn't start. The second one where I've changed the setting back to 1 cpu and it works. |
@Saviq - Update! |
Hi @VasiliyS, It looks like you are hitting #1122 when it's using 2 cpu's. The next version of Multipass has a fix for that. We have a release candidate for 0.9 up and can be found at https://github.com/CanonicalLtd/multipass/releases/download/v0.9.0-rc/multipass-0.9.0-rc.425+g37fa4305.mac-Darwin.pkg if you are interested. |
Hi @townsend2010 - thanks! The RC works just fine. |
@VasiliyS glad you got it going. Yes, we'll allow changing the number of CPUs in due course :) |
And memory please. |
Just to save some people some time, the below is for Ubuntu 19.10. sudo systemctl stop snap.multipass.multipassd.service |
@kramik1 these settings will be overwritten by previous values if snapcraft clean will be called |
I drive into same problem with RAM setting: it is just too low for my snap (only 2Gb) and I can't to build anything. |
Hi @denizzzka, There are some Snapcraft environment variables you can set to tweak memory, CPU count, and disk size. They are:
Hope this helps! |
Thanks @townsend2010 I tried this variables. Looks like it work inside of multipass VM, but VM itself still uses 2 cores and 2Gb of RAM (I checked this by |
Hey @denizzzka, Hmm, it's not supposed to work that way. 😕 I'll run some experiments in a while and if it's not working as it should, I'll ping the Snapcraft folks as they are the ones responsible for setting up these Multipass instances. |
Thanks! Please note that I did not change /var/snap/multipass/common/data/multipassd/multipassd-vm-instances.json settings file, because this makes no sense - it is automatically overwritten every time if snapcraft repository is cleaned |
Hey @denizzzka, It seems to be working as expected here. Here's what I did on my Ubuntu host machine:
I can clearly see the snapcraft instance used to build my snap is now using 4 cores and has 8GB allocated to it. Did you |
Offtopic:
It worked previously. The experiments are postponed indefinitely. |
Ok, I sucessfully reinstalled it. Works! Thanks @townsend2010 ! |
is there any effect way on windows?
multipass version
|
@acefei on Windows you can go to the Hyper-V manager (or |
@acefei you can do that with PowerShell's |
I try two solution to chage cpu, mem, disk space, learn from @kramik1
but key another solution |
Can anyone share some light on how to do this on MacOS (Catalina). Thanks |
Hi @santiagomoneta, one of the first comments (#1158 (comment)) has the steps. |
Seems like there should be a much easier way to do this from the multipass command line itself. |
If we modify the cpu or memory in Hyper-V Manager, the values in multipassd-vm-instances.json are not updated. Should we edit it to match? |
@mconner for Hyper-V and VirtualBox there's no need - they hold their own VM configuration. |
FWIW we have scheduled basic instance modification this cycle, we'll be starting on it soon. |
Niubility... |
After switching to VBox I can't see them anymore, nor in multipass list nor in VBox GUI, even after other commands of that tutorial. |
With multipass 1.8.1 on macOS Monterey the configuration file is
|
For mac OS this is what helped me: https://www.atpeaz.com/change-multipass-instance-memory-and-cpu-allocation-after-launch/ it was important to unload the multipass service first: sudo launchctl unload /Library/LaunchDaemons/com.canonical.multipassd.plist then modify
then restart sudo launchctl load /Library/LaunchDaemons/com.canonical.multipassd.plist otherwise it would always reset the changes I made. ( |
I can't find |
@jbosse it should be |
@Saviq Thank you. Mac really doesn't want you to see it in the finder or open it in VSCode. I could only make it open in nano. I had given up though and just made a new instance passing the --mem and --cpus options I wanted. |
|
@colemancda Try |
How would I do this on Ubuntu?
|
Thank you this solution works on Mac |
@Saviq Thank you for the update, it works great! |
@lulor the primary reason are blueprints, which declare the minimum memory and CPU cores meaningful for a particular use case. That said, we're reconsidering whether we should be that limiting, especially that if you make a mistake and give too much, there's currently no way back. |
@Saviq I see, thank you for the explanation |
I got it using another way. If you're using the VirtualBox driver, open the VirtualBox with the root account. There will be a new tab for Multipass with the instance already created. Just turn off the multipass instance, change the setting on the VirtualBox window and then turn on your multipass instance again. |
How would one do this on Windows? EDIT: The file is here, but it doesn't appear to have an effect:
Have I missed a step somewhere? Where can I find the logs? |
FYI you can launch VirtualBox with the root account on macOS by running the following command in Terminal:
|
@almontes1987, @daviewales, @sebmartin, |
Is it possible to change number of CPUs available to an existing instance? What about memory?
The text was updated successfully, but these errors were encountered: