VirtualBox Guest Additions: modprobe vboxsf failed

5,039 views
Skip to first unread message

Robert Wang

unread,
Jan 6, 2018, 8:07:42 AM1/6/18
to Packer
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





Rickard von Essen

unread,
Jan 6, 2018, 11:24:09 AM1/6/18
to packe...@googlegroups.com
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:

--
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 packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/b5c84517-88d8-4b15-9ebf-92f764bb5781%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Robert Wang

unread,
Jan 6, 2018, 12:58:15 PM1/6/18
to Packer
Thanks this is the easy way what I am looking for to by pass the unwanted exit code.

Reply all
Reply to author
Forward
0 new messages