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

Chassis only uses the Arm box on Arm if the mode is set to base #988

Closed
tomjn opened this issue Nov 5, 2022 · 6 comments · Fixed by #1006
Closed

Chassis only uses the Arm box on Arm if the mode is set to base #988

tomjn opened this issue Nov 5, 2022 · 6 comments · Fixed by #1006
Assignees

Comments

@tomjn
Copy link
Contributor

tomjn commented Nov 5, 2022

If you run an Apple Silicon device and use parallels it will try to use the amd64/x86 box if the mode is set to normal.

There is a check to change it to the arm64 box, but this is only running when the mode is base:

	# The Parallels Provider uses a different naming scheme.
	config.vm.provider :parallels do |_v, override|
		unless CONF['_mode'] == "normal"
			# Vagrant currently runs under Rosetta on M1 devices. As a result,
			# this seems to be the most reliable way to detect whether or not we're
			# running under ARM64.
			if Etc.uname[:version].include? 'ARM64'
				override.vm.box = 'mpasternak/focal64-arm'
			end
		end
	end

instead, until an arm64 chassis box is built it should instead force the CONF['_mode'] value to base

@BronsonQuick
Copy link
Member

This is by design at the moment and it's been documented.

Do you know if there's a way to detect in in the Vagrantfile? If we can detect it then I'm happy to add it. I don't have a Silicon chip so I can't test it but if you do a PR for us then I'll be happy to test the backwards compatibility and merge it in. Taa!

@tomjn
Copy link
Contributor Author

tomjn commented Nov 6, 2022

I believe it's in the code block above, here is VVV's check to auto-switch our config to use the Parallels provider by default if Arm64 is detected as the chipset:

# if Arm default to parallels
if Etc.uname[:version].include? 'ARM64'
  defaults['provider'] = 'parallels'
end

@tomjn
Copy link
Contributor Author

tomjn commented Nov 6, 2022

Perhaps the code I quoted can be simplified to:

	# The Parallels Provider uses a different naming scheme.
	config.vm.provider :parallels do |_v, override|
		# Vagrant currently runs under Rosetta on M1 devices. As a result,
		# this seems to be the most reliable way to detect whether or not we're
		# running under ARM64.
		if Etc.uname[:version].include? 'ARM64'
			override.vm.box = 'mpasternak/focal64-arm'
		end
	end

Then perhaps in def self.normalize_config(config) in puppet/chassis.rb it can do a check like this:

		if Etc.uname[:version].include? 'ARM64'
			config['_mode'] = 'base'
		end

What do you think?

@BronsonQuick
Copy link
Member

@tomjn That looks great to me! Any chance you'd be able to pop up a PR for that and let me know if it works as expected for you then I'll test backwards compatibility on my Intel chip. Thanks!

@tomjn
Copy link
Contributor Author

tomjn commented Dec 13, 2022

I've very very limited bandwidth available to do this, it may take a few weeks/months before I can get to this

Note that the code I shared is almost guaranteed to work though and is extremely similar to work done elsewhere

@BronsonQuick
Copy link
Member

@tomjn Sorry for the epic delay on this. I'm doing some catching up now. I've added your fix. Hopefully it works for you. If you get a chance could you please do a little test for me? Thanks man!

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

Successfully merging a pull request may close this issue.

2 participants