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

Packer darwin/arm64 support #10708

Closed
sylviamoss opened this issue Mar 1, 2021 · 10 comments
Closed

Packer darwin/arm64 support #10708

sylviamoss opened this issue Mar 1, 2021 · 10 comments

Comments

@sylviamoss
Copy link
Member

Apple has recently announced and begun shipping hardware including the M1 chip, also known as Apple "silicon". As of Go 1.16, support for this new hardware in the Go language is via a new darwin/arm64 platform.

Packer should start supporting darwin/arm64 via both https://www.packer.io/downloads and homebrew tap.

@evertiro
Copy link

evertiro commented Apr 3, 2021

So... I have an M1, and this fails currently. I've been trying to sort through an issue over on VVV to add M1 support, which led to an issue on bento, which led here. Currently, trying to build the box results in the following:

packer build -only=parallels-iso ubuntu-20.04-arm64.json
parallels-iso: output will be in this color.

==> parallels-iso: Retrieving ISO
==> parallels-iso: Trying http://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.2-live-server-arm64.iso
==> parallels-iso: Trying http://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.2-live-server-arm64.iso?checksum=sha256%3A69460b49c6781a845ca561263af3850e107814ffb9c08a19555e819d49feef4c
==> parallels-iso: http://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.2-live-server-arm64.iso?checksum=sha256%3A69460b49c6781a845ca561263af3850e107814ffb9c08a19555e819d49feef4c => /Users/dgriffiths/Work/Vagrant/bento/packer_templates/ubuntu/packer_cache/a06a0437be2ba6315867ed8c431f8fb1a95c27cf.iso
==> parallels-iso: Starting HTTP server on port 8147
==> parallels-iso: Creating virtual machine...
==> parallels-iso: Applying default settings...
==> parallels-iso: Creating hard drive...
==> parallels-iso: Setting the boot order...
==> parallels-iso: Attaching ISO to the default CD/DVD ROM device...
==> parallels-iso: Starting the virtual machine...
==> parallels-iso: Error starting VM: prlctl error: Failed to start the VM: Unable to start "ubuntu-20.04-arm64" because your Mac is equipped with the Apple M1 chip that does not support Intel-based operating systems. To create a compatible virtual machine, use an ISO or VHDX image file with an ARM-based operating system.
==> parallels-iso: Unregistering virtual machine...
==> parallels-iso: Deleting output directory...
Build 'parallels-iso' errored after 15 seconds 631 milliseconds: Error starting VM: prlctl error: Failed to start the VM: Unable to start "ubuntu-20.04-arm64" because your Mac is equipped with the Apple M1 chip that does not support Intel-based operating systems. To create a compatible virtual machine, use an ISO or VHDX image file with an ARM-based operating system.

==> Wait completed after 15 seconds 632 milliseconds

==> Some builds didn't complete successfully and had errors:
--> parallels-iso: Error starting VM: prlctl error: Failed to start the VM: Unable to start "ubuntu-20.04-arm64" because your Mac is equipped with the Apple M1 chip that does not support Intel-based operating systems. To create a compatible virtual machine, use an ISO or VHDX image file with an ARM-based operating system.

==> Builds finished but no artifacts were created.

The message is a bit nonsensical because the same image works fine when downloaded and loaded in Parallels manually. I suspect this is because while software installed on the M1 itself needs to be compiled for amd64, anything installed in the virtualized environment (starting with Parallels Tools) needs to be aarch64.

@sylviamoss sylviamoss modified the milestones: 1.8.0, 1.7.3 Apr 6, 2021
@azr azr added the help wanted label Apr 7, 2021
@grandeit
Copy link

grandeit commented Apr 17, 2021

I cannot reproduce the prlctl error @evertiro is getting but nonetheless the VM cannot be build because typing the boot command does not work and the build fails after the SSH connection timeout. (see log below)
Packer uses the Python script builder/parallels/common/prltype.go and The Parallels Virtualization SDK for Mac to type the boot command.
Unfortunately the shared library that the SDK uses is compiled for x86 and therefore the Python script fails:

/Library/Frameworks/ParallelsVirtualizationSDK.framework/Versions/8/Libraries/Python/2.7/prlsdkapi/prlsdk.so: Mach-O 64-bit dynamically linked shared library x86_64

That means we have to wait for Parallels to fix their SDK.

Build log:

packer build -only=parallels-iso ubuntu-20.04-live-arm64.json 
parallels-iso: output will be in this color.

==> parallels-iso: Retrieving ISO
==> parallels-iso: Trying http://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.2-live-server-arm64.iso
==> parallels-iso: Trying http://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.2-live-server-arm64.iso?checksum=sha256%3A69460b49c6781a845ca561263af3850e107814ffb9c08a19555e819d49feef4c
==> parallels-iso: http://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.2-live-server-arm64.iso?checksum=sha256%3A69460b49c6781a845ca561263af3850e107814ffb9c08a19555e819d49feef4c => /Users/gwaaf/bento/packer_templates/ubuntu/packer_cache/a06a0437be2ba6315867ed8c431f8fb1a95c27cf.iso
==> parallels-iso: Starting HTTP server on port 8755
==> parallels-iso: Creating virtual machine...
==> parallels-iso: Applying default settings...
==> parallels-iso: Creating hard drive...
==> parallels-iso: Setting the boot order...
==> parallels-iso: Attaching ISO to the default CD/DVD ROM device...
==> parallels-iso: Starting the virtual machine...
==> parallels-iso: Waiting 5s for boot...
==> parallels-iso: Host IP for the Parallels machine: 192.168.1.36
==> parallels-iso: Typing the boot command...
==> parallels-iso: Using ssh communicator to connect: 10.211.55.6
==> parallels-iso: Waiting for SSH to become available...
==> parallels-iso: Error waiting for SSH: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
==> parallels-iso: Unregistering virtual machine...
==> parallels-iso: Deleting output directory...
Build 'parallels-iso' errored after 2 minutes 41 seconds: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain

@m-emelchenkov
Copy link

It's a super-important issue, because Bento boxes are work horses for many people. I do not have M1 (yet) so cannot test, but there is a new SDK optimized for M1 and Parallels 16.5: https://www.parallels.com/download/pvsdk/m1/. It has prlsdk.so compiled for arm64, I checked.

@evertiro
Copy link

evertiro commented Apr 17, 2021

It's a super-important issue, because Bento boxes are work horses for many people. I do not have M1 (yet) so cannot test, but there is a new SDK optimized for M1 and Parallels 16.5: https://www.parallels.com/download/pvsdk/m1/. It has prlsdk.so compiled for arm64, I checked.

Yes. Including me. I don't know much about how Vagrant works behind the scenes (although I recently joined the VVV team, so I'm learning quickly), but it's a pretty crucial part of my daily workflow.

I now have issues on several different repos relevant, in some way, to this issue. Since this specific issue seems to be the lynchpin, I'm going to do a little bit of a data dump and put as much information as I can here. Hopefully, either it'll give someone else inspiration on how to fix this, or can serve as a starting point for me figuring it out. If you know more about what's going on here than I do but don't have an M1, please feel free to reach out. I'm more than happy to be the resident guinea pig in any way necessary.

My journey here started over on the VVV repo. In my "day job" I do custom WordPress work, and VVV is central to that process. My main work laptop recently fell prey to a poorly timed power spike and I was forced to buy a new laptop. I bought an M1 because cross-compatibility is important for my "night job" and I hadn't been able to do proper testing on a Mac in ages. Besides, I like tinkering and figured the challenge of getting everything working on a new chip would be fun. Well, it's been interesting. While all of the individual pieces of VVV work on the M1 chip, VVV itself didn't because it's still running Ubuntu 18.x boxes. I spent years as a core dev for Arch Linux... can't be that hard to upgrade, right? (It isn't... unless you're on M1).

There's no 20.x bento box that works on M1, but there is an alternative box that works. Version 1.0.0 of rueian/ubuntu20-m1 worked until yesterdays Vagrant update. Version 2.0.0 doesn't work, don't bother trying it. While the image provided by rueian does work, it doesn't work perfectly. Something in how it was built resulted in a permissions issue; PHP can't actually write to its own webroot. So at this point, I have issues open on VVV for fixing Parallels with VVV, updating VVV to 20.04, and the permissions issue. Since I'm now using VVV with three major deviations from what's officially supported, it's hard to tell what the root of any problem is. The permissions issue could easily be caused by a configuration issue with Parallels or the M1 itself, since I'm the first person officially supporting them (I'm now on the VVV team for specifically that purpose). But... it could just as easily be a result of a misconfiguration in the box I'm using. Logically, the next step is trying to add an M1 build for bento itself. Which I tried, and failed, and is documented on the bento repo here.

That failure led to the realization that the problem wasn't actually with bento, but with the cross-compilation issue in packer which I mentioned above. So here I am. I'm willing to help however I can, so let me know what I can do.

Edit: Mount problem was because I'm an idiot and forgot to update plugins.

@m-emelchenkov
Copy link

m-emelchenkov commented Apr 18, 2021

@evertiro Mount problem reminds me this bug: hashicorp/vagrant#12277

@evertiro
Copy link

All right, @benlumia007 figured the permissions issue on our end. For anyone else who makes it this far trying to figure out Vagrant permissions issues with Parallels, adding mount_options: [ 'share' ] fixes them.

This means that the rueian/ubuntu20-m1 box is a workable solution until we can get an official bento release for M1. I'm still more than happy to help work through the issues here if anyone can point me in the right direction.

@SwampDragons SwampDragons modified the milestones: 1.7.3, 1.7.2 Apr 21, 2021
@SwampDragons
Copy link
Contributor

We added this support in release 1.7.2; it sounds like the remaining issues are bento-specific, so I'm going to close this, but if you think this is wrong and this is actually a Packer issue we can reopen and debug together.

@evertiro
Copy link

We added this support in release 1.7.2; it sounds like the remaining issues are bento-specific, so I'm going to close this, but if you think this is wrong and this is actually a Packer issue we can reopen and debug together.

As far as I can tell, the problem is with Packer. That's why I reopened this in the first place. All known issues on the VVV/Parallels fronts have been resolved. The bento image should work, the same steps run manually work, but one of the Packer dependencies is the being pulled in for the wrong architecture.

@evertiro
Copy link

@SwampDragons It seems that I don't have permissions to actually re-open?

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants