Get vbox additions pre-installed
xmj opened this issue · comments
The vagrant centos7 image currently lacks VBox guest additions. This leads to a lot of unnecessary Net I/O consuming time and mirror bandwidth on each initial vagrant up
.
To be able to get them in, the following is necessary:
- Include VBox guest additions dependencies in centos7.ks
- Package VBox Guest additions as RPM, not entirely unlike the way FreeBSD does (http://www.freshports.org/emulators/virtualbox-ose-additions) but different ;-)
- Get that RPM hosted on the community build service
- Include it in centos7.ks
The Opensource variant of the Guest additions is licensed under the GPLv2 license, so this would not cause any conflict with any other components.
Operationalizing the steps above I'm looking at:
- Identify dependencies
Vagrant's plugin vbguest installs them all during the firstvagrant up
, so this is about using a minimal Vagrantfile tovagrant up
, log its output, and extract all yum-dependencies.
I'll follow up in a comment next week at the latest. - Package VBox Guest additions as RPM & Getting it hosted on CBS
Someone familiar with RPM builds and the community build service would need to help me with this to include any patches (if necessary), configure build and install steps to make things build on CentOS. Once we have something that builds we should be able to publish it easily.
X-ref: #27 (comment)
This has been biting me for a long time. Do we know when would this be fixed ? Are the guest editions installed in centos/6 ?
On 1. Identify dependencies:
Required by vbguest:
Package binutils-2.25.1-32.base.el7_4.1.x86_64 already installed and latest version
Package 1:make-3.82-23.el7.x86_64 already installed and latest version
Package bzip2-1.0.6-13.el7.x86_64 already installed and latest version
[...] dependency resolution for the following packages
Installing:
gcc x86_64 4.8.5-16.el7 base 16 M
kernel-devel x86_64 3.10.0-693.2.1.el7 updates 14 M
perl x86_64 4:5.16.3-292.el7 base 8.0
Installing for dependencies:
[...] pulled in by gcc, kernel-dev and perl
I second that. It would be so much better to have the already built Guest Additions for each kernel directly as RPMs. That way, we wouldn't need to pollute the VM with development tools and it would speed the provisioning.
Let me put it this way: the lack of guest additions in published imaged cripples their usability for testing. VirtualBox Guest Additions
must be included in the images if we really care about UX.
Would this require a separate build version for each "VBoxGuestAdditions.iso" depending on the Virtualbox (5.2.x or 6.0.x) installed on the host? (https://www.virtualbox.org/manual/ch04.html), and one also needs to balance the extra weight of the container as not everyone is using the GUI. Just my 2 cents.
@truatpasteurdotfr: VirtualBox will complain if the guest additions are a different version than the version of VirtualBox on the host. When I switched the host between VirtualBox 4.2.x and 4.3.x without touching the guest image, it complained but it didn't crash. That might be different across major version - worst case would be a host OS crash due to the hypervisor receiving unexpected answers. People on Windows and Mac probably use the latest VirtualBox version, while Ubuntu LTS and Debian users usually have an older major version.
I looked at including the guest additions in the official CentOS images around 2016-2017 and ultimately decided against it. The guest images use DKMS to build the kernel modules - you need the kernel headers and development tools in the image, because the kernel modules have to be recompiled on each kernel update (that would increase the size of our images by around 400MB, basically doubling their size). What I wanted to do is to compile the guest additions as binary RPMs and take advantage of the kernel ABI compatibility offered by RHEL. I asked the VirtualBox developers in #vbox-devel, who told me this might work, but Red Hat only guarantees binary compatibility for a subset of the kernel calls, and VirtualBox probably uses things outside of that subset. This would be a significant amount of work with no guarantee of success, and we'd probably have to provide different images for different versions of VirtualBox installed on the host.
The Vagrant images for VirtualBox work just fine without the guest additions, both for Vagrant networking and file sharing. NFS is significantly faster for file sharing, and the Atomic team decided to switch from the guest additions to sshfs, which works on all host operating systems (you'll end up with corrupt files if you use guest additions' shared folders on a directory which is served by Apache or nginx with sendfile enabled). The guest additions are not worth it in my opinion and I'm not going to invest any time in building RPM packages for them, but I'm not going to veto them either, if someone is willing to spend the effort and @kbsingh wants to accept them.
If someone wants to use the guest additions, I guess the easiest way is either vagrant-vbguest (which won't work across point updates of CentOS) or use the vbox-packer branch in my fork of this repo to build their own images with Packer, it probably takes around 10 minutes if you have a SSD.