Vagrant box fails trying to log to a path the box was created from

0

This is a very specific error, and pretty obvious what's going on, I just don't know how to correct it. Don't see a specific answer on this.

Caution: the names in this film have been changed to protect the newbies.

jsmith@JSMITH010451 ~/Documents/Projects/vbox90 % vagrant up                                                                                                                                                        16:44:17
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'inflectionpoint/throwaway1'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'inflectionpoint/throwaway1' version '0.0.1' is up to date...
==> default: Setting the name of the VM: vbox90_default_1612046694580_50678
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "670fc20e-25e1-404f-b241-c8ae5d816a72", "--type", "headless"]

Stderr: VBoxManage: error: RawFile#0 failed to create the raw output file /Users/johnsmith/Desktop/Inflection Point Development/vbox1/ipd-developnode/inflectionpoint-saas.com/ubuntu-xenial-16.04-cloudimg-console.log (VERR_FILE_NOT_FOUND)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ConsoleWrap, interface IConsole

So this is on a different computer, and it exposed the fact obviously that log writing was going to somewhere else besides the box (/Users/johnsmith/Desktop/Inflection Point Development/vbox1/ipd-developnode/inflectionpoint-saas.com/ubuntu-xenial-16.04-cloudimg-console.log). Since I'm johnsmith on the creating computer and jsmith on the one I want to install the box, I can't even create that path - how do I change the original package's location to write that log file to inside the created box itself? Thanks!

vagrant
asked on Super User Jan 30, 2021 by Oliver Williams

2 Answers

1

OK, solution found!

If you are packaging a box to share, you have to change this setting BEFORE you package it. Open VirtualBox. Select the box in question (running or not). Then click on settings, and then change the path under serial port as follows:

./ubuntu-xenial-16.04-cloudimg-console.log

this will be created for users in the path that you have your Vagrantfile - which should always work.

steps

PS I have no idea how I wound up with the convoluted path but I think it happens when you vagrant up from some directory besides the root folder for your vagrant settings..

answered on Super User Jan 31, 2021 by Oliver Williams
0

I found the following workaround for my Win10 setup which should also work for MacOS and Linux.

Vagrantfile:

config.vm.provider "virtualbox" do |vb|
    # Workaround for Ubuntu cloud image: relocate UART console file into .vagrant folder
    vb.customize ["modifyvm", :id, "--uartmode1", "file", File.join(Dir.pwd, ".vagrant/uart1.log").sub("/", File::ALT_SEPARATOR)]
end
answered on Super User Apr 1, 2021 by sealor

User contributions licensed under CC BY-SA 3.0