Not able to run VM on MacOS
Ranjandas opened this issue ยท 7 comments
Built an image based on alpine successfully. But when I tried to run the VM it results in the following error.
$ sudo slim run micro1 alpine3.8-simple -p hyperkit
Password:
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (37620)
Sharing some information that might help in identifying the issue below.
$ node --version
v15.7.0
$ hyperkit -v
hyperkit: v0.20200224-44-gb54460
Homepage: https://github.com/docker/hyperkit
License: BS
$ git rev-parse HEAD
73eb95d02bc09075e814b31e992c7f36e19c4c1c
I believe the issue was related to a change in node > v10.
I just pushed a fix in 2951904, so if you pull the latest changes, it should work now.
You may need to also delete the partially created vm form the command you ran and was failing:
slim delete vm micro1
Note: You don't need to run the commands with sudo
. Slim will internally use sudo
when needed and show you a prompt.
@Ranjandas did you get a chance to try this Slim patch โ๏ธ?
@ssmirr my sincere apologies. Somehow I missed the update on this issue. I pulled the latest master branch and it seems to be working fine. ๐ I am able to launch vms.
One thing I noted though is, as soon as I stop the slim VM, it just disappears from the slim vms
list. Is this because of hyperkit
driver?
@Ranjandas Hyperkit will essentially run a VM in memory as a process, so when it stops, it's gone, say unlike how the virtualbox driver would work.
@chrisparnin that's interesting. Is it specifically with the way Slim operates? I am wondering how tools like multipass
are able to persist hyperkit VM's.
https://github.com/ottomatica/slim/blob/master/lib/providers/hyperkit.js#L68
Most likely you're just seeing the effect of storing items to a disk, e.g. how Docker for Mac currently does it. To make VMs more "persistant", this would have to be modified to also enable mount a disk by providing a virtio-block virtual device and provide a disk image: -s 3,virtio-blk,/disks/mydisk.img
, and modifying the corresponding init files in the image build step to mount the device.
const cmdline = `"modules=virtio_net console=ttyS0"`;
// we need to run hyperkit with sudo, since we can't create the virtio-net
// interface as a normal user
const cmd = `hyperkit \
-m ${mem} -c ${cpus} \
-s 0:0,hostbridge -s 31,lpc \
-s 2:0,virtio-net -l com1,stdio \
${syncs.join(' ')} \
-F ${path.join(baseDir, 'hyperkit.pid')} \
-U ${uuid} \
-f kexec,${kernelPath},${initrdPath},${cmdline} \
2>&1 >> ${path.join(baseDir, 'hyperkit.log')} &
`;
@chrisparnin thanks for the info. I think we can close this issue now.