Public bug reported:

When creating a new VM through Incus, I got error messages that the
Incus agent is not running inside the VM. This prevented me from running
commands like incus exec against the new VM.

The Incus logs (under /var/log/incus/incus.log) revealed messages like
the following:

  time="2025-12-03T10:32:30+08:00" level=warning msg="incus-agent not
found, skipping its inclusion in the VM config drive" err="<nil>"
instance=vm-test instanceType=virtual-machine project=user-40001


Cause:

Further testing revealed that the Incus service (on the host side)
expects the incus-agent binary somewhere on the PATH. However, the
related incus-agent package puts this binary under /usr/libexec/incus/,
which is NOT on the PATH variable of the incus service.

Imho, this is due to a misconfiguration of the PATH variable in the
service definition that comes with the incus-base package (from the
incus src package). The package installs the service here:

  /usr/lib/systemd/system/incus.service

Relevant part of this file:

  [Service]
  EnvironmentFile=/etc/default/incus
  EnvironmentFile=-/etc/environment

Relevant contents of the referenced files (on my system):

/etc/default/incus:

  PATH=/usr/libexec/incus:/usr/sbin:/usr/bin:/sbin:/bin

/etc/environment:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"


According to systemd EnvironmentFile docs: "If the same variable is set twice 
from these files, the files will be read in the order they are specified and 
the later setting will override the earlier setting."

See:
https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#EnvironmentFile=

This means that the incus service will run with the PATH from
/etc/environment, not with the PATH from /etc/default/incus. Since this
PATH does not list the /usr/libexec/incus directory, the incus service
will fail to find the incus-agent, leading to the bug that I've
described initially.


Proposed fix:

In the systemd definition of the Incus service, simply use the
EnvironmentFile values in reverse order. I.e.:

  [Service]
  EnvironmentFile=-/etc/environment
  EnvironmentFile=/etc/default/incus


Workaround:

Users who are affected by this bug could edit the systemd definition of
the incus service manually. Or, much better, add the changes through a
systemd override, see attached file.

This workaround has fixed this problem for me. The Incus service now
successfully injects the incus-agent into new VMs.


Additional info:

The Incus community has discussed a very similar problem here:
https://discuss.linuxcontainers.org/t/incus-agent-fails-to-start/18969

I have NOT filed this bug upstream in the Incus project yet, because the
relevant systemd service definition does not seem to originate there. At
least I could not find it there.

I have NOT filed this bug against the upstream Debian package yet,
because I have not tested this problem under Debian. However, the faulty
service definition is also visible in the Debian package.

I've encountered this bug after my recent upgrade from Ubuntu 2504 to
2510.

ProblemType: Bug
DistroRelease: Ubuntu 25.10
Package: incus 6.0.4-2
ProcVersionSignature: Ubuntu 6.17.0-7.7-generic 6.17.2
Uname: Linux 6.17.0-7-generic x86_64
ApportVersion: 2.33.1-0ubuntu3
Architecture: amd64
CasperMD5CheckResult: unknown
CurrentDesktop: ubuntu:GNOME
Date: Thu Dec  4 15:59:32 2025
InstallationDate: Installed on 2024-01-06 (698 days ago)
InstallationMedia: Ubuntu 23.10.1 "Mantic Minotaur" - Release amd64 (20231016.1)
SourcePackage: incus
UpgradeStatus: Upgraded to questing on 2025-11-05 (29 days ago)

** Affects: incus (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug questing

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2133854

Title:
  Incus service fails to inject incus-agent into new VMs due to
  misconfigured PATH

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/incus/+bug/2133854/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to