How to run Incus on Void Linux
Incus is the replacement of LXD one should use. For some reason it won't work well on Void out of the box after a while, and incus start <container-name>
might stop doing anything. How do we fix it?
Looking at /usr/share/doc/incus/README.voidlinux
it suggests the following:
Some container configurations may require that the `CGROUP_MODE`
variable in `/etc/rc.conf` be set to `unified`.
One way to solve it is that. I did another solution however, which I found at this github issue. I did the following:
I created this Perl script, called enable_incus
somewhere:
#!/usr/bin/env perl
use v5.38;
! -d '/sys/fs/cgroup/systemd' or say("Incus already enabled. Skipping."), exit;
system('sudo mkdir /sys/fs/cgroup/systemd');
system('sudo mount -t cgroup -o none,name=systemd systemd /sys/fs/cgroup/systemd');
say 'OK';
Then I edited /etc/sv/incus/run
and added this line near the top:
/path/to/enable_incus
...so that my script gets executed just before incus
is launched.
This fixed the problem.