gyf304 / vmcli

A set of utilities (vmcli + vmctl) for macOS Virtualization.framework
BSD 2-Clause "Simplified" License
824 stars 44 forks source link

VM Creation Step fails - 'VZErrorDomain error 1.' #17

Open ndom91 opened 3 years ago

ndom91 commented 3 years ago

Hey Everyone!

Im working with an M1 MBP 11.2.1

When trying to create an ubuntu vm (make build/vm/ubuntu), it gets through the first few steps, but then errors after the following command: spawn vmcli -k vmlinux --initrd=initrd -d disk.img --cmdline=console=hvc0 irqfixup

With the following output:

The operation couldn’t be completed. (VZErrorDomain error 1.)
send: spawn id exp6 not open
    while executing
"send -- "mkdir /mnt\r""
0+0 records in
0+0 records out
0 bytes transferred in 0.000014 secs (0 bytes/sec)

Screenshot for completeness:

Screenshot 2021-03-22 at 13 40 15

Any idea whats going on here? Arm incompatability? Or have you guys been able to run this on m1/arm64 already successfully?

gyf304 commented 3 years ago

It seems like vmcli is trying to boot an amd64 image on an arm64 machine. See https://github.com/gyf304/vmcli/blob/3432e225a8d275b0c78897c54646bd44d020159c/vmbuilders/ubuntu.sh#L24 Is one of your bash / make running in amd64 instead of arm64? maybe arch -arm64 ... will help.

ndom91 commented 3 years ago

Good eye! Prefixing it with arch -arm64 does get it to download the arm64 image of focal, but otherwise it errors in the exact same way unfortunately.

Do you know of anyone having successfully used this on a new M1 Mac?

gyf304 commented 3 years ago

vmcli is tested on M1 (but not on amd64, people have reported success, but I don't have an x86_64 Mac to test on). I personally use it for my M1 MacBook Air, so it's unlikely that this is an issue. I would suggest checking if vmcli is actually built for arm64, try file $(which vmcli)?

ndom91 commented 3 years ago

Okay thanks for confirming it runs on M1. Ill check that later on when I'm back home :+1:

ndom91 commented 3 years ago

Okay yeah so that was exactly the issue. I'd originally compiled it as an amd64. Recompiled with the arch -arm64 prefix and reran the make ubuntu commands.

However, while creating ti still errors out at the following point:

[    2.149322] xor: measuring software checksum speed
[    2.187529]    8regs     : 33871.000 MB/sec
[    2.227530]    32regs    : 28871.000 MB/sec
[    2.267533]    arm64_neon: 52263.000 MB/sec
[    2.267604] xor: using function: arm64_neon (52263.000 MB/sec)
[    2.268367] async_tx: api initialized (async)
done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... [    2.298034] Btrfs loaded, crc32c=crc32c-generic
Scanning for Btrfs filesystems
done.
No root device specified. Boot arguments must include a root= parameter.

BusyBox v1.30.1 (Ubuntu 1:1.30.1-4ubuntu6.3) built-in shell (ash)
Enter 'help' for a list of built-in commands.

(initramfs) [6nmkdir /mnt
(initramfs) [6nmount /dev/vda /mnt
[    2.399872] EXT4-fs (vda): mounted filesystem with ordered data mode. Opts: (null)
(initramfs) [6ncat << EOF > /mnt/etc/cloud/cloud.cfg.d/99_user.cfg
> users:
>   - name: root
>     lock_passwd: False
>     gecos: root
>     groups: [adm, audio, cdrom, dialout, dip, floppy, lxd, netdev, plugdev, su
do, video]
>     sudo: ["ALL=(ALL) NOPASSWD:ALL"]
>     shell: /bin/bash
>     ssh-authorized-keys:
>       - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRAbAylECwZpvAOEq69apq5J1OAAF3ka
TebhuqOps2O7WoJCCylqzu7rrPAun2tE3tsjeqwEdFMjSXYxBQowp5b0HiAT6w1Mtwy6PgjnQW5/VOsT
Ypg1dl3hw1ZiRYa1yUT+xfVba4+POEKXizpMjL8xlkW/ugnj2WL8O85QplqIGRRIsSAa4jBsZ3d1j88i
Sv0ZFpTXdTuf9EISNFBrIXq7f+JyhtGZqaj4m67CNoxPiadfyX7XrgVKra8/SaYa00RebI4V+tp6NDhJ
L6LZN8rX2O1a7O6NCUhZ1avYw4aY00kMyGqx2bR55ml7jN9k/edaKqHJInff8cPefa45ub ndo@ndo4
> EOF
(initramfs) [6nchroot /mnt
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
root@(none):/# sudo apt-get remove -y irqbalance
sudo: unable to resolve host (none): Name or service not known
Reading package lists... 0%Reading package lists... 0%Reading package lists... 0%Reading package lists... 28%Reading package lists... 28%Reading package lists... 43%Reading package lists... 43%Reading package lists... 43%Reading package lists... 43%Reading package lists... 43%Reading package lists... 43%Reading package lists... 61%Reading package lists... 61%Reading package lists... 74%Reading package lists... 74%Reading package lists... 74%Reading package lists... 74%Reading package lists... 76%Reading package lists... 76%Reading package lists... 86%Reading package lists... 86%Reading package lists... 95%Reading package lists... 95%Reading package lists... 95%Reading package lists... 95%Reading package lists... 97%Reading package lists... 97%Reading package lists... Done
Building dependency tree... 0%Building dependency tree... 0%Building dependency tree... 50%Building dependency tree... 50%Building dependency tree
Reading state information... 0%Reading state information... 0%Reading state information... Done
The following package was automatically installed and is no longer required:
  libnuma1
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
  irqbalance
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 162 kB disk space will be freed.
E: Can not write log (Is /dev/pts mounted?) - posix_openpt (19: No such device)
(Reading database ... (Reading database ... 5%(Reading database ... 10%(Reading database ... 15%(Reading database ... 20%(Reading database ... 25%(Reading database ... 30%(Reading database ... 35%(Reading database ... 40%(Reading database ... 45%(Reading database ... 50%(Reading database ... 55%(Reading database ... 60%(Reading database ... 65%(Reading database ... 70%(Reading database ... 75%(Reading database ... 80%(Reading database ... 85%(Reading database ... 90%(Reading database ... 95%(Reading database ... 100%(Reading database ... 63802 files and directories currently installed.)
Removing irqbalance (1.6.0-3ubuntu1) ...
invoke-rc.d: could not determine current runlevel
 * Stopping SMP IRQ Balancer: irqbalance       [80G start-stop-daemon: nothing in /proc - not mounted?
[74G[ OK ]
Processing triggers for man-db (2.9.1-1) ...
root@(none):/# exit
exit
(initramfs) [6numount /mnt
(initramfs) [6n0+0 records in
0+0 records out
0 bytes transferred in 0.000017 secs (0 bytes/sec)

The initial error seems to be that no root device is passed as a boot arg. Can I set that manually as a flag when running make /path/to/vm ?

gyf304 commented 3 years ago

Oh the logs you are seeing is normal. It’s not mounting the rootfs but using initramfs directly and modifying /dev/vda to inject ssh-key and some other tasks to make the rootfs usable.

lnguyen234 commented 2 years ago

I have same issue even it selected the correct arch. Does anyone have any idea about this? Thanks Screen Shot 2022-04-04 at 2 29 34 PM