Troubles creating OS X 10.9 box with VirtualBox

5,832 views
Skip to first unread message

Alexey Petruchik

unread,
Jan 16, 2014, 5:26:03 AM1/16/14
to vagra...@googlegroups.com
Hi, all. I'm having troubles creating OS X Mavericks vagrant box. I've installed OS X Mavericks to VirtualBox using this guide:

http://www.youtube.com/watch?v=3kKDf-E5AiQ

Then I've configured guest OS X using this guide:


After VM shutdown and trying to package it I'm getting this output:

vagrant package --base vagrant-osx

[vagrant-osx] Discarding saved state of VM...

[vagrant-osx] Clearing any previously set forwarded ports...

A directory was not specified to package. This should never happen

and is a result of an internal inconsistency.


I'm new to vagrant so it would be nice if someone can explain me what is going on and what I'm doing wrong.

Host system: OS X 10.9.1

Guest system: OS X 10.9

VirtualBox: 4.3.6

Vagrant: 1.4.2

Tony Guntharp

unread,
Jan 16, 2014, 6:01:58 PM1/16/14
to vagra...@googlegroups.com
Virtualbox and OSX guest don't play nicely together, you're better off doing it using VMware.

-t

Tony Guntharp
Co-Founder SourceForge.net
1 (415) 373-6814
1 (415) 694-3732


--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Alexey Petruchik

unread,
Jan 21, 2014, 1:05:23 PM1/21/14
to vagra...@googlegroups.com
But virtual machine seems to be working quite well when I use it from VirtualBox GUI. Can it be a vagrant-related issue? How can I enable some debug\verbose mode to get more info what is going wrong?

Alvaro Miranda Aguilera

unread,
Jan 21, 2014, 9:03:04 PM1/21/14
to vagra...@googlegroups.com
What happen if you add

--output osx.box

to the command ?

Paul C

unread,
Jan 22, 2014, 11:31:15 AM1/22/14
to vagra...@googlegroups.com
Have you tried passing --debug to vagrant?

Alexey Petruchik

unread,
Jan 23, 2014, 2:49:47 PM1/23/14
to vagra...@googlegroups.com
Specifying --output doesn't change anything for me. I've attached complete log generated by running

vagrant package --base vagrant-osx --debug

Hope that such detailed log (1856 lines) can help to determine the root of the problem.
vagrant.log

Alexey Petruchik

unread,
Jan 29, 2014, 12:27:01 PM1/29/14
to vagra...@googlegroups.com
So still no ideas what is going wrong?

Alexey Petruchik

unread,
Feb 3, 2014, 1:44:39 PM2/3/14
to vagra...@googlegroups.com
up

demit...@gmail.com

unread,
Feb 23, 2014, 8:11:19 AM2/23/14
to vagra...@googlegroups.com
I've verified that vagrant works just fine with an OSX guest. The only feature that I've detected as broken so far is shared folders since VirtualBox doesn't support guest additions for OSX. Here is what you need to do in your VirtualBox OS X guest before repackaging:
  1. Go to System Preferences > Sharing and enable remote login
  2. On the same pane, select Allow Access for All Users
  3. Launch /Applications/Utilities/Terminal.app
  4. sudo -i   # Enter your root password here
  5. visudo    
    1. This will allow you to modify sudoers. Vim will be the default text editor so make sure you're comfortable with basic file modifications in vim before attempting this step. At the end of the file add the following: vagrant ALL=(ALL) NOPASSWD: ALL
    2. This is making the assumption that your admin user is named vagrant. 
    3. Save and quit the visudo session
  6. exit  # to exit root
  7. mkdir ~/.ssh
  8. vim ~/.ssh/authorized_keys
    1. Copy and paste the public key from the following link into this file: https://github.com/mitchellh/vagrant/blob/master/keys/vagrant.pub
    2. Save and quit the vim session
  9. sudo shutdown -h now
That should do it. Package the box and run vagrant box add. You may want to include a vagrantfile in your package that includes the following:

Vagrant.configure('2') do |config|
  config.vm.provider "virtualbox" do |v|
    v.gui = true
  end
end


This will ensure that the box boots in GUI mode, which would make a lot of sense using OS X as a guest VM. So, when packaging, don't forget the --vagrantfile flag. 


I hope this helps. Good luck. 

Brien Givens

unread,
Apr 7, 2014, 5:21:49 PM4/7/14
to vagra...@googlegroups.com, i10...@gmail.com
I'm having similar problems with a similar setup


I followed demit's suggestions but the problem persists.

@Alexey - I assume 'up' means you got yours running? What finally got it working for you?

@demit - any other tips?

demit...@gmail.com

unread,
Apr 7, 2014, 5:39:33 PM4/7/14
to vagra...@googlegroups.com, i10...@gmail.com
When you SSH in manually, are you using your private key or are you using your password? 

Brien Givens

unread,
Apr 7, 2014, 6:02:54 PM4/7/14
to vagra...@googlegroups.com, i10...@gmail.com
password... how do I use the private key?

demit...@gmail.com

unread,
Apr 7, 2014, 6:23:58 PM4/7/14
to vagra...@googlegroups.com, i10...@gmail.com
Try the following:

ssh -p 2222 -i ~/.vagrant.d/insecure_private_key vagrant@localhost

The -p flag allows you to specify the port. The -i flag allows you to specify the path to the private key that is provided with your vagrant installation. vagrant@localhost is the general method of connecting to remote ssh nodes, with vagrant being the user and localhost being the host to which you intend to connect. Since vagrant does SSH through NAT on the localhost, we use localhost here. 

If this fails, then my guess is that something is wrong with your ssh keys. If it does not fail, but instead just takes a long time to authenticate, then my guess is that UseDNS in sshd_config on the guest is set to yes. If you set this to no, then you can sometimes reduce the time it takes to SSH into the guest system. 

Brien Givens

unread,
Apr 7, 2014, 6:33:55 PM4/7/14
to vagra...@googlegroups.com, i10...@gmail.com
That worked instantly.  This is the output:

Guests-MacBook-Pro:vagrant-base-dev briengivens$ ssh -p 2222 -i ~/.vagrant.d/insecure_private_key vagrant@localhost
The authenticity of host '[localhost]:2222 ([127.0.0.1]:2222)' can't be established.
RSA key fingerprint is (removed).
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:2222' (RSA) to the list of known hosts.
Password:
Last login: Mon Apr  7 11:34:45 2014
Dev-Box:~ admin$

demit...@gmail.com

unread,
Apr 7, 2014, 6:53:35 PM4/7/14
to vagra...@googlegroups.com, i10...@gmail.com
If you had to type in your password, then your keys did not work. If your SSH keys don't work, vagrant ssh will not work. Some things to check/try:
  • > ~/.ssh/known_hosts   # (Execute this on your host system. Standard SSH troubleshooting)
  • Try loosening up your permissions on your ssh directories and files completely in the guest machine. For example, chmod -R 0777 ~/.ssh. After doing this, try SSHing into the guest as described previously. If you don't get asked for your password, then your keys are working and the permissions you had previously were too strict. After you get it working though, you may want to tighten them up a bit 
  • Make sure that the vagrant user in the guest system owns the ~/.ssh directory for the vagrant user. 
  • Double check and make sure that the ~/.ssh/authorized_keys file on the guest contains the string exactly as is in the public key provided by the folks at Vagrant. If there is a typo here, the key won't work

demit...@gmail.com

unread,
Apr 7, 2014, 7:02:30 PM4/7/14
to vagra...@googlegroups.com, i10...@gmail.com
Additionally, from the looks of your output, it looks like your SSHing into the admin account, NOT the vagrant user. The keys provided by Vagrant are intended for a user named vagrant, not admin. Make sure you have a vagrant user on the guest machine and give it admin privileges. 

Otherwise, you can generate your own SSH keys...

Brien Givens

unread,
Apr 7, 2014, 7:35:55 PM4/7/14
to vagra...@googlegroups.com, i10...@gmail.com
I think I've zeroed in on the problem. When I created the base box, I named my User Account 'admin'. Later on, I read about the need for a 'vagrant' User Account, so I just renamed my 'admin' account to 'vagrant'.

I'm in the process of recreating my base box. Hopefully, everything will go smoothly this time.

Thanks a mil for your help! This was ridiculous to sort out.

Demitri Swan

unread,
Apr 7, 2014, 8:47:14 PM4/7/14
to vagra...@googlegroups.com, i10...@gmail.com
Renaming the user account is never really a good idea. You might have changed the Full Name and not the shortname (which is the name that Darwin and CLI software actually cares about). You can verify this with the dscl command. Anyway, just starting over with the new user account will likely fix your problem. 

Good luck. 


--
You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/HKL0FXR6QmE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brien Givens

unread,
Apr 7, 2014, 10:52:21 PM4/7/14
to vagra...@googlegroups.com, i10...@gmail.com
Demitri... thanks again for your help... my box is up and running now.

Alvaro Miranda Aguilera

unread,
Apr 7, 2014, 11:27:57 PM4/7/14
to vagra...@googlegroups.com, i10...@gmail.com
Now that you have overcome all the troubles, will you share the instructions?

:)


--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages