Most likely this is because you are building against a newer kernel version
that you just installed (with apt-get update etc) but is not yet running
since you haven't rebooted.

See how bento does it:
https://github.com/chef/bento/blob/master/_common/virtualbox.sh
https://github.com/chef/bento/blob/master/ubuntu/scripts/update.sh

On 6 January 2018 at 14:07, Robert Wang <[email protected]> wrote:

> I am trying to build ubuntu dev box using packer, this virtualbox guest
> installation is one of script:
>
> ubuntu-vbguest.sh
>
> export DEBIAN_FRONTEND=noninteractive
>
> apt-get install -y -q gcc build-essential
>
> mount -o loop,ro VBoxGuestAdditions.iso /mnt
> yes | sudo sh /mnt/VBoxLinuxAdditions.run
> umount /mnt
>
>
> it always failed and exited from packer,
>
> virtualbox-iso: VirtualBox Guest Additions installer
>     virtualbox-iso: Copying additional installer modules ...
>     virtualbox-iso: Installing additional modules ...
>     virtualbox-iso: VirtualBox Guest Additions: Building the VirtualBox
> Guest Additions kernel modules.
>     virtualbox-iso: VirtualBox Guest Additions: Running kernel modules
> will not be replaced until the system is restarted
>     virtualbox-iso: VirtualBox Guest Additions: Starting.
>     virtualbox-iso: VirtualBox Guest Additions: modprobe vboxsf failed
> ==> virtualbox-iso: Step "StepProvision" failed
>
> ubuntu iso
> ubuntu-17.10-server-amd64.iso
>
> $ packer version
> Packer v1.1.3
>
> I run on win7 + msys64
>
> virtualbox 5.2.4
>
> Even I run above guest installation inside vm, will get same error - modprobe
> vboxsf failed, need to reboot vm once then vboxsf show up.
>
> So question is how can I make VBoxGuestAdditions installed in packer
> script without any manual work?
>
> Thanks.
>
> BR/
> Robert
>
>
>
>
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/packer-tool/b5c84517-88d8-4b15-9ebf-92f764bb5781%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/b5c84517-88d8-4b15-9ebf-92f764bb5781%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CALz9Rt8xJQp%2Bk3HfB4DVE1eptUsVUNrpdBBgqxZfYxTUMm%3D%2BYg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to