KVM not working within task


#1

Hi guys,

I’m currently trying to run Packer (HashiCorp) within a task. KVM/Qemu is active and executable on the host. I also provide a docker image that has the required packages and packer installed.

If I start the container with "docker run … " and run inside the container packer, everything works (privileged of course). Within the pipeline, however, I get the following error message:

2018/04/23 08:03:25 packer: 2018/04/23 08:03:25 Qemu stderr: (process:92): GLib-WARNING **: gmem.c:483: custom memory allocation vtable not supported
2018/04/23 08:03:25 packer: 2018/04/23 08:03:25 Qemu stderr: Could not access KVM kernel module: Operation not permitted
2018/04/23 08:03:25 packer: 2018/04/23 08:03:25 Qemu stderr: failed to initialize KVM: Operation not permitted

Following is the configuration of the task:

  - task: build-vagrant-box
    privileged: true
    config:
      platform: linux
      image_resource:
        type: docker-image
        source:
          repository: "registry:5000/packer"
          insecure_registries:
            - registry:5000
      inputs:
        - name: packer-scripts
      run:
        path: ./build.sh
        dir:  packer-scripts
    params:
      PACKER_LOG: 1

Do you have any ideas why the tasks inside the pipeline are not running?

Many greetings,
Lenny


#2

Hey @lenny, this was a while ago, but if you’re still interested you’ll need to do something like this https://github.com/kevinwallace/qemu-docker/blob/master/kvm-mknod.sh