Incus on Fedora 41

Fedora 41 has incus in the official repos now. So i wanted to try it out. I setup a fresh fedora 41 server with btrfs and installed incus directly from dnf.

I then enables incus with systemd and ran

# echo "root:1000000:1000000000" >> /etc/subuid
# echo "root:1000000:1000000000" >> /etc/subgid

as described in Getting Started with Incus on Fedora · ganto/copr-lxc4 Wiki · GitHub linked from the incus docs.

However then running
incus launch images:alpine/edge alpine1 results in
Error: Failed instance creation: Failed to run: /usr/libexec/incus/incusd forkstart alpine1 /var/lib/incus/containers /run/incus/alpine1/lxc.conf: exit status 1

here is the output of incus info for the container

# incus info --show-log alpine1
Name: alpine1
Status: STOPPED
Type: container
Architecture: x86_64
Created: 2024/11/15 21:36 CET
Last Used: 1970/01/01 01:00 CET

Log:

lxc alpine1 20241115203711.737 ERROR    utils - ../src/lxc/utils.c:run_buffer:571 - Script exited with status 1
lxc alpine1 20241115203711.737 ERROR    start - ../src/lxc/start.c:lxc_init:845 - Failed to run lxc.hook.pre-start for container "alpine1"
lxc alpine1 20241115203711.737 ERROR    start - ../src/lxc/start.c:__lxc_start:2034 - Failed to initialize container "alpine1"
lxc alpine1 20241115203711.761 ERROR    utils - ../src/lxc/utils.c:run_buffer:571 - Script exited with status 1
lxc alpine1 20241115203711.761 ERROR    start - ../src/lxc/start.c:lxc_end:945 - Failed to run "lxc.hook.stop" hook
lxc alpine1 20241115203712.292 ERROR    utils - ../src/lxc/utils.c:run_buffer:571 - Script exited with status 1
lxc alpine1 20241115203712.292 ERROR    start - ../src/lxc/start.c:lxc_end:986 - Failed to run lxc.hook.post-stop for container "alpine1"
lxc alpine1 20241115203712.292 ERROR    lxccontainer - ../src/lxc/lxccontainer.c:wait_on_daemonized_start:829 - No such file or directory - Failed to receive the container state

any ideas what to do? Am i holding it wrong or is the official fedora package broken?

After the changes to `/etc/sub?id’, do you restart the Incus service in order to re-read those files?

I restarted the server afterwards.

Looks like this is a issue with fedora, broken for over 160 days:

is there any workaround or is incus on fedora just broken?

It’s pretty odd that nobody on the Fedora side has processed that PR by now…

@Conan_Kudo can you help with that?

As for workarounds, you can pretty trivially add the Environment=INCUS_SOCKET=/run/incus/unix.socket to your own systemd unit, either directly or as an override through systemctl edit.

2 Likes

Incus on Fedora 41 still seems to be quite neglected. The repositories still has Incus on 6.2 [1] and the socket environment variable hasn’t been touched for a few months [2].

I know this isn’t my place, and my relatively newness on the forums, but I wonder if it’s best to de-list the Incus instructions given that it’s broken out of the box, although easily fixable, and seemingly unmaintained.

[1] 2279094 – incus-6.8.0 is available
[2] As linked by @Viability, 2292096 – incus.service missing an environment variable INCUS_SOCKET

@Conan_Kudo anything that can be done to have the Fedora package more actively looked at?

I added a co-maintainer to help out recently, but I’ve been struggling to get incus to be updated and working because of all the weird path problems with the incus socket.

BTW this fix works but only when using the root user. When setting up projects for individual users it fails with an error Error: The incus daemon doesn't appear to be started (socket path: /var/lib/incus/unix.socket).

So there’s a bit more to do then just change the systemd service file to get it to fully work.

Incus update to 6.8: FEDORA-2024-0912cd3ad9 — security update for incus — Fedora Updates System

Want to report the 6.8 version of Incus from the test repositories appears to be working without any issues.

Then give feedback and karma on the update. It helps with getting updates delivered faster.

1 Like

I gave up using Incus on Fedora.

leandro@fedora:~/labs/incant$ incus shell dokku
Erro ao executar a expansão de alias: incus exec dokku – su -l
Erro: websocket: bad handshake

root@fedora:~# cat /etc/systemd/system/incus.service.d/override.conf
Environment=INCUS_SOCKET=/run/incus/unix.socket
root@fedora:~# ls -l /run/incus/unix.socket
srw-rw----. 1 root incus-admin 0 out 23 13:28 /run/incus/unix.socket

Use Debian or Ubuntu. Getting Incus up and running shouldn’t be unnecessarily complicated.

Welcome!

It’s good to include a full list of commands that demonstrates the issue.

Here’s me launching a Fedora 42 VM and installing Incus according to the official documentation.

First, I am installing Incus (6.15) on Fedora 42.

$ incus launch --vm images:fedora/42 fedora
Launching fedora
$ incus shell fedora
[root@fedora ~]# dnf install incus
Updating and loading repositories:
...
Transaction Summary:
 Installing:       362 packages

Total size of inbound packages is 259 MiB. Need to download 259 MiB.
After this operation, 948 MiB extra will be used (install 948 MiB, remove 0 B).
Is this ok [y/N]: y
...
>>>                                                                                                                                                                                                                
Complete!
[root@fedora ~]#

Second, I try to run some Incus commands. First, I tried incus list straight away. The service has not started. Then, I logout and log in again, just to verify. Still, the Unix socket is still not working because the service has not autostarted.

[root@fedora ~]# incus list
If this is your first time running Incus on this machine, you should also run: incus admin init
To start your first container, try: incus launch images:opensuse/tumbleweed
Or for a virtual machine: incus launch images:opensuse/tumbleweed --vm

Error: The incus daemon doesn't appear to be started (socket path: /var/lib/incus/unix.socket)
[root@fedora ~]# logout
$ incus shell fedora
[root@fedora ~]# incus list
Error: The incus daemon doesn't appear to be started (socket path: /var/lib/incus/unix.socket)
[root@fedora ~]# logout
$

How about restarting the Fedora VM? That’s it, it requires to restart the system.

$ incus restart fedora
$ incus shell fedora
[root@fedora ~]# incus list
+------+-------+------+------+------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+------+-------+------+------+------+-----------+
[root@fedora ~]# 

Bonus. If you have not restarted Incus in a Fedora VM, you get this output. Note that there are missing Incus services. I do not know why, perhaps restart systemd?

[root@fedora ~]# systemctl | grep incus
  run-incus_agent.mount             loaded active mounted   /run/incus_agent
  incus-agent.service               loaded active running   Incus - agent
[root@fedora ~]# 

After we restart the VM, it looks and works fine. I am not sure why and certainly someone more knowledgeable on systemd can help here.

[root@fedora ~]# systemctl | grep incus
  run-incus_agent.mount                                                                                    loaded active mounted   /run/incus_agent
  var-lib-incus-guestapi.mount                                                                             loaded active mounted   /var/lib/incus/guestapi
  var-lib-incus-shmounts.mount                                                                             loaded active mounted   /var/lib/incus/shmounts
  incus-agent.service                                                                                      loaded active running   Incus - agent
  incus-startup.service                                                                                    loaded active exited    Incus - Instance startup
  incus.service                                                                                            loaded active running   Incus - Daemon
  incus-user.socket                                                                                        loaded active listening Incus - Daemon (user unix socket)
  incus.socket                                                                                             loaded active running   Incus - Daemon (unix socket)
[root@fedora ~]# 

In your case, you gave up on the Unix socket and tried to setup a web socket. I do not know how you tried to do that, and it does not look it has been configured properly.

I did not try anything. I am just trying to start a VM. That “websocket error“ appears when I try to launch a VM. incus launch images:debian/13 provisioned --vm --type c1-m1 returns the same error. I was trying to figure out what one has to do to get it working, but it never worked for me, never.

Could be some issue with the communication of the client with the Incus Agent inside the VM.

I did not see however what image you used for the VM. Some images may have a dynamically-linked agent, therefore, it might not be able run properly.

As suggested below, if you are using some setting that is somewhat different of the common settings, then you should add it to the post.

It’s a problem that’s been reported on the Redhat Bugzilla: 2389081 – incus-agent fails to run in virtual machines after recent update

Graber also suggests the same: Unable to use `incus execute` in VMs after 6.15 · Issue #2398 · lxc/incus · GitHub

@Leandro_Ramos one workaround I used is to launch a Debian system instance, install incus-agent there, and then copy it to the host (specifically overwriting the one in, iirc, /usr/bin).

This post is about a separate issue on Fedora 41 that has been resolved in 2024. It was a packaging issue (for Fedora) with regards to the INCUS_SOCKET environment variable.

The new issue is again a packaging issue for Fedora and in this case, the incus-agent binary was not compiled statically. This meant that if you launch a VM with an image other than the Fedora version of the host, then the binary would likely fail to run. If the VM image is some other Linux distribution, then the failure would be expected.

Therefore, this post should be split and the bottom half of it, should have a title like Fedora packaging of Incus: incus-agent is not a static binary.

2 Likes