How to keep VirtualBox logs??

17 views
Skip to first unread message

Bruno Vernay

unread,
Jul 23, 2016, 12:46:03 PM7/23/16
to Packer
The VirtualBox forums are asking for logs and I have a hard time to get them since Packer clean up everything.

I ended up doing "tail -f VBMachines/my-vm/Logs/VBox.log" but maybe there is a better way?

The --debug step-by-step is not an option since there is a timing issue and I don't reproduce the problem if I introduce long delays.

Also I have logs up to the shutdown I guess, but how could I get the post_manage logs ???
Is there a do not clean up option ??

Thanks

Loren Gordon

unread,
Jul 23, 2016, 3:58:33 PM7/23/16
to Packer
Is packer making it to the "provisioners" stage? If so, and if you know the path to the file you want, you could try using the `direction` parameter of the "file" provisioner to download it.

        {
            "type": "file",
            "source": "/tmp/manifest.log",
            "destination": "./manifest.log",
            "direction": "download"
        }


-Loren

Bruno Vernay

unread,
Jul 23, 2016, 4:16:23 PM7/23/16
to Packer
Sorry, I was not clear: I do not want to copy files between host/guest.
It all happens on the host.  VirtualBox keeps a logs of its operations in its machine directory.  But all this is cleaned up by Packer in case of failure.
That is my problem ...

Loren Gordon

unread,
Jul 23, 2016, 4:30:21 PM7/23/16
to Packer
Oh right. I see. On my system I don't see logs in my machine directory. But I use the `output_directory` parameter to create the machine in an alternate location. If you use the `output_directory` parameter, perhaps the logs would be preserved wherever they are saved and only the virtual disk files would be cleaned up?

Bruno Vernay

unread,
Jul 23, 2016, 4:39:21 PM7/23/16
to Packer
If I understand correctly, Packer:
  1. Creates the Machine
  2. Provision it
  3. shutdown
  4. runs post_manage (if there are no session still hanging)
  5. Export the machine as an ovf
  6. unregister and delete the machine (including VirtualBox logs)
Then I import the OVF back to VirtualBox.

Bruno Vernay

unread,
Jul 23, 2016, 4:41:08 PM7/23/16
to Packer
We crossed our post.
I was not talking about Packer output directory, but VirtualBox machine directory ...
Reply all
Reply to author
Forward
0 new messages