boxcutter / centos

Virtual machine templates for CentOS written in legacy JSON
Apache License 2.0
424 stars 199 forks source link

Centos, please include kernel-headers and kernel-devel packages on virtualbox VM #69

Closed smougenot closed 7 years ago

smougenot commented 7 years ago

On Vagrant box : 'boxcutter/centos68' (v2.0.21) for 'virtualbox'

Issue: I can't run the box because the guest additions can not update. The failure (deep down) is related to the need of kernel-headers and kernel-devel packages (to build those guest additions). And the fact Centos repos have been updated.

Context: Today the box (v2.0.21) includes kernel packages on version 2.6.32-642.el6. But Centos yum repos only have the packages on version 2.6.32-696.1.1.el6.

I have to update guest additions (a bug on my Virtualbox version made me update it, so I update the guest too). In the process of installing those it detects missing package, tries to install those but the versions are incoherent. At the end, guest additions do not work anymore... and the VM is useless. (An obvious workaround is not to update ... and it works)

issue.log.zip

Solving: IMOO : it would be nice if the box already contains those packages kernel-headers and kernel-devel.

I'm too shy to publish a PR but I think it might be solved adding yum install -y kernel-devel kernel-headers on https://github.com/boxcutter/centos/blob/master/script/update.sh#L5

misheska commented 7 years ago

Adding those build files adds about 130MB to the image download, when the files are used infrequently. The approach behind these templates is that when you need to rebuild guest additions, you just regenerate the box, as that's fairly easy. So the default is to keep the box payload small.

That being said, I've added a cleanup_build_tools variable so that you may override this default behaviour.