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

Virtualbox packager includes stray information #9425

Closed
axd1967 opened this issue Feb 1, 2018 · 11 comments
Closed

Virtualbox packager includes stray information #9425

axd1967 opened this issue Feb 1, 2018 · 11 comments

Comments

@axd1967
Copy link

axd1967 commented Feb 1, 2018

Vagrant version

2.0.2

Host operating system

Ubuntu 16.04

Guest operating system

ubuntu/xenial

unless following config is used inside Vagrantfile ...

Vagrantfile (relevant excerpt)

(remainder of Vagrantfile is basic)

  myvm.vm.provider "virtualbox" do |vb|
      # workaround: if following line is not present, you get the bug
      vb.customize [ 'modifyvm', :id, '--uartmode1', 'disconnected']
  end

... Vagrant box packaging (vagrant package --base ... --ouput ...) will result in the inclusion of a hardcoded (and apparently totally unrelated) user file path (usually related to the user creating the box, eg /home/user/<filename>) that can be found in the box.ovf (XML) file, resulting in errors when another user tries to install (vagrant up) that box.

This .ovf file is probably used to configure serial ports, but in this case a local logfile path somehow ends up in this setting.

(originally submitted at https://www.virtualbox.org/ticket/17513)

steps to reproduce

vagrant init "ubuntu/xenial64"
vagrant up
vagrant package --output test.box

then, extract box.ovf and observe that under <UART><Port slot="0"> there is odd info:
path="(some local path)"

When another user tries to install such a box (notice that in this case, the offending file path starts with /home/alex/...):

=> v_mylab: 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", "e601f0da-670e-40dd-b1ef-bbfe4184241a", "--type", "headless"]

Stderr: VBoxManage: error: RawFile#0 failed to create the raw output file /home/alex/projects/lynx/lynx/components/infrastructure/testpilot/tools/vagrant/ubuntu-xenial-16.04-cloudimg-console.log (VERR_FILE_NOT_FOUND)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ConsoleWrap, interface IConsole
@erezinchy
Copy link

We are facing same issue..
any workaround?

@axd1967
Copy link
Author

axd1967 commented Feb 4, 2018

@erezinchy the workaround is proposed in the issue (look for vb.customize [ 'modifyvm', :id, '--uartmode1', 'disconnected'])

@axd1967
Copy link
Author

axd1967 commented Feb 6, 2018

by the way - does it make sense to include synced folders when packaging a box? (/vagrant seems to be included in the generated box file).

@erezinchy
Copy link

I believe the root cause of my issue is different even though the error message is the same.

We were getting the error when running packer build.
I've managed to overcome it, by changing the path inside the serial port settings inside the virtual box, and removing the shared folder that was pointing to /home/ ...

BR,
Erez.

@gdiamond
Copy link

gdiamond commented Mar 1, 2018

I believe this is Canonical's problem as they are the maintainers of the official ubuntu/xenial64 image. Have you noticed newly created log file named ubuntu-xenial-16.04-cloudimg-console.log in the same directory as Vagrantfile? This is because Canonical is including a Vagrantfile when they package up the image to wire up the VM in order to create the log file.

If I run the following on my Ubuntu machine, using https://app.vagrantup.com/ubuntu/boxes/xenial64/versions/20180228.1.0

cat ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20180228.1.0/virtualbox/Vagrantfile

it produces

# Front load the includes
include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
load include_vagrantfile if File.exist?(include_vagrantfile)

Vagrant.configure("2") do |config|
  config.vm.base_mac = "02248981872F"

  config.vm.provider "virtualbox" do |vb|
     vb.customize [ "modifyvm", :id, "--uart1", "0x3F8", "4" ]
     vb.customize [ "modifyvm", :id, "--uartmode1", "file", File.join(Dir.pwd, "ubuntu-xenial-16.04-cloudimg-console.log") ]
  end
end

I use the workaround provided by @axd1967 whenever I build a box off of the official ubuntu/xenial64 image that I intend to package and distribute internally.

@m-anish
Copy link

m-anish commented Apr 17, 2018

I face the same issue and @axd1967 's solution seems to work as well when using ubuntu/xenial64 baseimage

@keuneke
Copy link

keuneke commented Sep 20, 2018

thanks a million, I was pulling my hair since the problem only occured when using the box on a different machine from where it was created (which is of course the purpose), on the same machine the path of course exists and there is no issue.
However, asking users to edit the vagrantfile is of course not a full solution. Hope ubuntu fixes the root cause soon

@Jimwoodward
Copy link

Is there any update to this? I'm still running into this issue with Vagrant 2.1.5 and VBox 5.2.18

@gdiamond
Copy link

gdiamond commented Oct 2, 2018

@Jimwoodward
The only way to get this fixed when using an Ubuntu box (i.e. ubuntu/xenial) is to have Ubuntu not include the Vagrantfile in the base box.

See

@chrisroberts
Copy link
Member

Closing as this is an upstream issue. Cheers!

@ghost
Copy link

ghost commented Mar 28, 2020

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.

@ghost ghost locked and limited conversation to collaborators Mar 28, 2020
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