VM agent issues, please help me understand how it works

I am trying to create a docker container which runs incus, thanks to its port to alpine.
I have everything working well enough except for the VM agent.

Since there is no init system in the container, I looked into the init files to try and understand what process other than incusd is running, amybe to handle the VM agent, but haven’t found anything.

Could anyone clear up for me, what may cause this message:
Error: VM agent isn’t currently running

Here is what my logs look like:

time=“2024-02-14T17:40:57Z” level=warning msg=“AppArmor support has been disabled because of lack of kernel support”
time=“2024-02-14T17:40:57Z” level=warning msg=" - AppArmor support has been disabled, Disabled because of lack of kernel support"
time=“2024-02-14T17:40:57Z” level=warning msg=" - Couldn’t find the CGroup memory swap accounting, swap limits will be ignored"
time=“2024-02-14T17:40:59Z” level=error msg=“scheduler: Couldn’t setup netlink listener: address already in use”
time=“2024-02-14T17:41:38Z” level=warning msg=“Using writeback cache I/O” devPath=/var/lib/incus/storage-pools/default/virtual-machines/debvm/root.img device=root fsType=btrfs instance=debvm instanceType=virtual-machine project=default

And I am sure that incus-agent is in PATH.

What VM did you try to run in this case?

Also, can you show the file /path/to/incus-agent output? I’d like to make sure it’s built as a static binary.

Sure. So, this is with running images:debian/bookworm and images:alpine/edge – both of them have working agent support, so I’m sure it’s an issue with my setup, and not the image.

/var/lib/incus # file /usr/sbin/incus-agent
/usr/sbin/incus-agent: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-x86_64.so.1, Go BuildID=nuNAGoGiVaY_r4WGLBqf/62S5EwFr8UH4OLOgB_3N/JRanP6OxceICzPoNKKt6/zXZJhlFUnfWApnfNJzBR, stripped

This is our incus-agent file.

Seems to be we have found the problem maybe?

Yep, that agent is dynamically linked when it should always be statically linked, so that’s your issue right there.

Wherever the agent is built, it’s critical to make sure it’s built with CGO_ENABLED=0 to force it to be static.

Replacing the agent binary with one you build in your .deb release fixes this problem. I guess the alpine maintainers need to know about this issue.